Skip to content

fix(codex): honor dynamic tool timeoutSeconds - #99003

Closed
qingminglong wants to merge 2 commits into
openclaw:mainfrom
qingminglong:codex/98864-dynamic-tool-timeout-seconds
Closed

qingminglong wants to merge 2 commits into
openclaw:mainfrom
qingminglong:codex/98864-dynamic-tool-timeout-seconds

Conversation

@qingminglong

@qingminglong qingminglong commented Jul 2, 2026 •

Copy link
Copy Markdown
Contributor

Closes #98864

What Problem This Solves

Fixes an issue where Codex dynamic tool calls that provided only timeoutSeconds could miss the intended seconds-form hard-call bound and fall back to the default dynamic tool watchdog.

Why This Change Was Made

The Codex app-server dynamic tool timeout resolvers now preserve timeoutMs precedence and treat numeric timeoutSeconds as the seconds-form fallback when timeoutMs is absent. The fallback adds a small wrapper grace window so tools that already own timeoutSeconds, such as sessions_send, can return their structured timeout result before the outer app-server watchdog aborts the bridge.

User Impact

Long-running or bounded Codex dynamic tools can use seconds-form timeout values without silently falling back to the default watchdog, including both the primary Codex dynamic-tool path and the side-question dynamic-tool path.

Evidence

  • Claim proved: timeoutMs still wins; timeoutSeconds-only calls now set a seconds-derived app-server watchdog; invalid timeoutSeconds values are ignored; the existing failed response shape is used when the wrapper watchdog expires; a tool-owned timeoutSeconds result can return before the wrapper grace expires; the side-question sibling dynamic-tool timeout reader now honors timeoutSeconds with the same precedence and grace behavior.
  • Current head checked: 8d94a49.
  • Commands / artifacts:
    • node scripts/run-vitest.mjs extensions/codex/src/app-server/dynamic-tool-execution.test.ts -- --reporter=verbose -t "timeoutSeconds"
    • node scripts/run-vitest.mjs extensions/codex/src/app-server/side-question.test.ts -- --reporter=verbose -t "uses per-call timeoutSeconds for generic side-thread dynamic tool calls"
    • git diff --check
    • python .agents\skills\autoreview\scripts\autoreview --mode local
    • GitHub Real behavior proof check on current head: https://github.com/openclaw/openclaw/actions/runs/28581246921/job/84741801796
    • Dependency/source contract check: ../codex/codex-rs/app-server-protocol/src/protocol/v2/item.rs defines DynamicToolCallParams.arguments as JsonValue, so OpenClaw owns interpreting timeoutSeconds in the forwarded dynamic tool arguments.
  • Observed result:
    • Primary dynamic-tool focused Vitest passed on current head: 1 file, 4 tests passed, 13 skipped. The passing tests covered timeoutSeconds fallback, invalid timeoutSeconds rejection, the 11000ms wrapper timeout response shape, and a sessions_send-style tool-owned timeoutSeconds result returning before wrapper grace.
    • Side-question focused Vitest passed on current head: 1 file, 1 test passed, 40 skipped. The test covered timeoutSeconds fallback and timeoutMs precedence in the side-thread dynamic-tool timeout reader.
    • git diff --check passed on current head.
    • GitHub Real behavior proof check passed on current head.
    • Autoreview clean: no accepted/actionable findings reported in the prior local review for this head.
  • Proof boundary:
    • No credentialed live model turn was needed for this parser/wrapper fix. The current-head proof exercises the Codex app-server dynamic-tool timeout resolver/wrapper behavior and the side-question sibling resolver directly, and checks the upstream Codex protocol source that forwards dynamic-tool arguments as raw JSON.

@clawsweeper

clawsweeper Bot commented Jul 2, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed July 4, 2026, 11:18 AM ET / 15:18 UTC.

Summary
The PR changes Codex app-server dynamic-tool timeout resolution so timeoutSeconds is used when timeoutMs is absent, with matching side-question resolver tests.

PR surface: Source +19, Tests +143. Total +162 across 4 files.

Reproducibility: yes. at source level: current main reads only timeoutMs in both Codex dynamic-tool timeout readers, while sessions_send exposes timeoutSeconds and upstream Codex forwards raw dynamic-tool arguments. I did not run a live current-main Codex timeout turn in this read-only review.

Review metrics: 1 noteworthy metric.

  • Open sibling fixes: 2 open, 1 closed unmerged. Multiple branches target the same canonical timeoutSeconds bug, so maintainers need one landing path before overlapping fixes merge.

Merge readiness
Overall: 🦪 silver shellfish
Proof: 🦪 silver shellfish
Patch quality: 🦐 gold shrimp
Result: blocked until real behavior proof from a real setup is added.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • Use shared integer-safe seconds parsing for timeoutSeconds in both readers and cover fractional values.
  • [P1] Add redacted runtime proof or logs from a real Codex dynamic-tool call with timeoutSeconds only.

Proof guidance:

  • [P1] Needs real behavior proof before merge: The PR body provides focused Vitest output, source-contract notes, and a proof-gate check, but no real Codex dynamic-tool call, runtime log, terminal transcript, or linked artifact showing timeoutSeconds behavior after the fix. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Risk before merge

  • [P1] Merging this PR as-is can make raw fractional timeoutSeconds values arm a shortened Codex watchdog before the owning tool can reject or ignore the invalid integer field.
  • [P1] Contributor-supplied proof is still focused Vitests, source notes, and a proof-gate check rather than a real Codex dynamic-tool call or runtime log showing timeoutSeconds behavior after the fix.
  • [P1] Multiple open sibling PRs target the same canonical timeoutSeconds issue, so maintainers still need one landing path before overlapping fixes merge.

Maintainer options:

  1. Normalize timeoutSeconds with the shared timer helper (recommended)
    Use the same integer-safe seconds conversion behavior for both Codex timeout readers and add a regression case for fractional timeoutSeconds falling back instead of shortening the watchdog.
  2. Accept the narrower numeric behavior
    Maintainers may decide that any positive numeric timeoutSeconds should set a watchdog, but the PR should state that behavior and align tests with the chosen contract before merge.
  3. Use a sibling as canonical
    If maintainers prefer the broader shared-reader approach in fix(codex): honor timeoutSeconds for dynamic tool calls #98880, keep this PR paused until one clean canonical branch is selected.

Next step before merge

  • [P1] Human/contributor follow-up is needed because the PR has a code correctness finding and still needs real-behavior proof that automation cannot provide for the contributor's setup.

Security
Cleared: The diff only changes local Codex timeout parsing and focused tests; it does not touch dependencies, CI, package metadata, scripts, credentials, or downloaded code.

Review findings

  • [P2] Reject fractional timeoutSeconds before arming the watchdog — extensions/codex/src/app-server/dynamic-tool-execution.ts:454
Review details

Best possible solution:

Land one canonical timeoutSeconds fix that validates seconds-form budgets consistently with the owning tool contract, covers both primary and side-question readers, and includes redacted runtime proof or logs from a real Codex dynamic-tool setup.

Do we have a high-confidence way to reproduce the issue?

Yes, at source level: current main reads only timeoutMs in both Codex dynamic-tool timeout readers, while sessions_send exposes timeoutSeconds and upstream Codex forwards raw dynamic-tool arguments. I did not run a live current-main Codex timeout turn in this read-only review.

Is this the best way to solve the issue?

No: this is the right owner area and now covers both readers, but the PR uses a seconds parser that treats fractional timeoutSeconds as a shortened watchdog even though sessions_send treats fractional values as invalid. The safer fix is to share the validated seconds conversion behavior and cover that contract in both tests.

Full review comments:

  • [P2] Reject fractional timeoutSeconds before arming the watchdog — extensions/codex/src/app-server/dynamic-tool-execution.ts:454
    This reader floors any positive numeric timeoutSeconds before adding grace, so a raw timeoutSeconds: 0.5 no longer falls through to the 90s default; it arms a 10s watchdog before the tool bridge can reject or ignore that invalid integer field. sessions_send declares this field as an integer and existing tests reject fractional values, so the wrapper should use the same validated seconds conversion for both the main and side-question readers. This concern was visible in the earlier reviewed main-reader change, so I am marking it as a late discovery.
    Confidence: 0.83
    Late finding: first raised on code an earlier review cycle already covered.

Overall correctness: patch is incorrect
Overall confidence: 0.83

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against c79c38035873.

Label changes

Label changes:

  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🦐 gold shrimp.
  • add status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The PR body provides focused Vitest output, source-contract notes, and a proof-gate check, but no real Codex dynamic-tool call, runtime log, terminal transcript, or linked artifact showing timeoutSeconds behavior after the fix. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • remove rating: 🧂 unranked krab: Current PR rating is rating: 🦪 silver shellfish, so this older rating label is no longer current.
  • remove status: 🔁 re-review loop: Current PR status label is status: 📣 needs proof.

Label justifications:

  • P2: The PR targets a bounded Codex dynamic-tool timeout bug with real but limited impact on long-running session helper calls.
  • merge-risk: 🚨 session-state: The changed watchdog affects session helper dynamic-tool calls and can change whether a session timeout returns a structured tool result or a generic hard-timeout response.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🦐 gold shrimp.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The PR body provides focused Vitest output, source-contract notes, and a proof-gate check, but no real Codex dynamic-tool call, runtime log, terminal transcript, or linked artifact showing timeoutSeconds behavior after the fix. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed

PR surface:

Source +19, Tests +143. Total +162 across 4 files.

View PR surface stats
Area Files Added Removed Net
Source 2 22 3 +19
Tests 2 143 0 +143
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 165 3 +162

What I checked:

Likely related people:

  • steipete: Current-main blame and PR metadata tie the central Codex app-server files and sessions_send file in this checkout to PR 99838, and path shortlog shows Peter Steinberger as the dominant contributor across these files. (role: recent area contributor and merger; confidence: medium; commits: 384828770b02; files: extensions/codex/src/app-server/dynamic-tool-execution.ts, extensions/codex/src/app-server/side-question.ts, src/agents/tools/sessions-send-tool.ts)
  • vincentkoc: Recent path history includes commits touching side-question and sessions_send adjacent runtime files in the same Codex/session area. (role: recent adjacent contributor; confidence: low; commits: e085fa1a3ffd, 74e7b8d47b18; files: extensions/codex/src/app-server/side-question.ts, src/agents/tools/sessions-send-tool.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

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
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.
Review history (1 earlier review cycle)
  • reviewed 2026-07-02T08:45:16.374Z sha e6d9ffe :: needs real behavior proof before merge. :: [P2] Share timeoutSeconds handling with side-question

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. labels Jul 2, 2026
@qingminglong

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jul 2, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@qingminglong

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@qingminglong

Copy link
Copy Markdown
Contributor Author

Current-head proof refresh for #99003:

  • Current PR head is 8d94a49ffad732fcd93cd42585d14c8393edfb75.
  • The follow-up commit 8d94a49ffad732fcd93cd42585d14c8393edfb75 adds the side-thread timeoutSeconds parity fix that the prior ClawSweeper review requested.
  • The PR body Evidence now names current head 8d94a49ffad732fcd93cd42585d14c8393edfb75 and includes both focused proof commands:
    • node scripts/run-vitest.mjs extensions/codex/src/app-server/dynamic-tool-execution.test.ts -- --reporter=verbose -t "timeoutSeconds"
    • node scripts/run-vitest.mjs extensions/codex/src/app-server/side-question.test.ts -- --reporter=verbose -t "uses per-call timeoutSeconds for generic side-thread dynamic tool calls"
  • The GitHub Real behavior proof gate is green on the same head:
  • The dependency/source contract check is recorded in the PR body: ../codex/codex-rs/app-server-protocol/src/protocol/v2/item.rs forwards dynamic-tool arguments as raw JSON, so OpenClaw owns interpreting timeoutSeconds in the forwarded arguments.

@clawsweeper re-review

@clawsweeper clawsweeper Bot added status: 🔁 re-review loop A fresh ClawSweeper review was explicitly requested after the latest review. and removed status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Jul 2, 2026
@qingminglong

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 🔁 re-review loop A fresh ClawSweeper review was explicitly requested after the latest review. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Jul 4, 2026
@steipete

steipete commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Thanks @qingminglong for working on this. The canonical repair has landed via #100722 as 68487e4c1e3410a27b50b9cc0b67b2f5af6f82ad.

It covers the same timeoutSeconds gap and also consolidates the main and side-question paths on one timeout owner, preserves exact timeoutMs precedence, adds bounded setup/completion headroom, rejects fractional seconds, and proves structured sessions_send timeout completion. Closing this duplicate in favor of the landed implementation.

@steipete steipete closed this Jul 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extensions: codex P2 Normal backlog priority with limited blast radius. size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dynamic tool hard timeout should honor timeoutSeconds when timeoutMs is absent

2 participants