fix(%info): pass curl as argv list, add timeout, and surface real errors#1737
Open
alvinttang wants to merge 1 commit intoopeninterpreter:mainfrom
Open
fix(%info): pass curl as argv list, add timeout, and surface real errors#1737alvinttang wants to merge 1 commit intoopeninterpreter:mainfrom
alvinttang wants to merge 1 commit intoopeninterpreter:mainfrom
Conversation
…meout
`interpreter_info()` invoked the local-LLM probe as
subprocess.check_output(f"curl {interpreter.llm.api_base}")
Without `shell=True` subprocess treats the entire string as the path to
the executable, so the call always raised FileNotFoundError before curl
even started. The exception was swallowed and surfaced in `%info` as
`Curl output: [Errno 2] No such file or directory: 'curl http://...'`,
matching issue openinterpreter#1218 ("%info ubuntu 22 no output") and the `Curl output`
artifact reported in openinterpreter#1083.
Pass argv as a list (so curl is resolved on PATH) and add `--max-time 5`
plus a 10s subprocess timeout so a dead/unreachable api_base no longer
hangs the magic command.
Tests:
- new tests/core/utils/test_system_debug_info.py covers:
- curl invoked with a real argv list / shell=True
- timeout kwarg is passed
- failure is caught and reported, not raised
- curl is not invoked when interpreter is online
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.
Summary
Fixes #1218.
interpreter/core/utils/system_debug_info.py:Without
shell=True, subprocess treats the entire f-string as the executable path → always raisesFileNotFoundError: 'curl http://...'. Caught and stringified, so%infodisplays the FileNotFoundError text instead of the LLM-server response. There is also no timeout, so a naiveshell=Truepatch would hang on a deadapi_base.Fix
Pass argv as a list
["curl", "--silent", "--show-error", "--max-time", "5", api_base](curl is now resolved on PATH and actually runs), capture stderr, and add subprocesstimeout=10.Test
tests/core/utils/test_system_debug_info.py(4 tests, loads module by file path so the heavyinterpreter/__init__.pydoesn't need its full dep tree):timeoutkwarg is passed.CalledProcessErroris caught gracefully.offline=False.TDD: tests 1+2 RED on stock main → 4/4 GREEN after the patch. End-to-end smoke against
http://127.0.0.1:1shows curl exits 7 ("failed to connect") in 0.01s instead of the previous spuriousFileNotFoundError.Risk notes
Diagnostic path only (
%infomagic). Strictly more useful behaviour: real errors via--show-error, hard 10s upper bound, honestFileNotFoundError: 'curl'if curl is missing.Refs #1218