Skip to content

[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
Ooooze merged 3 commits into
mainfrom
codex/sentry-diagnostic/7848662602
Nov 18, 2026
Merged

Ooooze merged 3 commits into
mainfrom
codex/sentry-diagnostic/7848662602

Conversation

@Ooooze

@Ooooze Ooooze commented Nov 15, 2026

Copy link
Copy Markdown
Contributor

Diagnostic instrumentation only. The original issue is NOT fixed or closed.

Diagnostic candidate ready for ATOMIC-CHAT-SERVER-1S (Error: cli chat: unknown on atc@0.2.18, dist b869424 = current base). The failure site is the SSE reading loop of streamChat in src/terminal-service/client.ts, reached from src/commands/access/terminal.ts:101 by atc chat; failureReport scrubs the message to Unexpected failure in chat and adds no error_code for a plain Error, so the four plain-Error branches (invalid endpoint, server-reported generation error, empty body, truncated stream) and the dynamic JSON.parse SyntaxError are indistinguishable in Sentry. The controller generated src/telemetry/sentry-agent-diagnostics.ts with the four accepted exact-message rules (CLI_CHAT_ENDPOINT_INVALID, CLI_CHAT_GENERATION_ERROR, CLI_CHAT_EMPTY_RESPONSE, CLI_CHAT_STREAM_TRUNCATED) plus include_cause_codes=true; src/telemetry/native-diagnostics.ts is unchanged and already merges those tags. This agent added one test to src/telemetry/sentry-agent-diagnostics.test.ts ('names the CLI chat client branches the terminal chat command throws') covering all four branches, a scrubbed cli/chat report carrying diagnostic_code plus an allowlisted UND_ERR_SOCKET cause, 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 original cli chat failure 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/

@Ooooze
Ooooze marked this pull request as ready for review November 18, 2026 14:49
@Ooooze
Ooooze merged commit 2a6b66d into main Nov 18, 2026
17 of 18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant