Skip to content

fix(%info): pass curl as argv list, add timeout, and surface real errors#1737

Open
alvinttang wants to merge 1 commit intoopeninterpreter:mainfrom
alvinttang:fix/system-debug-info-curl-args
Open

fix(%info): pass curl as argv list, add timeout, and surface real errors#1737
alvinttang wants to merge 1 commit intoopeninterpreter:mainfrom
alvinttang:fix/system-debug-info-curl-args

Conversation

@alvinttang
Copy link
Copy Markdown

Summary

Fixes #1218. interpreter/core/utils/system_debug_info.py:

curl = subprocess.check_output(f"curl {interpreter.llm.api_base}")

Without shell=True, subprocess treats the entire f-string as the executable path → always raises FileNotFoundError: 'curl http://...'. Caught and stringified, so %info displays the FileNotFoundError text instead of the LLM-server response. There is also no timeout, so a naive shell=True patch would hang on a dead api_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 subprocess timeout=10.

Test

tests/core/utils/test_system_debug_info.py (4 tests, loads module by file path so the heavy interpreter/__init__.py doesn't need its full dep tree):

  1. curl is invoked as a real argv list, not as a single-token executable.
  2. timeout kwarg is passed.
  3. CalledProcessError is caught gracefully.
  4. curl is not invoked when 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:1 shows curl exits 7 ("failed to connect") in 0.01s instead of the previous spurious FileNotFoundError.

Risk notes

Diagnostic path only (%info magic). Strictly more useful behaviour: real errors via --show-error, hard 10s upper bound, honest FileNotFoundError: 'curl' if curl is missing.

Refs #1218

…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
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.

%info ubuntu 22 no output

1 participant