Skip to content

fix: propagate correct agent exit code #21718

Merged
sreya merged 3 commits intomainfrom
cli-output-4x6k
Jan 28, 2026
Merged

fix: propagate correct agent exit code #21718
sreya merged 3 commits intomainfrom
cli-output-4x6k

Conversation

@sreya
Copy link
Collaborator

@sreya sreya commented Jan 28, 2026

The reaper (PID 1) now returns the child's exit code instead of always exiting 0. Signal termination uses the standard Unix convention of 128 + signal number.

fixes #21661

@coder-tasks

This comment was marked as off-topic.

…gging

This addresses two issues that make root cause analysis of agent crashes difficult:

1. Reaper exit code propagation: The reaper (PID 1) now returns the child's
   exit code instead of always exiting 0. Signal termination uses the standard
   Unix convention of 128 + signal number. The CLI logs the exit status and
   uses ExitError to propagate it.

2. Goroutine panic recovery: Added defer logPanic() to raw goroutines in the
   agent to ensure panics are logged with stack traces before re-panicking.
   This helps diagnose crashes that would otherwise leave no trace.

Fixes #21661
@sreya sreya changed the title fix: capture agent goroutine panics fix: propagate correct agent exit code Jan 28, 2026
@sreya sreya requested a review from mafredri January 28, 2026 02:08
@coder-tasks

This comment was marked as off-topic.

Copy link
Member

@mafredri mafredri left a comment

Choose a reason for hiding this comment

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

Nice!

@sreya sreya merged commit 4f1fd82 into main Jan 28, 2026
45 of 47 checks passed
@sreya sreya deleted the cli-output-4x6k branch January 28, 2026 21:56
@github-actions github-actions bot locked and limited conversation to collaborators Jan 28, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: reaper discards child exit status, masking agent crash root cause

2 participants