Skip to content

fix: forward app-server stderr to adapter stderr - #616

Open
delete-cloud wants to merge 1 commit into
agentclientprotocol:mainfrom
delete-cloud:fix/forward-app-server-stderr
Open

delete-cloud wants to merge 1 commit into
agentclientprotocol:mainfrom
delete-cloud:fix/forward-app-server-stderr

Conversation

@delete-cloud

Copy link
Copy Markdown

Problem

App-server diagnostics are invisible to ACP clients while the process is running. APP_SERVER_LOGS only provides an optional file copy, and crash-time stderr capture does not expose live diagnostics.

Fix

Forward stderr buffers unchanged to adapter stderr, preserving optional file logging, JSON-RPC stdout handling, and crash-time stderr capture. No prefix or additional configuration is needed.

Writes intentionally do not apply backpressure: the app-server stderr tracing layer defaults to ERROR, with verbosity controlled by RUST_LOG. A process-wide stderr error listener ignores EPIPE and ERR_STREAM_DESTROYED, so late diagnostics after the client closes the adapter's stderr reader no longer terminate the adapter; other errors still propagate. The codex-acp login command now also displays app-server diagnostics in the terminal. Both READMEs document forwarding and optional file logging.

Tests

Typecheck and the full test suite pass. Controlled subprocess tests cover forwarding with and without file logging, absence of log files when disabled, JSON-RPC responses, stdout isolation, UTF-8 across chunk boundaries, and successful operation after the stderr reader closes (POSIX only; skipped on Windows). The new tests pass three consecutive runs with retries disabled. Removing the closed-stream protection makes the new regression test fail.

This fix is already in use downstream in LodyAI/acp-extension-codex#64.

Assisted-by: GPT-6 Astra

Forward app-server stderr buffers unchanged to adapter stderr while the
child is running, independent of APP_SERVER_LOGS. Keep the optional file
copy, JSON-RPC stdout handling, and crash-time stderr capture.

Ignore EPIPE and ERR_STREAM_DESTROYED on adapter stderr so diagnostics
written after the client closes the stderr reader do not terminate the
adapter; other errors still propagate.

Assisted-by: GPT-6 Astra

This branch has not been deployed

No deployments
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