boxlite-ai / boxlite-ai/boxlite
CodeBox.run_script() reads from host filesystem, not from inside VM
- Dominant language
- Rust
- Stars
- 2.3k
- Forks
- 179
- Avg merge
- 23h 25m
- Merged PRs (30d)
- 121
Description
## Description
`run_script(path)` reads the script file from the **host** filesystem, not from inside the VM. This is counter-intuitive and undocumented — the docs show a pattern of creating a file inside the VM and then running it with `run_script()`, which fails.
## Reproduction
```python
import asyncio
import boxlite
async def main():
async with boxlite.CodeBox() as codebox:
# Create a script inside the VM
await codebox.run("""
with open('/tmp/analysis.py', 'w') as f:
f.write('import json\\nprint(json.dumps({"status": "ok"}))\\n')
""")
# Try to run the script from VM path
result = await codebox.run_script("/tmp/analysis.py")
print(result)
asyncio.run(main())
```
## Expected
`run_script("/tmp/analysis.py")` runs the script that was created inside the VM.
## Actual
```
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/analysis.py'
```
The error occurs on the **host** side, confirming `run_script()` tries to read from host filesystem.
## Environment
- boxlite 0.5.10
- macOS Apple Silicon
- Python 3.12
## Suggested fix
Either:
1. Make `run_script()` read from inside the VM (consistent with the name), or
2. Clearly document that `run_script()` reads from the host and sends content to the VM for execution
Contributor guide
Research direction
Start at the CodeBox.run_script() API and reproduce the failure with the Python example in this issue. Determine the intended host-versus-VM path contract, then update the relevant implementation, documentation, and tests so the chosen behavior is verified.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, rust
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100