Skip to content

fix(runtime): stop the dynamic-tool-result backstop from undercutting long tool executions - #6848

Merged
Hmbown merged 1 commit into
codewhale-hq:mainfrom
asto18089:upstream/dynamic-tool-result-budget
Oct 5, 2026
Merged

Hmbown merged 1 commit into
codewhale-hq:mainfrom
asto18089:upstream/dynamic-tool-result-budget

Conversation

@asto18089

Copy link
Copy Markdown
Contributor

Summary

The headless Runtime API's MCP tools/call budget defaults to 1800s (McpTimeouts::default()), but the dynamic tool-result backstop still capped the wait for a client-executed result at 300s: a healthy call in the 300–1800s window had its result delivery dropped with ToolError::Timeout while the execution itself was still allowed to run.

Align the backstop with the 1800s budget and pin the pairing with a unit test. The wait still ends early on turn interrupt or runtime shutdown (settle_dynamic_tools_for_terminal_turn), so the cap only governs a client that never answers.

Testing

  • cargo test -p codewhale-tui --lib dynamic_tool_result — new pin asserts the backstop equals McpTimeouts::default().execute_timeout and 1800s; the existing behavior test (dynamic_tool_timeout_clears_snapshot_and_emits_once) covers the firing path via the test seam
  • cargo clippy -p codewhale-tui --all-targets --all-features --locked

Adapted from the Pinvou fork's timeout audit (Pinvou/CodeWhale d349f2537), on top of the budgets introduced by #6741.

Checklist

  • Updated docs or comments as needed
  • Added or updated tests where relevant
  • No CHANGELOG.md changes

… long tool executions

The headless Runtime API raises the MCP `tools/call` budget to a 1800s
default (`McpTimeouts::default()` execute_timeout) so legitimate long
executions — builds, test suites, remote jobs — are not answered with
"timed out" while the tool is still running. The dynamic-result
backstop in runtime_threads, however, still capped the wait for the
client-executed result at 300s: a healthy MCP call in the 300s-1800s
window got its pending result dropped and a ToolError::Timeout handed
to the model even though the execution was allowed to continue.

Align the backstop with the 1800s `tools/call` budget so the two
clocks no longer disagree, and pin the pairing with a unit test. The
wait still ends early on turn interrupt or runtime shutdown, so the
raised cap only governs the case where the client never answers.

Signed-off-by: asto <asto18089@126.com>
@asto18089
asto18089 requested a review from Hmbown as a code owner October 5, 2026 11:51
@github-actions github-actions Bot added the contribution-gate Author not yet in .github/APPROVED_CONTRIBUTORS; a maintainer grants access with /lgtm label Oct 5, 2026
@Hmbown
Hmbown merged commit 6938498 into codewhale-hq:main Oct 5, 2026
1 check passed
@Hmbown Hmbown added this to the v0.10.1 milestone Oct 5, 2026
Hmbown pushed a commit that referenced this pull request Oct 5, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contribution-gate Author not yet in .github/APPROVED_CONTRIBUTORS; a maintainer grants access with /lgtm

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants