Skip to content

[codex] Fix MCP automatic polling timeout#3205

Merged
hengyunabc merged 2 commits into
alibaba:masterfrom
hengyunabc:codex/watch-timeout-polling
Jun 4, 2026
Merged

[codex] Fix MCP automatic polling timeout#3205
hengyunabc merged 2 commits into
alibaba:masterfrom
hengyunabc:codex/watch-timeout-polling

Conversation

@hengyunabc
Copy link
Copy Markdown
Collaborator

Summary

  • derive normal tools/call automatic task polling timeout from positive arguments.timeout plus a 10s grace window
  • preserve the configured automatic polling timeout as the minimum wait
  • add focused unit coverage for missing, long, short, string, invalid, and null-default timeout cases

Root Cause

Task-aware streamable tools called through normal tools/call create a task and wait for it to reach a terminal state. That compatibility path used the fixed 30s automatic polling timeout, so calls like watch with timeout=45 could return Task timed out waiting for completion before the command-level timeout produced its structured result.

Validation

  • ./mvnw -pl arthas-mcp-server -Dtest=ServerTaskToolHandlerTest test
  • ./mvnw -pl arthas-mcp-server test
  • git diff --check
  • ./mvnw -pl arthas-mcp-integration-test -am -Dtest=com.taobao.arthas.mcp.it.ArthasMcpJavaSdkIT,com.taobao.arthas.mcp.it.task.ArthasMcpTasksIT -Dsurefire.failIfNoSpecifiedTests=false verify

@hengyunabc hengyunabc requested a review from Copilot June 4, 2026 11:29
@hengyunabc hengyunabc marked this pull request as ready for review June 4, 2026 11:33
@hengyunabc hengyunabc merged commit 84aa70a into alibaba:master Jun 4, 2026
1 check passed
@hengyunabc hengyunabc deleted the codex/watch-timeout-polling branch June 4, 2026 11:36
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 571699e040

ℹ️ 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".

Comment on lines +410 to +411
Duration derived = commandTimeout.plus(AUTOMATIC_POLLING_GRACE);
return base.compareTo(derived) >= 0 ? base : derived;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Bound polling timeout to the task TTL

When automatic polling receives a timeout longer than the task store TTL, this derived timeout can wait longer than the task record lives. In the Arthas MCP wiring the task store TTL is 30 minutes and automatic calls pass no request TTL, so a call such as watch with timeout=3600 can have its task/result removed before the background tool can complete it; the watcher then waits until this longer timeout and returns a timeout instead of the command result. Please either raise the automatic task TTL to cover the derived timeout or cap/reject timeouts that exceed the task TTL.

Useful? React with 👍 / 👎.

@hengyunabc hengyunabc review requested due to automatic review settings June 4, 2026 11:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant