Repository navigation
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 27, 2026, 1:58 AM ET / 05:58 UTC. ClawSweeper reviewWhat this changesMoves provider-request fingerprinting for context-overflow retries to a worker for ordinary payloads, while retaining local hashing for custom values and worker failures. Merge readiness✅ Ready for maintainer review Current main still hashes provider requests on the Gateway thread. The PR addresses that active path, and this source review found no blocking defect in the introduced change. Priority: P2 Review scores
Verification
How this fits togetherThe embedded agent runner intercepts a provider request before model transport sends it. It fingerprints the request so context-overflow recovery can reject an exact replay of a payload the provider already rejected. flowchart LR
A[Agent turn] --> B[Provider request]
B --> C[Payload hook]
C --> D{Ordinary payload?}
D -->|Yes| E[Worker fingerprint]
D -->|No or worker failure| F[Local fingerprint]
E --> G[Replay guard]
F --> G
G --> H[Model transport]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +84, Tests +47. Total +131 across 4 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep request fingerprinting in the embedded runner’s existing retry guard, with identical hashes across worker and local paths and bounded worker resources. Do we have a high-confidence way to reproduce the issue? Yes. Current-main source shows synchronous hashing in the provider payload callback, and the PR describes a repeatable large-request benchmark; I did not independently run that benchmark. Is this the best way to solve the issue? Yes. The branch uses the existing worker pool and retains local canonical hashing where cloning could change payload identity. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against c2c6852e80bd. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
What Problem This Solves
Large provider requests block the Gateway thread while the context-overflow retry guard stably serializes and hashes the complete payload on every model call.
User Impact
Moves ordinary request hashing off the Gateway thread while preserving exact rejected-request replay detection. There are no configuration, audit, receipt, storage, or durable payload-retention changes.
Why This Change Was Made
The snapshot is used by
assertProviderPromptRetryProgressto reject only an exact replay in the same provider/model/context-budget scope. Message count or last-message identity cannot replace it: hooks can replace the body or edit an earlier message without changing those values.One process-owned worker uses the existing
WorkerTaskPool, shared compute admission, byte accounting, and idle retirement. The main thread checks the object shape and estimates retained bytes without traversing string contents. Unsupported custom hook values keep the existing local canonicalization; worker failure also falls back locally so bookkeeping availability does not break model calls. There is no content cache or invalidation policy to maintain. Net production growth: 84 lines.Evidence
Synthetic fixture on provider blacksmith-testbox, profile openclaw-check, lease tbx_01m3ghjkyn5bs46yv4tqwjtqmt: 200 KiB initial prompt, 50 calls with appended 30 KiB tool results; five sequential 50-operation trials. Main-thread time uses
performance.eventLoopUtilization().activearound the real wrapped transport callback. Baseline and final candidate ran in the same process with identical fixture objects.That is 12.1× less main-thread time, at approximately 0.19 ms additional steady-state request latency. Source-mode cold worker startup was 361 ms. Fixture RSS rose from 224.8 MiB to 309.2 MiB after loading and exercising the TypeScript worker; these source-loader measurements are not a production memory or startup prediction. A separate packaged-worker smoke measured 100 ms cold startup and 45.0 MiB additional process RSS, and returned the identical digest for a Unicode fixture.
The initial four-owner fixture measured trajectory recording at 1.38 ms/tool result, request byte accounting at 0.55 ms/payload, and a 50-tool/200-KiB catalog registration at 0.36 ms. Those owners remain unchanged in this bounded fix. Trajectory capture already bounds and sanitizes data, and
captureModelEventretains final-answer isolation. Request byte accounting has no already-serialized transport body available at its current callback boundary. This change moves full hashing off the thread; it does not make the entire bookkeeping pipeline O(delta).Validation on the same lease:
pnpm install --frozen-lockfile: passed after the initial fixture found missing lease dependencies.node scripts/run-vitest.mjs src/agents/embedded-agent-runner/provider-prompt-state.test.ts src/trajectory/runtime.test.ts src/agents/embedded-agent-subscribe.tool-result-ordering.test.ts: all three suites passed.pnpm test src/agents/embedded-agent-runner/provider-prompt-state.test.ts --maxWorkers=1: 12 passed, 19.14 s runner wall; 17.40 s Vitest duration, dominated by the source-worker compiler cache rebuild. The new cases protect exact canonical identity for ordinary nested payloads, callback-bearing hooks, custom Error names, and non-enumerable array elements. The callback and Error regressions failed against naive worker cloning before the compatibility fix.node scripts/check-changed.mjs: passed (21m59s command time). Final review-fix recheck with-- src/agents/embedded-agent-runner/provider-prompt-state.ts src/agents/embedded-agent-runner/provider-prompt-state.test.ts: passed all 25 consuming test type graphs and closing guards (22m04s).pnpm build: passed, including worker packaging and public SDK declaration checks (7m29s command time).dist/agents/embedded-agent-runner/provider-prompt-state.worker.jsthroughWorkerTaskPool: digest parity and owned shutdown passed (2.50s command time).No production Gateway was modified or restarted. Live production impact remains unmeasured. Crabbox did not return a run URL because its external portal synchronization timed out; execution results came directly from the lease CLI.
Final GitHub proof: CI run 36298496783 passed on
a6bf66842a38e864b413fe5f4c87a38a7b1bffe8in 879 seconds elapsed, with no reruns. Final PR rollup: 170 passed, 47 skipped/neutral, zero pending or failed. The campaign watcher automatically merged the PR after CI passed. CI per-file timing was not extracted; the focused file cost measured on Testbox is recorded above.