Repository navigation
fix(proxy-capture): preserve partial responses and shutdown diagnostics - #143107
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed September 9, 2026, 12:09 PM ET / 16:09 UTC (Revision 7). ClawSweeper reviewWhat this changesPreserves partial debug-capture responses, records transport failures, and settles pending captures before their owning store closes. Merge readiness✅ Ready for maintainer review This repair remains useful: current main still loses partial capture bodies. No actionable introduced defect was found, and the capture files match the previous reviewed head. The related prompt-cache work does not supersede this PR. Priority: P2 Review scores
Verification
How this fits togetherDebug proxy capture observes outbound HTTP traffic and stores diagnostic events and response bodies for operators. Its readers must preserve useful evidence without changing the caller’s response or writing into a retired capture session. flowchart TD
A[Outbound HTTP request] --> B[Capture session admission]
B --> C[Guarded or global fetch]
C --> D[Caller response or error]
C --> E[Bounded diagnostic reader]
E --> F[Capture events and blobs]
G[Store shutdown] --> E
G --> F
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +336, Tests +1283, Other 0. Total +1619 across 11 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep capture reads and shutdown settlement under one store owner while preserving caller outcomes, existing size limits, redaction, and both storage formats. Do we have a high-confidence way to reproduce the issue? Yes, from source: current main drops buffered response bytes when the capture reader stalls or rejects, and pending reads can outlive finalization. Focused regression scenarios are supplied; no runtime reproduction was executed during this review. Is this the best way to solve the issue? Yes. Repairing the existing capture reader and exact-store lifecycle addresses the failure at its owner without changing provider parsing, configuration, schema, or public SDK entrypoints. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 9c0ae15a4649. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (6 earlier review cycles)
|
|
@clawsweeper re-review Please review exact head The same fixture logic passed native Windows proof in https://github.com/openclaw/openclaw/actions/runs/34365049555/job/102511497307 at diagnostic commit The PR body distinguishes that diagnostic proof and prior capture tests from new-head CI, now pending at https://github.com/openclaw/openclaw/actions/runs/34366131803. No aggregate pass or original prompt-cache reproduction is claimed; no merge is requested. |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
c626dcc to
f24c277
Compare
|
@clawsweeper re-review Please review exact head Previous capture code findings remain resolved; capture production changes are patch-identical through the rebase. Fresh combined Telegram autoreview is scoped-clean at P0-P2, and the same focused Node 26 test failed before and passed after (1 executed, 1 passed, 0 skipped). The local idle-expiry witness had a globally incomplete trace, so historical CI causality is not claimed. Typed lint was blocked before analysis by shared-install admission; new exact-head hosted CI is pending. The separate persisted-selection versus confirmation-delivery reporting issue remains a named follow-up. No temporary observer/workflow, runtime prompt-cache repair, new provider inference, or merge-ready claim is included. |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
f24c277 to
f240de2
Compare
|
@clawsweeper re-review Please review exact capture-only head All Windows/Telegram fixture amendments were dropped after the independent main fixes in #143213 and #143197. Both fixture files now match base exactly. The three remaining capture commits are patch-identical; all capture production/test blobs are unchanged from the prior head. Main's complete assertion baseline is preserved except the reviewed runtime allowance reduction from 10 to 5. Fresh exact-candidate autoreview is scoped-clean at P0-P2, and independent reconciliation review approved the 11-file scope and identities. Previous capture findings remain resolved. Prior 87/133 focused passes and Testbox types remain explicitly prior-head evidence; new exact-head hosted CI is pending. No retained fixture/workflow delta, new provider inference, original prompt-cache repair, or merge-ready claim. |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Merged via squash.
|
…cs (openclaw#143107) * fix(proxy-capture): preserve partial responses and shutdown diagnostics * refactor(proxy-capture): isolate capture session ownership * fix(proxy-capture): type fetch patch metadata without assertions
Related: #143010
Related: #143012
Related: #140621
What Problem This Solves
Resolves a problem where operators inspecting debug proxy captures could lose response bytes already received when a stream failed or capture shutdown interrupted the read. Pending readers could also write after their store closed, persistence failures could disappear during process exit, and a guarded request could be recorded in the wrong capture session after the state root changed.
This is a capture prerequisite discovered while validating the runtime prompt-cache test stack. It does not fix the prompt-cache behavior discussed in the related PR, and the completed live runs have not reproduced that original defect. The secretless stream tests do not establish the cause of a particular live transport failure.
Why This Change Was Made
Capture now owns one bounded response read and one terminal record, preserving observed bytes and explicit incomplete/error outcomes while settling pending reads before the exact owning store closes. Admission remains tied to its original store generation; guarded and globally patched fetch paths share error recording without duplicate or replacement-session writes.
Retired owners release their heavy state, state-root/session identity stays isolated, and persistence failures emit synchronous redacted diagnostics. Caller streams, error identity, cancellation, existing byte/idle limits, and the
capture: falseglobal-delegation contract remain intact. No schema, configuration, dependency, provider parser, cache accounting, or cache-threshold changes.The final scope is capture-only: five production files, five capture test files, and one shrink-only assertion-baseline change. Earlier Windows and Telegram fixture amendments were dropped entirely after main independently landed the fixes by @steipete in #143213 and #143197. Both fixture files match the frozen main base exactly. No retained fixture, temporary observer, or workflow delta.
User Impact
Debug captures retain the response prefix actually observed, distinguish stream/read failures from storage failures, and close without late writes or silently moving requests into another capture session. A transport rejection remains visible as one error event, not a fabricated HTTP response.
Release-note context: preserve partial debug capture responses and finalize capture sessions safely without losing failure diagnostics.
Evidence
f240de23583a42902c13298881276baa5652ba28; tree12247570b625e5be1cb7e4e8838a454c625efacf; frozen source base895bdee99ed94c0f4d1014faecc2c0bf79b0db1f. All three capture commits are signed and patch-identical to the previous reviewed series. All ten capture implementation/test blobs match prior headf24c277659b495309300a06bd1d40921031a75c2; both superseded fixtures match frozen main.1b27dc36dba7e327f0f008e7e29589bbb9720e9c, combining this head with main73b4086ff658973fb9ae07fa208c49ca8de82a67. Both Windows jobs passed; the media file-URL case executed in 800 ms. Core/test types and artifact runtime SDK entry declarations, exports, and UI checks passed. This is not a full release-DTS or release-package qualification claim.cc3ed5b3e48420a847020833814a0bb1417e15a3on Node 26.7 in 35.59 seconds, covering runtime/injected-store behavior, lifecycle, nine real-loopback ownership/rejection cases, and 22 existing OpenAI TTS cases. The broader 133 tests passed, zero skipped, at59d4f3fc28b3f7d7b8e9f917d279299af9ef35d1in 162.37 seconds, additionally covering store, managed-fetch, pooled-release, and guarded-body tests. These counts are not described as new runs on the final head.capture: falseglobal delegation remains exact-once; an initial zero-record test expectation was rejected rather than counted as a product defect.fead06567d0697765c90eea0466ca5859baaa56e. Core production types and all 17 core test-type graphs passed, then four lint findings stopped that payload before build. Its lease was stopped and its Actions result was not an aggregate pass. Later reviewed corrections addressed those findings; the final exact-head hosted CI above is the current qualification.Named separate follow-up: Telegram model-selection reporting can say selection failed after persistence succeeded if confirmation delivery fails. That production reporting issue is outside this capture repair.