[codex] Fix MCP automatic polling timeout#3205
Conversation
There was a problem hiding this comment.
💡 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".
| Duration derived = commandTimeout.plus(AUTOMATIC_POLLING_GRACE); | ||
| return base.compareTo(derived) >= 0 ? base : derived; |
There was a problem hiding this comment.
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 👍 / 👎.
Summary
tools/callautomatic task polling timeout from positivearguments.timeoutplus a 10s grace windowRoot Cause
Task-aware streamable tools called through normal
tools/callcreate a task and wait for it to reach a terminal state. That compatibility path used the fixed 30s automatic polling timeout, so calls likewatchwithtimeout=45could returnTask timed out waiting for completionbefore the command-level timeout produced its structured result.Validation
./mvnw -pl arthas-mcp-server -Dtest=ServerTaskToolHandlerTest test./mvnw -pl arthas-mcp-server testgit 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