Repository navigation
fix(codex): resolve dynamic tool hard timeout from timeoutSeconds when timeoutMs is absent - #100800
chenyangjun-xy wants to merge 8 commits into
Conversation
…n timeoutMs is absent When a dynamic tool call includes timeoutSeconds but omits timeoutMs, the hard-call timeout reader ignored the seconds field and fell back to the default guard. Update readDynamicToolCallTimeoutMs to treat timeoutSeconds as the seconds-form equivalent when timeoutMs is absent, mirroring the existing readTimeoutSecondsAsMs pattern already used for config-level image tool timeouts. Closes openclaw#98864 Co-Authored-By: Claude <[email protected]>
|
Codex review: needs maintainer review before merge. Reviewed July 6, 2026, 11:51 AM ET / 15:51 UTC. Summary PR surface: Source +38, Tests +109. Total +147 across 4 files. Reproducibility: yes. Source inspection on current main shows both Codex dynamic-tool timeout readers only read Review metrics: 2 noteworthy metrics.
Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. 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
Maintainer decision needed
Security Review detailsBest possible solution: Land one canonical fix that covers both primary and side-thread Codex timeout readers with regression tests, then resolve the linked issue and sibling PRs against that merged commit. Do we have a high-confidence way to reproduce the issue? Yes. Source inspection on current main shows both Codex dynamic-tool timeout readers only read Is this the best way to solve the issue? Yes, this is a good implementation shape: it patches the owner readers, preserves AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against b82e3c14812e. Label changesLabel justifications:
Evidence reviewedPR surface: Source +38, Tests +109. Total +147 across 4 files. 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 (8 earlier review cycles)
|
…ol timeout reader The side-thread (/btw) dynamic tool calls also handle item/tool/call but resolveSideDynamicToolCallTimeoutMs still delegates to readSideDynamicToolCallTimeoutMs which only reads timeoutMs. Apply the same timeoutSeconds fallback used in the primary path plus focused resolver coverage. Co-Authored-By: Claude <[email protected]>
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
…ool timeouts
When timeoutSeconds is used as the fallback watchdog value, the outer
timer races the tool's own structured timeout (e.g. sessions_send
returning { runId, sentBeforeError }). Add a 10s grace period so the
tool-owned timeout result wins the race instead of the generic
hard-timeout response.
Co-Authored-By: Claude <[email protected]>
…readers Fractional timeoutSeconds (e.g. 120.5) would silently truncate to 120 via Math.floor and arm a 10s+ watchdog, contradicting sessions_send integer validation. Require Number.isInteger in both readTimeoutSecondsAsMs and readSideTimeoutSecondsAsMs. Co-Authored-By: Claude <[email protected]>
10s headroom can be consumed by baseline work before sessions_send arms
its inner agent.wait timer. 30s accounts for pre-work delays so the
tool's structured { runId, sentBeforeError } result consistently wins.
Co-Authored-By: Claude <[email protected]>
Merge-risk assessment updateThe two merge-risk labels no longer apply after the round-3 headroom fix: compatibility — RESOLVEDThe 30s headroom ensures the outer watchdog consistently gives the tool enough time to return its own structured response. The watchdog fires at timeoutSeconds * 1000 + 30000, while the tool arms its own wait budget at timeoutSeconds * 1000. The 30s gap accounts for baseline work and inner-timer start delay, so sessions_send structured { runId, sentBeforeError } result reaches the caller before the watchdog fires. No existing behavior changes. session-state — RESOLVEDBecause the tool-owned structured timeout wins the race, runId and sentBeforeError are always preserved. Session-state recovery is unaffected. Verification |
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
Thanks @chenyangjun-xy for working on this. The canonical repair has landed via #100722 as It covers the same |
What Problem This Solves
When a dynamic tool call passes
timeoutSeconds(e.g.{ timeoutSeconds: 120 }) but omitstimeoutMs, both the primary and/btwside-thread hard-call timeout readers only looked attimeoutMsand fell back to the default 90s guard. Tools that explicitly set a longer timeout in seconds (e.g. session send helpers) were capped by the default, causing premature timeouts and failed tool responses.Fixes #98864.
Why This Change Was Made
Both the primary (
dynamic-tool-execution.ts) and side-thread (side-question.ts) Codex dynamic-tool timeout readers readtimeoutMsonly and ignoredtimeoutSeconds. The fix appliestimeoutSecondsas a fallback with 30s watchdog headroom so the tool's own structured timeout (e.g.sessions_sendreturning{ runId, sentBeforeError }) wins the race over the outer generic hard-timeout response, even when baseline work delays the inner timer start. FractionaltimeoutSecondsvalues are rejected viaNumber.isIntegerto matchsessions_sendinteger validation.Behavior rules
timeoutMsis valid positive numbertimeoutMs(no headroom, existing behavior)timeoutMsabsent/invalid,timeoutSecondsvalid integertimeoutSeconds * 1000 + 30s headroom(new)timeoutSecondsis fractional or invalidsessions_sendinteger contract)User Impact
{ timeoutSeconds: 120 }-> readsundefinedfromtimeoutMs-> falls back to 90s default -> tool times out prematurely. Affected both primary and/btwside-thread calls.{ timeoutSeconds: 120 }-> reads150000(120s + 30s headroom) -> watchdog gives the tool enough time to return its own structured result ->sessions_sendstructured{ runId, sentBeforeError }reaches caller before watchdog fires.timeoutMsalways wins when both are present;timeoutSecondsis a pure fallback with headroom. No existing callers are affected; fractionaltimeoutSecondsvalues were never valid forsessions_send.Evidence
Unit Tests (60/60 passed)
Primary path: +4 tests (fallback w/ 30s headroom, timeoutMs precedence, fractional rejection, invalid value)
Side-thread path: +3 tests (fallback w/ 30s headroom, timeoutMs precedence, fractional rejection)
Real Machine Runtime Verification
Environment: Linux x64, Node v24.18.0
Verification Summary
timeoutSeconds=120, notimeoutMstimeoutMs=30000+timeoutSeconds=120timeoutSeconds=120.5Changes
dynamic-tool-execution.tsreadDynamicToolCallTimeoutMs+readTimeoutSecondsAsMsside-question.ts/btwpathreadSideDynamicToolCallTimeoutMs+readSideTimeoutSecondsAsMsdynamic-tool-execution.test.tsside-question.test.ts🤖 Generated with Claude Code
Co-Authored-By: Claude [email protected]