Repository navigation
fix(queue): queued operations inherit the previous request context - #164105
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review in progressClawSweeper is reviewing this revision. This supersedes any previous blocked status. |
|
Codex review: needs maintainer review before merge. Reviewed October 3, 2026, 4:24 AM ET / 08:24 UTC (Revision 2). ClawSweeper reviewWhat this changesThe shared serial queue preserves each submitting request’s async context in Node, retains browser operation, and adds regression coverage. Merge readiness✅ Ready for maintainer review The fix remains necessary and has no actionable review findings. The updated evidence resolves the previous timing request and supports the browser-compatible revision. Priority: P2 Review scores
Verification
How this fits togetherThe shared queue serializes voice transcript operations, Talk controls, and terminal uploads. It accepts callbacks, enforces waiting limits, and executes accepted work in order. flowchart TD
A[Voice operations and uploads] --> B[Queue admission]
B --> C{Within waiting limits}
C -->|No| D[Reject submission]
C -->|Yes| E[Capture Node request context]
E --> F[Execute callbacks in order]
F --> G[Completion and flush barriers]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +8, Tests +40. Total +48 across 2 files. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Technical reviewBest possible solution: Keep caller-context capture at the shared queue’s admission boundary while preserving browser execution and existing queue semantics. Do we have a high-confidence way to reproduce the issue? Yes: hold the first operation, submit a differently scoped operation and an untraced operation, then release the first. Current-main source establishes the faulty inheritance; supplied runtime proof demonstrates it without reviewer execution. Is this the best way to solve the issue? Yes: binding accepted callbacks at admission repairs the shared owner and follows the sibling writer queue’s context-preservation pattern. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 01f838a2b421. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
@clawsweeper re-review Please review b59faa7. The body now includes current-main failing and candidate passing built voice-registry proof, measured single-worker test cost, and production UI build plus isolated Chromium proof for the shared browser consumer. The contributor commit is retained; the additional commit only makes Node context capture browser-compatible. |
|
🦞👀 Re-review progress:
|
|
Landed as 5df82fa, with a small follow-up commit that keeps the queue loadable in the browser. Thanks @harshitgupta31415! |
…penclaw#164105) Fixes openclaw#164091. Tasks waiting in a `BoundedSerialQueue` ran in the async context of the task that ran before them instead of the context that submitted them, so diagnostic trace context leaked between queued requests, and a task submitted without one inherited the earlier trace. Each queued task now runs in its submitter's async context. The queue also runs in the browser (voice transcripts), which has no Node async context, so `node:async_hooks` is loaded only when `process` exists. FIFO order, bounds and backpressure are unchanged. Proof: in the built voice-transcript registry, base ran all queued work under the first request's trace, and this change keeps each submitter's trace and leaves untraced work unscoped. The production UI build and an isolated Chromium import of the queue pass. The regression test fails on base and passes here. A live gpt-5-mini smoke call passed. Co-authored-by: Ayaan Zaidi <[email protected]>
What Problem This Solves
Fixes #164091. Waiting serial tasks inherit the previous request's async context, so a voice transcript operation can carry another request's diagnostic trace. Reported and initially fixed by @harshitgupta31415; their commit is retained.
User Impact
Queued operations retain the submitting request's diagnostic context; untraced submissions stay untraced. FIFO order, capacity limits, backpressure, failure recovery, and flush barriers are unchanged.
Implementation
Capture each accepted operation with Node's supported
AsyncLocalStorage.bind. Load the builtin only in Node throughprocess.getBuiltinModule, because the same voice transcript policy is used in the Control UI browser. Browsers retain the existing queue behavior without a Node module dependency. No configuration, schema, dependency, or public API changes.No overlap with Pash/Sarah changes.
Evidence
Linux ARM64 / Node 24.16.0, isolated Docker:
Candidate head:
b59faa74e3ad049f9e85b5da1cff2e13dfb91a08.46fc2e34f2f2f980f1b496f959df28d1925b7ddb: a built productioncreateVoiceTranscriptOperationRegistry().run()flow using production diagnostic trace contexts observed[first, first, first, first, first, first]across the three operations, before/after awaits. Expected[first, first, second, second, null, null].[first, second, untraced]on both versions.[first, second], idle after settlement, and no Nodeprocessglobal. This protects the browser consumer while restoring server-side context propagation.pnpm test src/shared/bounded-serial-queue.test.ts --maxWorkers=1: 9 passed, 1.631 s wall, 470 ms Vitest duration, 1.17 s runner duration. Exact-head CI also passed all 9 queue cases: 2.19 s runner duration, 863 ms Vitest duration; the containing multi-file job took 151 s.node:async_hooks. The built Node CLI resolves its isolated config path correctly.The exact-head live Gateway smoke passed: one real
gpt-5-miniResponses API request through a passive proxy, reasoninglow,max_output_tokens: 4096, HTTP 200, andLIVE_GATE_OK_164091returned in Gateway chat history. Credentials were file-mounted read-only for that run and removed afterward.The queue-specific production-consumer proof is not a live microphone/provider voice session. Exact-head CI is green, including
openclaw/ci-gate, with no failed or cancelled jobs. Exact-head ClawSweeper review is tracked on this PR.