Repository navigation
[sentry-diagnostic:7848662602] Diagnostic candidate ready for ATOMIC-CHAT-SERVER-1S (Error: cli chat: unknown on atc@0.2.18, dist b869424b124d = current base). The failure site is the SSE reading loo - #101
Merged
Conversation
Ooooze
marked this pull request as ready for review
November 18, 2026 14:49
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.
Diagnostic instrumentation only. The original issue is NOT fixed or closed.
Diagnostic candidate ready for ATOMIC-CHAT-SERVER-1S (
Error: cli chat: unknownon atc@0.2.18, dist b869424 = current base). The failure site is the SSE reading loop ofstreamChatinsrc/terminal-service/client.ts, reached fromsrc/commands/access/terminal.ts:101byatc chat;failureReportscrubs the message toUnexpected failure in chatand adds noerror_codefor a plainError, so the four plain-Errorbranches (invalid endpoint, server-reported generation error, empty body, truncated stream) and the dynamicJSON.parseSyntaxError are indistinguishable in Sentry. The controller generatedsrc/telemetry/sentry-agent-diagnostics.tswith the four accepted exact-message rules (CLI_CHAT_ENDPOINT_INVALID, CLI_CHAT_GENERATION_ERROR, CLI_CHAT_EMPTY_RESPONSE, CLI_CHAT_STREAM_TRUNCATED) plusinclude_cause_codes=true;src/telemetry/native-diagnostics.tsis unchanged and already merges those tags. This agent added one test tosrc/telemetry/sentry-agent-diagnostics.test.ts('names the CLI chat client branches the terminal chat command throws') covering all four branches, a scrubbedcli/chatreport carryingdiagnostic_codeplus an allowlistedUND_ERR_SOCKETcause, privacy of edited messages/unapproved codes and a cyclic cause chain; on the original base (four chat-stream rules only) that test fails at its first CLI assertion, while in the patched copy all six tests in the file pass. Plus the new ADR and one INDEX bullet. This observation does not repair the crash: the originalcli chatfailure stays unclassified until a release carrying these rules reports which branch fired. Insufficient evidence remains for a behavioral fix: one occurrence, no endpoint/model, no daemon log, and JSON.parse/HTTP-status branches stay unnamed even with these rules.Evidence:
Event ATOMIC-CHAT-SERVER-1S: release atc@0.2.18, dist b869424, exception
Error: cli chat: unknown, component cli, operation chat, failure_reason unknown, one occurrence, linux x64.snapshot base_sha b869424 with empty release_diffs for atc@0.2.18#b869424b124d: the event runs the current base.
Frames: src/io.ts:109, src/main.ts:71 (runCli catch -> captureFailure with component: 'cli', operation: resolved.path.join('.')), src/commands/access/terminal.ts:101 (chatCommand.run), src/terminal-service/client.ts:110 (innermost, inside the while(!done) reader loop of streamChat).
src/telemetry/failures.ts technicalError builds
new Error(Unexpected failure in ${operation})and tags only{ ...context, error_code: reportCodeOf(error), ...nativeFailureTags(error) }; reportCodeOf is undefined for a plain Error, matching the event's absent error_code and generic title.src/terminal-service/client.ts throws four plain Errors: 'Use an HTTP endpoint without credentials, a query, or a fragment.' (endpointUrl), 'The server reported a generation error. Inspect the server log.', 'The server returned an empty response.', 'The response ended before completion. The partial reply is kept.';
JSON.parse(value)in the same loop can throw a dynamic SyntaxError.Generated src/telemetry/sentry-agent-diagnostics.ts now maps those four messages to CLI_CHAT_ENDPOINT_INVALID, CLI_CHAT_GENERATION_ERROR, CLI_CHAT_EMPTY_RESPONSE, CLI_CHAT_STREAM_TRUNCATED and keeps the four existing chat-stream rules; SENTRY_AGENT_CAUSES retains the approved allowlist.
src/telemetry/native-diagnostics.ts is untouched: it spreads sentryAgentDiagnosticTags(error) after the existing SEGMENTER_FAILURES result, so severity, filtering, consent and exit behaviour are unchanged.
check on src/telemetry/sentry-agent-diagnostics.test.ts in the patched copy: 3 suites, 6 tests, 6 passed, including 'bounded CLI chat client diagnostic tags names the CLI chat client branches the terminal chat command throws'.
On the original base only the four chat-stream rules exist, so the new test's first assertion (CLI_CHAT_ENDPOINT_INVALID) cannot match and the test fails with the declared fragment.
New ADR docs/decisions/2026-11-15-diagnose-cli-chat-failures.md records context, decision, consequences, alternatives and links; docs/decisions/INDEX.md received one appended bullet referencing it.
docs/decisions/2026-11-04-diagnose-chat-stream-failures.md establishes the same finite-tag precedent for the daemon-side chat.stream boundary.
Question: Which exact CLI chat client branch or error cause produced the uncoded failure reported as ATOMIC-CHAT-SERVER-1S on atc@0.2.18 (operation chat, component cli, no error_code)?
Expected observation: A later event from the same boundary carries diagnostic_code CLI_CHAT_GENERATION_ERROR, CLI_CHAT_STREAM_TRUNCATED, CLI_CHAT_EMPTY_RESPONSE or CLI_CHAT_ENDPOINT_INVALID, or a diagnostic_cause_code such as ECONNRESET/UND_ERR_SOCKET; an event with neither means a dynamic-message branch (JSON.parse or an HTTP status message) failed.
Removal condition: Remove or replace these rules once an event names the failing branch and its handling (typed refusal, remote error or a real defect fix) is decided; delete the ADR-cited rules at the next core or telemetry change.
Bounds: two finite tags on an existing event, five Error causes; no new events, free-form messages, user content or reporting-policy changes.
Regression tests: src/telemetry/sentry-agent-diagnostics.test.ts
Full CI and human review are required.
Report: http://127.0.0.1:8080/tenants/707d0855-80ab-4e1f-a156-f1c4546cbf52/runs/8b37e209-6e24-4607-94f7-e6d6ebf4c4b6
Sentry: https://atomic-chat.sentry.io/issues/7848662602/