Repository navigation
Surface actionable hint for Popen(timeout=) TypeError misread as API timeout (fixes #3) - #12
Merged
Conversation
The 'timeout errors' in #3 are not network/API timeouts: the screenshot shows a TypeError from a runtime-generated script calling subprocess.Popen(cmd, timeout=N), which Popen does not accept. The only salient word in the bare error is 'timeout', so users blame their API binding. run_command now detects this pattern in script output (including when the script swallows the exception and exits 0) and appends a hint that names the real cause and the fix, letting the agent self-correct on the next tool round instead of surfacing a misleading failure. Adds a README troubleshooting note distinguishing this from real network timeouts. Co-authored-by: Eric Wang <wangchen2007915@gmail.com>
ericwang915
marked this pull request as ready for review
September 8, 2026 08:05
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.
Root cause of #3
The "timeout errors" in #3 are not network/API timeouts. The screenshot attached to the issue reads:
That is a Python
TypeErrorfrom a script the agent generated/executed at runtime viarun_command: it calledsubprocess.Popen(cmd, timeout=N), butPopenhas notimeoutparameter (that argument belongs tosubprocess.run()/communicate()). The only salient word in the bare error is "timeout", so the reporter understandably blamed their API binding — which was fine all along.Investigation notes:
Popenappears only indaemon.py(withouttimeout) across every git revision and every published PyPI wheel (0.2.0 → 0.7.2), and the literal error/output strings from the screenshot appear nowhere in the codebase.run_commandreturns only the bare traceback, which the model then relays to the user as a generic "timeout" failure.Fix (DX)
run_commandnow detects thePopen.__init__() got an unexpected keyword argument '...'pattern in script output and appends an actionable hint to the tool result:exceptand print it, matching the exact phrasing in the screenshot).baseUrl/curl $BASEURL/modelsguidance from the maintainer's issue comment).Testing
tests/test_tool_error_hints.py: 7 tests covering the hint matcher (traceback form, bare-exception form, non-timeout kwargs, unrelated errors) andrun_commandintegration (crash path, swallowed-exception path, clean output).Fixes #3.