fix: propagate correct agent exit code by sreya · Pull Request #21718 · coder/coder

@sreya

…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

mafredri

@sreya

@sreya sreya deleted the cli-output-4x6k branch

January 28, 2026 21:56