feat(telemetry): capture error_class on setup_complete failures#144
Merged
Conversation
When setup fails, the dashboard's Phase Failures view showed only the phase (auth_check / init_scan) but not WHY. Now we populate error_class: - auth_check -> "oauth_missing" - init_scan -> classifyError(err) of the underlying exception Backend already reads error_class from any event payload (no migration). 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
When setup fails, the dashboard's Phase Failures view (
/admin/analytics→ Code → Setup health) showed only the failed phase —auth_check: 7,init_scan: 1— buterror_classwas always NULL, so it was impossible to tell why setup failed without grepping logs.This PR populates
error_classon thesetup_completeevent:auth_check"oauth_missing"ANTHROPIC_API_KEYenv var — caller never authenticated. Slug already exists in the boundedErrorClassvocab.init_scanclassifyError(err)errorevent; now also stamped ontosetup_completeso it's visible in one row of the dashboard's Phase Failures table.Backend ingestion already reads
error_classfrom any event payload (misc_routes.py:2100) — no migration, no schema change.Why now
Dashboard at https://cloud.axme.ai/admin/analytics currently shows:
auth_check: 7— looking at raw rows, these are all real users who ranaxme-code setupwithout authenticating. Not a bug — but with this fix the dashboard will showauth_check / oauth_missing: 7so an operator can read it without DB access.init_scan: 1— one user's LLM scan threw;error_classwas NULL so I couldn't tell from the dashboard whether it wastimeout,api_error,api_rate_limit, etc. With this fix the next such failure will be self-describing.Files changed
src/cli.ts — 5 lines:
setupErrorClass: ErrorClass | nullnext to existingsetupPhaseFailed.auth_checkandinit_scanbranches.error_classin thesendTelemetryBlocking("setup_complete", { ... })payload.Test plan
npx tsc --noEmit)npm run build)error_classpopulated for any new setup-failed rows on the dashboardAfter merge
Effective for users on the next CLI release. Existing rows in
telemetry_eventsare unchanged — the historical 7 + 1 stay NULL.🤖 Generated with Claude Code