fix(addie): proper source attribution for 44 root-logger files#3622
Merged
Conversation
…ution Files in server/src/addie/ that imported the root pino `logger` directly were producing #aao-errors Slack alerts as ":rotating_light: System error: unknown [web]" because the pino error hook -> notifyErrorChannel path saw no `module` binding and fell back to "unknown" (server/src/utils/posthog.ts:245). Mechanical codemod: each file now imports `createLogger` and binds a module name. No behavioral change — child pino loggers are signature-compatible with the root, and errorHook/logHook fire the same way. Module names follow existing convention by directory: - addie/<file>.ts -> addie-<basename> - addie/mcp/<file>.ts -> addie-<basename> - addie/jobs|services/<file> -> bare <basename> - addie/home/<file>.ts -> addie-home-<basename> - addie/home/builders/<file> -> addie-home-builder-<basename> - addie/rules/index.ts -> addie-rules Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
bokelley
enabled auto-merge (squash)
April 30, 2026 02:36
| import { logger } from '../logger.js'; | ||
| import { createLogger } from '../logger.js'; | ||
|
|
||
| const logger = createLogger('addie-thread-service'); |
This was referenced Apr 30, 2026
bokelley
added a commit
that referenced
this pull request
Apr 30, 2026
…3650) 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>
3 tasks
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
Mechanical codemod across 44 files in
server/src/addie/: replaceimport { logger } from '<path>/logger.js'withimport { createLogger } from '<path>/logger.js'; const logger = createLogger('<module-name>').Why
These files were producing
:rotating_light: *System error: unknown [web]*alerts in#aao-errors. Without amodulebinding on the pino child logger, the error hook inserver/src/utils/posthog.ts:245falls back tomodule || 'unknown'and posts the alert with no source attribution.This is the same root cause as #3578, just at scale. PostHog
$exceptionevents from these modules will now be attributed correctly too.Approach
Followed the existing convention by directory:
addie/<file>.ts→addie-<basename>addie/mcp/<file>.ts→addie-<basename>addie/jobs/<file>.ts,addie/services/<file>.ts→ bare<basename>addie/home/<file>.ts→addie-home-<basename>addie/home/builders/<file>.ts→addie-home-builder-<basename>addie/rules/index.ts→addie-rulesDiff is +138 / -44, exactly 4 lines added and 1 removed per file. Child pino loggers are signature-compatible with the root, so no behavioral change beyond attribution.
Test plan
tsc --noEmit— cleantest:unit + test-dynamic-imports + typecheck) — passed#aao-errorsshowsource: <module-name>instead ofunknownfor these files🤖 Generated with Claude Code