Skip to content

fix: route all JSON-mode abort envelopes to stdout (#819 #820 #823)#3197

Merged
code-yeongyu merged 4 commits into
mainfrom
fix/abort-envelope-json-stdout
May 29, 2026
Merged

fix: route all JSON-mode abort envelopes to stdout (#819 #820 #823)#3197
code-yeongyu merged 4 commits into
mainfrom
fix/abort-envelope-json-stdout

Conversation

@code-yeongyu
Copy link
Copy Markdown
Collaborator

Fixes ROADMAP #819, #820, #823.

All handled errors in --output-format json mode now write the structured abort envelope to stdout (rc=1) and keep stderr empty. Previously the top-level error handler and resume_session JSON branches used eprintln! which sent the envelope to stderr.

Surfaces fixed:

  • Top-level abort handler: export --session <missing>, session <subcommand>, prompt (no text), unknown subcommand fallthrough, flag errors, and all other run() failures
  • resume_session JSON branches: session load errors, unsupported commands, parse errors, command execution errors

Tests: Updated 24 failing contract tests to assert JSON envelopes on stdout. 70 contract tests pass (was 68).

All handled errors in --output-format json mode now write the structured
abort envelope to stdout (rc=1) and keep stderr empty. Previously the
top-level error handler and resume_session JSON branches used eprintln!
which sent the envelope to stderr, breaking machine consumers that read
stdout for command payloads.

Surfaces fixed:
- Top-level abort handler (main.rs): export --session <missing>,
  session <subcommand>, prompt (no text), unknown subcommand fallthrough,
  flag errors, and all other run() failures
- resume_session JSON branches: session load errors, unsupported commands,
  parse errors, command execution errors

Test changes: updated 24 failing contract tests to assert JSON envelopes
on stdout. Added stderr-clean assertions where appropriate. 70 contract
tests pass (was 68; 2 additional from regression coverage).

ROADMAP: #819 (export session-not-found), #820 (interactive_only class),
#823 (missing prompt)
@code-yeongyu code-yeongyu merged commit b4b1ba1 into main May 29, 2026
6 checks passed
@code-yeongyu code-yeongyu deleted the fix/abort-envelope-json-stdout branch May 29, 2026 04:30
@1716775457damn
Copy link
Copy Markdown

Comprehensive. Covering every code path — top-level handler, resume_session, and all fallthrough surfaces — is exactly what this needed. 70 contract tests is solid confidence.

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.

2 participants