docs(logger): document level convention re Slack/PostHog hook#3650
Merged
Conversation
Add JSDoc context next to the level guide in server/src/logger.ts explaining that logger.error / logger.fatal trigger the #aao-errors Slack alert and PostHog $exception capture via the pino hook, so they should be used only for unexpected, page-worthy failures. Expected failures with a graceful fallback (third-party 4xx, validation, etc.) should be logger.warn so the alert path is not taken. Same anti-pattern surfaced as ":rotating_light: System error: unknown" noise in PRs #3578, #3622, #3648. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
bokelley
enabled auto-merge (squash)
April 30, 2026 10:11
This was referenced Apr 30, 2026
bokelley
added a commit
that referenced
this pull request
Apr 30, 2026
Extends the convention added in #3650 with the third tier that emerged during the alert-noise cleanup: - Tier 1: logger.error — unexpected, pages on-call - Tier 2: logger.warn — expected third-party state we accept - Tier 3: logger.warn + createEscalation({ category, dedup_key }) — actionable but not page-worthy, queued for batch triage Docs-only. Future authors picking between error and warn for a third-party failure now have a single reference, and the escalation tier (introduced in #3672) is discoverable from the same JSDoc instead of being implicit in PR history. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Document in
server/src/logger.tsJSDoc thatlogger.error/logger.fatal(level ≥ 50) trigger the#aao-errorsSlack alert and PostHog$exceptioncapture via the pino hook in this file (andnotifyErrorChannelinutils/posthog.ts).Authors writing tool handlers should use:
errorfor unexpected, page-worthy failures (network/parse failures in catch blocks that "shouldn't happen")warnfor expected failures that already return a graceful user-facing fallback (third-party 4xx, validation errors, "issue not found", etc.)This is the convention I learned the hard way fixing the
:rotating_light: System error: unknownSlack noise in PRs #3578, #3622, and #3648. Codifying it next to the existing log-level guide so future authors and reviewers have a clear reference.Audit data
178
logger.errorcall sites currently exist acrossserver/src/addie/mcp/*.ts. Top files:addie/mcp/admin-tools.tsaddie/mcp/member-tools.tsaddie/mcp/certification-tools.tsmcp/si-host-tools.ts,mcp/moltbook-tools.ts,mcp/knowledge-search.ts,mcp/billing-tools.tsMany are legitimate (catch blocks for unexpected failures), some are likely the user-driven-failure-with-graceful-fallback anti-pattern. Triage will follow as alerts surface in
#aao-errors. No automated downgrade in this PR — that's judgment-dependent and would have a high false-positive rate as a lint rule.Test plan
test:unit + test-dynamic-imports + typecheck) — passed🤖 Generated with Claude Code