Before submitting
- I searched existing issues and did not find a duplicate.
- I included enough detail to reproduce or investigate the problem.
Area
apps/server
Summary
When a Codex app-server crashes, T3 captures its stderr correctly but stderrExcerpt() then selects the wrong line to report. Rust crash output never matches ERROR_LINE_PATTERN, so the excerpt falls back to the last stderr line. For every Rust panic, stack overflow, or allocation failure, that last line is the useless note: run with \RUST_BACKTRACE=1` ... hint. The actual cause (memory allocation of N bytes failed, panicked at ..., overflowed its stack`) is captured in the tail and then silently discarded.
The user-facing error then says "Check the server logs for the provider's output", but the server logs contain only the same truncated excerpt. There is nowhere in the app where the real cause survives. #37029 fixed the transport race so the exit code now reaches the user; this is the remaining half of the problem: the exit reason is still lost.
Steps to reproduce
stderrExcerpt is a pure function, so this is deterministic. Real Rust fatal output from a crashing codex.exe app-server on Windows looks like this (reproduced reliably by running the binary under memory pressure):
thread 'tokio-rt-worker' (51304) has overflowed its stack
memory allocation of 45408 bytes failed
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Feeding that tail through the logic in stderrExcerpt:
ERROR_LINE_PATTERN is /^(?:[a-z]*error|fatal)(?: ?\[[^\]]+\])?:\s*\S/i. None of the three lines start with error-like tokens, so errorIndex is -1.
- The last line does not match
EXIT_SUMMARY_PATTERN, so lineIndex falls back to lines.length - 1.
- The excerpt becomes
note: run with \RUST_BACKTRACE=1` environment variable to display a backtrace` and nothing else.
Observed in production on T3 Code Nightly 0.1.13-nightly.20261125.5245 (Windows 11, codex-cli 0.172.0): 9 separate app-server crashes in two days, every one surfaced as:
The provider event stream closed unexpectedly: the provider process exited with code 3221226505: note: run with RUST_BACKTRACE=1 environment variable to display a backtrace
The server trace (server.trace.ndjson) carries the identical excerpt in CodexAppServerProcessExitedError. In every case the true cause was a memory-allocation failure, only recoverable by reproducing the crash outside T3. One shared provider process crash also fails every in-flight turn at once (16 interrupted turns in the incident analysed here), so users hit this message in bursts and learn nothing from it.
Expected behavior
The excerpt should preserve the lines that explain why the process died, e.g. memory allocation of 45408 bytes failed or thread 'main' panicked at .... Possible directions:
- extend the pattern with Rust fatal output:
/memory allocation of \d+ bytes failed/, /thread '.+' panicked at/, /overflowed its stack/
- prefer the first non-empty line of the tail over the last when nothing matches (fatal output usually prints the cause first and the backtrace hint last)
- or include a few lines of context instead of a single line whenever the process exited non-zero
Actual behavior
The excerpt is the RUST_BACKTRACE note in 100% of Rust crash cases, the cause is discarded even though it was captured, and the instruction to check server logs leads nowhere because the logs contain the same excerpt.
Impact
Major degradation or frequent failure. Not because T3 causes the crashes, but because every provider crash on Windows (a memory-pressure crash is common for heavy multi-agent use) is undiagnosable from inside the app. Diagnosing one incident required extracting the bundled server.asar and reproducing the crash in a memory-limited job object.
Environment
- T3 Code Nightly 0.1.13-nightly.20261125.5245
- Windows 11 Pro, 64 GB RAM
- codex-cli 0.172.0 (
@openai/codex npm package, codex.exe app-server)