Two problems found while using the library from a consumer project, with both agents.
Timed-out runs keep the agent running
When a Vitest test times out, or the worker is killed, the container keeps running until the agent finishes on its own. It keeps spending tokens and nothing on the test side can stop it: runDocker has no cancellation and containers are not named.
How we saw it: started a container through runDocker, dropped the promise after 3 seconds, exited the process. docker ps still showed it running. Stale workspaces from interrupted runs pile up in the tmp root for the same reason.
Suggested fix:
- give every
docker run a unique --name
- accept an
AbortSignal (or an agent({ timeoutMs }) option); on abort, docker rm -f the container and reject with a clear error
- remove the workspace of an aborted run as well
Size: small to medium.
Prompts of 128 KB or more fail before the agent starts
The prompt is passed as a single docker run argument. Linux caps one argument at 128 KB, so a long prompt (a pasted file, a transcript) fails with argument list too long.
How we saw it: a 120 KB prompt works, 130 KB fails. Claude Code accepts the same 200 KB prompt on stdin and proceeds normally. Cursor's agent -p also reads stdin.
Suggested fix: pipe the prompt through docker run -i instead of argv, always or above a size threshold. This also keeps prompts out of ps output on the host.
Size: small.
Two problems found while using the library from a consumer project, with both agents.
Timed-out runs keep the agent running
When a Vitest test times out, or the worker is killed, the container keeps running until the agent finishes on its own. It keeps spending tokens and nothing on the test side can stop it:
runDockerhas no cancellation and containers are not named.How we saw it: started a container through
runDocker, dropped the promise after 3 seconds, exited the process.docker psstill showed it running. Stale workspaces from interrupted runs pile up in the tmp root for the same reason.Suggested fix:
docker runa unique--nameAbortSignal(or anagent({ timeoutMs })option); on abort,docker rm -fthe container and reject with a clear errorSize: small to medium.
Prompts of 128 KB or more fail before the agent starts
The prompt is passed as a single
docker runargument. Linux caps one argument at 128 KB, so a long prompt (a pasted file, a transcript) fails withargument list too long.How we saw it: a 120 KB prompt works, 130 KB fails. Claude Code accepts the same 200 KB prompt on stdin and proceeds normally. Cursor's
agent -palso reads stdin.Suggested fix: pipe the prompt through
docker run -iinstead of argv, always or above a size threshold. This also keeps prompts out ofpsoutput on the host.Size: small.