Repository navigation
Conversation
nc9
force-pushed
the
boat/cli-crash-reporting-705
branch
from
November 16, 2026 04:33
841f6a6 to
ed4acb4
Compare
…rver, proxied through the API (repo#705) Signed-off-by: Nik Cubrilovic <[email protected]>
nc9
force-pushed
the
boat/cli-crash-reporting-705
branch
from
November 17, 2026 01:43
ed4acb4 to
7cf3cb3
Compare
This branch has not been deployed
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
Phase 3 of squirrelscan/repo#705, the public (CLI and MCP) half. The API half (forwarding crash events to Sentry server-side) is private and filed as a follow-up, so this PR does not close the epic.
apps/cli/src/self/crash-reporter.ts(new): process-wideuncaughtExceptionandunhandledRejectionhandlers, installed first thing inrun()(light path included). A crash prints a friendly stderr message with acli_<12 hex>reference, sends one report, waits for it (at most 2 s) and exits 1. Node built-ins only; telemetry is imported lazily on crash, so the light startup path (feat(rules): rendered reflow, text spacing and text resize checks (repo#3091) #2023) is unchanged.run-cli.ts: an unexpected error thrown by a command goes through the same path (it used toconsole.errorthe raw error).mcp/server.ts: every registered tool handler is wrapped. A throw becomes anisErrortool result carrying a reference, one stderr line (never stdout), and a report. SDKProtocolErrors pass through untouched.telemetry.ts:sendCrashReportposts anerrorevent on the existing/v1/tracespath withreference,error_type(class name),command(subcommand name only),platform,source, andstack. The API's zod schema strips unknown fields today, so this is backward compatible until the API side lands.NO_TELEMETRY,DO_NOT_TRACK, user and projecttelemetry=false) and--offlinesend nothing. The telemetry notice gains one sentence and its version goes 2 to 3 so existing installs see it once more; stack frames are only sent once v3 has been seen (the session token still needs v2).docs/cli/self.mdx(new "Crash reports" subsection),docs/faq.mdx, README telemetry paragraph, CHANGELOG.Acceptance criteria (repo#705, Phase 3 item)
process crash handlers > an uncaught exception prints a reference, exits 1 and reports it(real subprocess, local stand-in API).... > an unhandled rejection prints a reference, exits 1 and reports it.... > a command that throws prints a reference, exits 1 and reports it.sendCrashReport > an MCP tool that throws ...,... > an MCP protocol error passes through unreported. Process-level MCP crashes use the same global handlers (stderr only).--offline: reference still printed, exit 1, nothing sent.... > with telemetry off ...,... > with --offline ...,sendCrashReport > every opt-out sends nothing.no third-party DSN in the binary > the CLI has no Sentry SDK dependency and no DSN in its source.Gates
apps/cli:bun run format:checkpass,bun run lintpass,bun run typecheckpass.bun test tests/self/crash-reporter.test.ts tests/cli/run-cli.test.ts tests/self/first-run-telemetry.test.ts tests/mcp/server.test.ts tests/cli/startup.test.ts: 87 pass, 0 fail.bun test tests/self/telemetry.test.ts tests/squirrel-home-guard.test.ts tests/mcp/protocol.test.ts tests/cli/setup-telemetry.test.ts tests/cli/banner.test.ts: 32 pass, 0 fail.docs/:make validateall checks passed.Agent skill
The squirrelscan agent skill does not need a change. It could later mention quoting the
cli_reference when reporting a crash, but nothing it says is now wrong.