mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-10-22 16:35:20 +08:00
fix(tools): require python3 for Box native file scripts (#2658)
* fix(tools): require python3 for Box native file scripts Unversioned `python` is still Python 2 on some host-rootfs nsjail mounts. Falling back to it made read/write/edit scripts fail with SyntaxError on f-strings (#2603). Resolve only `python3`, and return a clear JSON error when it is missing instead of invoking Python 2. Fixes #2603 * style(tools): format Box interpreter error command Co-authored-by: multica-agent <[email protected]> --------- Co-authored-by: Li-john1021 <[email protected]> Co-authored-by: Chin Rock <[email protected]> Co-authored-by: multica-agent <[email protected]>
This commit is contained in:
co-authored by
multica-agent
Li-john1021
Chin Rock
parent
5c3675f4cc
commit
bce94bd0d9
@@ -866,7 +866,7 @@ async def test_box_grep_script_serializes_optional_include_as_python(monkeypatch
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_workspace_file_script_resolves_the_sandbox_interpreter():
|
||||
"""Sandboxes built from a host rootfs may only ship `python3`."""
|
||||
"""Native file tools must use python3 and never fall back to python2."""
|
||||
|
||||
captured: dict = {}
|
||||
|
||||
@@ -892,5 +892,7 @@ async def test_workspace_file_script_resolves_the_sandbox_interpreter():
|
||||
|
||||
assert result == {'ok': True}
|
||||
command = captured['command']
|
||||
assert command.startswith('PYTHON_BIN=$(command -v python3 || command -v python)')
|
||||
assert 'command -v python3 || true' in command
|
||||
assert 'python3 required for native file tools' in command
|
||||
assert command.endswith(' - <<\'PY\'\nprint("x")\nPY')
|
||||
assert '|| command -v python)' not in command
|
||||
|
||||
Reference in New Issue
Block a user