Skip to content

fix: Surface server errors in CLI events and unregister commands - #118

Merged
evansenter merged 1 commit into
mainfrom
issue-117
Apr 1, 2026
Merged

fix: Surface server errors in CLI events and unregister commands#118
evansenter merged 1 commit into
mainfrom
issue-117

Conversation

@evansenter

Copy link
Copy Markdown
Owner

Summary

  • CLI cmd_events and cmd_unregister now detect and surface server-side {"error": ...} responses
  • In --json mode: outputs the full error dict to stdout for machine consumption
  • In text mode: prints error message to stderr
  • Both modes exit with status code 1 on error
  • 3 new tests covering both modes and both commands

Context

Discovered during live testing of #115 — the CLI --resume --json mode silently returned {"events": [], "next_cursor": null} instead of surfacing the server's {"error": "Session not found"} response.

Note: The venv bootstrap task from #117 was already fixed by PR #109 (migration to uv), so only the CLI error surfacing is addressed here.

Fixes #116, fixes #117

Test plan

  • test_events_error_json_mode — JSON mode outputs error dict and exits 1
  • test_events_error_text_mode — text mode prints to stderr and exits 1
  • test_unregister_error_surfaces — unregister surfaces errors to stderr
  • All 304 tests pass, lint and format clean

🤖 Generated with Claude Code

CLI --json mode now outputs the full error dict and exits non-zero when
the server returns {"error": ...}. Text mode prints to stderr. Covers
both cmd_events (e.g., resume with nonexistent session) and
cmd_unregister (e.g., session not found).

Fixes #116

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prompt: evansenter/dotfiles/.../claude-review.md

Code Review

Summary

Clean fix for CLI error surfacing in cmd_events and cmd_unregister. Both commands now detect {"error": ...} responses from the server, print appropriately (JSON to stdout or message to stderr depending on mode), and exit non-zero. Tests cover all three paths well.

Verdict

APPROVE - Code is correct, well-tested, and addresses the linked issues.


Automated review by Claude Code

@evansenter

Copy link
Copy Markdown
Owner Author

No reviewer feedback to address. PR is approved and CI green.

@evansenter
evansenter merged commit 9580e3a into main Apr 1, 2026
6 checks passed
@evansenter
evansenter deleted the issue-117 branch April 1, 2026 11:35
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.

chore: Fix venv bootstrap and CLI error surfacing bug: CLI --resume --json doesn't surface server error for nonexistent sessions

1 participant