chore(mcp): set an idle timeout for the flow MCP server - #445
Merged
Conversation
Any MCP tool call whose flow subprocess exited non-zero left the client
waiting on a request that never got a response, until it hit an idle timeout.
The target passed to errors.As was exec.ExitError, a value. ExitError's Error
method has a pointer receiver, so the value type does not implement error, and
errors.As panics on such a target ("*target must be interface or implement
error"). That panic killed the tool handler's goroutine before it could reply.
Nothing about the failure was visible from outside: the subprocess had already
run and recorded its terminal status in flow's history, and the server kept
serving other requests normally — only the one request was lost.
The one-character fix is *exec.ExitError, matching tests/utils/runner.go, which
had it right. This also restores the behavior the comment always described:
a non-zero exit is a normal outcome whose detail is already in the captured
output, so it returns as output with a nil error.
Affects every tool that shells out — execute, run_command, run_executable,
get_execution_logs, sync_executables — for any failing command.
The regression test drives the real FlowCLIExecutor against a stand-in binary
via FLOW_CLI_BINARY; it fails with the original panic before the fix.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01R328pa3FUUfga4gYah1iQi
Bounds how long an MCP client waits on a silent flow tool call before giving up. This is a backstop, not the fix for the hang that prompted it — that was a panic in the exit-error path, fixed separately. Scoped per-server rather than set globally via CLAUDE_CODE_MCP_TOOL_IDLE_TIMEOUT so it does not loosen timeouts for every other MCP server a user has connected. Ten minutes matches the longest timeout in CI. It is an idle timeout — time without output or progress, not total runtime — so a legitimately slow run like `validate` on a cold cache is unaffected, while a genuine hang still ends. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01R328pa3FUUfga4gYah1iQi
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part 2/2. Stacked on #444.
Summary
Bounds how long an MCP client waits on a silent flow tool call before giving up.
This is a backstop, not the fix for the hang that prompted it — that was the panic in #444. Worth keeping regardless, so a genuine hang ends in minutes rather than never.
Notable Changes
CLAUDE_CODE_MCP_TOOL_IDLE_TIMEOUT, so it does not loosen timeouts for every other MCP server a user has connected.build binary,test e2e). It is an idle timeout — time without output or progress, not total runtime — so a legitimately slow run likevalidateon a cold cache is unaffected..mcp.jsonis committed, so this applies to every clone. That is deliberate and consistent with why the file is checked in: flow's own dev tasks legitimately run for minutes, and every contributor wants the same headroom.Testing
Config-only; no code paths change.
flow validatepasses.🤖 Generated with Claude Code
https://claude.ai/code/session_01R328pa3FUUfga4gYah1iQi