fix(agent-proxy): stop logging client cancellations as proxy errors - #352
Conversation
An agent hanging up mid-request, which happens on every interrupted prompt and every exit with calls in flight, cancels the request context and fails the round trip. That was classified as a proxy error, logged at ERROR, and answered with a 502 nobody was left to receive. Since the agent's TUI shares the terminal the proxy logs to, the line landed on top of the user's input. Cancellations now record their own decision at debug level, and report no status rather than an invented one.
|
💬 Discussion in Slack: #pr-review-cli-352-fix-agent-proxy-stop-logging-client-cancellations-as-proxy-err Posted by Review Police — reviews, comments, new commits, and CI failures will stream into this channel. |
|
| Filename | Overview |
|---|---|
| packages/agentproxy/proxy.go | Adds a narrowly scoped client-cancellation classification and conditionally omits the status field; no actionable defect was established. |
| packages/agentproxy/forward_test.go | Adds an end-to-end client-abort test covering the canceled decision, non-error level, and absent response status. |
| packages/agentproxy/activitylog_test.go | Extends decision-level coverage to assert that canceled activity is logged at debug level. |
Reviews (1): Last reviewed commit: "fix(agent-proxy): stop logging client ca..." | Re-trigger Greptile
PR overviewAll previously flagged issues have been addressed. No open security concerns remain on this pull request. Security reviewNo open security issues remain on this pull request. Fixed/addressed: 1 · PR risk: 0/10 |
…angs up A cancellation must not be able to erase what already happened. A credential applied to the request stays brokered at info level, and a refused host stays blocked at warn, so an agent cannot keep either out of the activity log by disconnecting at the right moment.
Description 📣
An agent hanging up mid-request was logged as a proxy error. Interrupting a prompt, or the agent exiting with calls in flight, cancels the request context and fails the round trip, which we classified as
decision=erroratERRORlevel with a502nobody was left to receive. The agent owns the terminal the proxy logs to, so the line printed on top of whatever was being typed.Cancellations now record as their own
canceleddecision at debug level: off the terminal, still in--log-fileand--log-level debug. They report no status instead of a fabricated one and skip the error response write, since the client is already gone. The check isr.Context().Err()rather than matching on the error string, so only a client that actually went away is treated this way and genuine upstream failures stayerror.Docs PR: Infisical/infisical#7524
Type ✨
Tests 🛠️
# Here's some code block to paste some code snippets