Repository navigation
test(agents): add native loopback regression for outer-abort SSE cancellation - #109185
Conversation
7befc51 to
6db6697
Compare
|
Codex review: needs maintainer review before merge. Reviewed July 18, 2026, 3:25 AM ET / 07:25 UTC. Summary PR surface: Tests +85. Total +85 across 1 file. Reproducibility: not applicable. This PR adds regression coverage rather than reporting a new user-facing failure. Its supplied loopback setup is a concrete way to exercise the existing outer-abort behavior. Review metrics: none identified. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Keep the caller-owned outer-abort contract and land the deterministic native-loopback regression once the current-head validation confirms it remains stable. Do we have a high-confidence way to reproduce the issue? Not applicable: this PR adds regression coverage rather than reporting a new user-facing failure. Its supplied loopback setup is a concrete way to exercise the existing outer-abort behavior. Is this the best way to solve the issue? Yes. A native local HTTP server with real fetch and stream consumption is the narrowest maintainable guard for reader cancellation, and it avoids reintroducing the rejected competing stream-deadline policy. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 85087cbb5f69. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Tests +85. Total +85 across 1 file. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
Review history (5 earlier review cycles)
|
6db6697 to
7a5e2b2
Compare
|
Addressed ClawSweeper feedback on head
Proof: @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
7a5e2b2 to
ece3036
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
ece3036 to
2b50a42
Compare
…ellation Adds a native loopback /api/stream regression proving that the existing outer AbortSignal cancels a keepalive-style dripping SSE body. The drip resets per-chunk idle, so only the outer abort can terminate the stream within budget. Removes the previously proposed streamDeadlineMs opt-in: no production caller needed it and the outer signal already owns total stream lifetime. Co-Authored-By: nebulacoder-v8.0 <[email protected]>
2b50a42 to
03f2c28
Compare
|
Merged via squash.
|
…ellation (openclaw#109185) * test(agents): add native loopback regression for outer-abort SSE cancellation Adds a native loopback /api/stream regression proving that the existing outer AbortSignal cancels a keepalive-style dripping SSE body. The drip resets per-chunk idle, so only the outer abort can terminate the stream within budget. Removes the previously proposed streamDeadlineMs opt-in: no production caller needed it and the outer signal already owns total stream lifetime. Co-Authored-By: nebulacoder-v8.0 <[email protected]> * test(agents): make proxy abort regression deterministic --------- Co-authored-by: nebulacoder-v8.0 <[email protected]> Co-authored-by: Peter Steinberger <[email protected]>
…ellation (openclaw#109185) * test(agents): add native loopback regression for outer-abort SSE cancellation Adds a native loopback /api/stream regression proving that the existing outer AbortSignal cancels a keepalive-style dripping SSE body. The drip resets per-chunk idle, so only the outer abort can terminate the stream within budget. Removes the previously proposed streamDeadlineMs opt-in: no production caller needed it and the outer signal already owns total stream lifetime. Co-Authored-By: nebulacoder-v8.0 <[email protected]> * test(agents): make proxy abort regression deterministic --------- Co-authored-by: nebulacoder-v8.0 <[email protected]> Co-authored-by: Peter Steinberger <[email protected]>
What Problem This Solves
Adds native loopback regression coverage proving that the existing outer
AbortSignalcancels a keepalive-style dripping proxy SSE body instreamProxy(/api/stream). Without this coverage, a future change to the abort handler or reader cleanup path could silently break total-stream-lifetime ownership without any test catching it.Why This Change Was Made
streamProxybounds pre-header waits and per-chunk SSE idle, but the total stream lifetime after headers is owned by the caller'ssignal/ outer agent-provider abort budget. A dripping keepalive SSE body (chunks every 20ms) resets per-chunk idle forever, so only the outer abort can terminate it. This PR adds a native loopback regression proving that path works end-to-end with real Nodehttp+fetch+ReadableStream.An earlier revision proposed an opt-in
streamDeadlineMsproxy-local wall-clock. ClawSweeper review (P1) identified that no production caller needed it and the outersignalalready owns total stream lifetime, so a second deadline source would create a competing timeout contract. This revision removesstreamDeadlineMsentirely and narrows to the regression proof only (Maintainer option 1, recommended).Non-goals: adding a proxy-local total-stream deadline; changing the existing outer-abort contract; live proxy provider auth.
Collision check: searched open PRs for
proxy SSE abort,streamDeadlineMs,proxy stream lifetime; no same-file or same-problem open PR was found.User Impact
No user-visible behavior change. This is a test-only PR that protects the existing outer-abort SSE cancellation contract against regressions.
Verification
ece303619a791e886a15d94b9723c5a206f5624boxfmt --check src/agents/runtime/proxy.test.ts- passed; exit 0.oxlint src/agents/runtime/proxy.test.ts- passed; exit 0.git diff --check- passed; exit 0.Focused tests:
Mutation check: temporarily commented out
reader.cancel()in theabortHandler(src/agents/runtime/proxy.ts:287) -> loopback test fails (1 failed | 13 passed) -> restored -> 14 passed. Proves the regression test catches abort-handler breakage.Real behavior proof
Behavior addressed: a dripping keepalive SSE body (20ms cadence) that resets per-chunk idle is canceled by the outer
AbortSignalwithin 1.5s, not by per-chunk idle (which never fires because drip resets it).Real environment tested: Linux, Node 22, real
http.createServerloopback on127.0.0.1, realfetch/ReadableStream(no mocked reader or fetch).Exact commands run:
Observed output:
Evidence:
stopReason: "aborted",errorMessage: "Request aborted by user"reader.cancel()from abort handler -> test fails -> restored -> passesWhat was not tested: live remote proxy provider outage with provider credentials; non-HTTP/1.1 transports; proxy auth flows.
Risk / Compatibility
Low. Test-only change; no production code modified. No new API surface, config, or behavior contract. The regression test uses native Node
http+fetchon loopback, matching the productionstreamProxycode path.