Skip to content

Return exit code on command failure instead of throwing#25

Merged
vijit-lark merged 2 commits intomainfrom
vd-20260414-1130
Apr 14, 2026
Merged

Return exit code on command failure instead of throwing#25
vijit-lark merged 2 commits intomainfrom
vd-20260414-1130

Conversation

@vijit-lark
Copy link
Copy Markdown
Contributor

@vijit-lark vijit-lark commented Apr 14, 2026

Summary

  • Return exit code on command failure instead of throwing: Non-zero exit codes from command execution are now returned as part of the result instead of raising an error. When a command fails, remaining commands in the batch are skipped and only executed commands appear in the result message.
  • Log warning on unexpected WebSocket disconnects: Adds finalized and cancelled flags to WebSocketSession so the close event handler can distinguish graceful shutdowns from unexpected client disconnects, and logs a warning with the WebSocket close code and reason.
  • Add warn to Logger: Adds warn method to the Logger interface and all implementations (createLogger, createRedactingLogger, defaultLogger).
  • Bumps both runtimeuse and runtimeuse-client to 0.10.0 (breaking: new required warn method on Logger, changed command failure behavior).

Test plan

  • Run existing unit tests (npm test in packages/runtimeuse) to verify mock loggers and command failure behavior
  • Manually test graceful shutdown path — should see "All artifacts uploaded." and no warning
  • Manually test abrupt client disconnect — should see the new warning with close code/reason
  • Manually test cancel flow — should see cancel log but no unexpected-close warning
  • Verify failed command (exit 1) returns result with exit_code: 1 instead of throwing
  • Verify remaining commands are skipped after a non-zero exit code
  • Run Python client tests (uv run pytest in packages/runtimeuse-client-python)

Add `finalized` and `cancelled` flags to WebSocketSession so the
`close` event handler can distinguish graceful shutdowns from
unexpected disconnects and log a warning with the close code/reason.

Also adds `warn` to the Logger interface and all implementations,
and bumps both packages to 0.10.0 (breaking: new required Logger
method).

Made-with: Cursor
Non-zero exit codes from command execution are now returned as part of
the result instead of raising an error. When a command fails, remaining
commands in the batch are skipped and only executed commands appear in
the result message.

Made-with: Cursor
@vijit-lark vijit-lark changed the title Log warning on unexpected WebSocket disconnects Return exit code on command failure instead of throwing Apr 14, 2026
@vijit-lark vijit-lark merged commit 4c4acab into main Apr 14, 2026
5 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