Repository navigation
fix(agents): stop sessions_send from blocking turns past its timeout - #201373
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 Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8588ea8684
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| // A deadline can win during reply materialization; the accepted result still needs a consumer. | ||
| if (params.signal?.aborted && delayedDelivery.status === "pending" && !registryCompletion) { | ||
| await startReplyFlow(true, reply); | ||
| } else { | ||
| completion?.close(); |
There was a problem hiding this comment.
Preserve registry-owned replies when the outer deadline wins
For a registry-owned child followup, a terminal result can arrive just before the send deadline and then spend the remaining budget in acknowledgment or reply materialization (for example, the history lookup for a reply ending in …). The new outer race returns a timeout, but acknowledgeSubagentResultForRequesterTurn() has already marked the registry obligation delivered and disabled its completion message. This branch explicitly excludes registryCompletion, so the eventual inline result is discarded without restoring or transferring delivery: the requester receives neither the answer nor a late completion. Preserve the registry obligation until inline delivery is assured, or reconcile it when the deadline wins.
AGENTS.md reference: src/agents/AGENTS.md:L37-L38
Useful? React with 👍 / 👎.
|
Codex review: needs changes before merge. What this changesBounds sessions_send with one overall deadline while preserving receiver-owned work after the sender times out. Example: A parent sends guidance to its busy child with the default 30-second timeout.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Needs changes before merge - 1 item remains This PR addresses a current timeout defect, but the new deadline can discard a registry-owned child reply after its delivery obligation has already been acknowledged. Priority: P1 Before merge
Findings
Tests
Agent review detailsHow this fits togetherThe sessions_send tool resolves and authorizes a destination, admits guidance or a follow-up turn, and returns its result inline or transfers completion to an existing delivery owner. flowchart TD
A[Calling agent] --> B[Send deadline]
B --> C[Target and communication admission]
C --> D[Receiver steering or followup]
D --> E[Reply observation]
E --> F[Inline tool result]
E --> G[Existing completion owner]
B --> H[Visible timeout]
Technical reviewBest possible solution: Keep the shared sender deadline and preserve the existing registry completion obligation whenever the timeout prevents inline delivery. Do we have a high-confidence way to reproduce the issue? Current-main source shows an unbounded steering acknowledgment before the bounded reply wait; the PR reports red/green regressions, but the exact production incident await remains unknown and no code was executed during this review. Is this the best way to solve the issue? A single deadline around the existing send owner is appropriate, but completion acknowledgment must remain consistent with whether the outer race actually returns the child result. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 3da0bc802e10. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceAcceptance criteria:
What I checked:
Likely related people:
PR surfaceSource +99, Tests 0, Docs +3. Total +102 across 9 files. Added test files: 0. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed November 18, 2026, 1:43 PM ET / 18:43 UTC. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e3f0bf2a7a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| SESSIONS_SEND_ADMISSION_TIMEOUT_MS, | ||
| () => true, | ||
| { signal: opts?.signal }, | ||
| ); | ||
| return admissionExpired ? timeout() : await execution; |
There was a problem hiding this comment.
Exclude pending human approval from the admission ceiling
When either session's communication preference is Ask, preparation awaits requestSessionCommunicationApproval(), whose question owner explicitly allows 15 minutes and registers a human-input wait. This unconditional 30-second admission timer instead aborts the signal and cancels that question after at most 30 seconds, so an operator responding later can no longer authorize the message. Increasing timeoutSeconds cannot help because this ceiling is fixed; if both endpoints require approval, they also share that short window. Suspend the admission budget during the registered human-input wait, or otherwise preserve the question owner's approval timeout.
Useful? React with 👍 / 👎.
…penclaw#201373) * fix(agents): bound sessions_send waits and declare deadlines * fix(agents): retain replies when send deadlines expire * fix(agents): separate sessions_send admission and reply timeouts
…201373) * fix(agents): bound sessions_send waits and declare deadlines * fix(agents): retain replies when send deadlines expire * fix(agents): separate sessions_send admission and reply timeouts (cherry picked from commit da8fd16) Co-authored-by: RomneyDa <[email protected]>
…penclaw#201373) * fix(agents): bound sessions_send waits and declare deadlines * fix(agents): retain replies when send deadlines expire * fix(agents): separate sessions_send admission and reply timeouts Release adaptation: Source fixed admission deadline and separate reply wait propagated through baseline callers. (cherry picked from commit da8fd16) Co-authored-by: RomneyDa <[email protected]>
…201373) Baseline adaptation: Bound admission and inline reply observation in the shipped sessions_send owner without importing the upstream executor split, self-held replay, or steering changes. Handoff retains accepted replies with the existing continuation or registry owner. Preserve receipts on caller revocation and use the existing error schema for uncertain admission timeout, matching the targeted fixes in #203901 and #202139. (cherry picked from commit da8fd16) Co-authored-by: RomneyDa <[email protected]> (cherry picked from commit c6c889760104d608842b9e97e308aad201f1ca30)
What Problem This Solves
A
sessions_sendto a busy child can remain blocked before its reply wait. Without a declared host deadline, a Code Mode call can hold the turn until the 15-minute watchdog aborts it, delaying queued user messages; the next turn can repeat the same hang.The reproducible unbounded await is active-child steering in
src/agents/tools/sessions-send-tool.delivery.ts:275:deliveryTimeoutMs: undefinedleaves transcript acknowledgment unbounded at lines 324–334. The original tool entry point supplied no admission ceiling or execution deadline. The incident arguments are unavailable, so the exact production await and proposed announcement cycle remain unproven.Fix
A fixed, named 30-second admission ceiling covers requester-source acquisition, target lookup, preparation, admission, and transcript acknowledgment, including zero-wait sends. After acceptance,
timeoutSecondsretains its existing reply-only contract (default 30 seconds; zero skips waiting). Direct calls and retained replay share this owner. The declared watchdog deadline is tool start plus the admission ceiling plus the reply wait.Admission expiry returns a visible timeout advising inspection before retry, fences new sender effects, and releases communication subscriptions without cancelling receiver-owned input. Late materialized results still transfer to the existing reply-delivery owner. No watchdog window, retry policy, or configuration changes.
The follow-up fixes a regression in
8588ea86849b: the initial combined budget could return false ambiguous timeouts when admission exceeded a short reply timeout. Documentation now states the two independent budgets.The
github_publishsibling already has bounded response waits on this base via #200927; its previously verified Node and QuickJS Code Mode regressions pass. Its separate deferred workspace handoff was not reproduced as hanging or changed here.Evidence
8588ea86849band passes with this fix. It is folded into the existing fake-timer child-result case.04cb8179ccd66.--maxWorkers=8passes 83/83: admission 18, sessions 57, agent-step 8; 178.81 seconds locally. These real owner compositions exercise SQLite-backed admission, caller authority, and completion custody.node scripts/run-vitest.mjs run --maxWorkers=8 src/agents/tools/sessions-send-followup.test.ts) supplies the required flags and passes all five tests in that file. No production changes or test bypass were needed.Whole-PR test lines: +164 / -164, net 0. Production: +118 net; documentation: +5 net. Duplicate notification assertions and redundant test state were removed while preserving the admission, receiver-custody, inline-reply, and late-result contracts.
Auto-merge remains disabled. This follow-up is pushed for coordinator verification; it does not authorize or perform landing.