Skip to content

feat(controller): prompt starts its task as a background job (#254) - #258

Merged
benvinegar merged 1 commit into
masterfrom
prompt-as-job
Nov 10, 2026
Merged

benvinegar merged 1 commit into
masterfrom
prompt-as-job

Conversation

@benvinegar

@benvinegar benvinegar commented Nov 9, 2026 •

Copy link
Copy Markdown
Member

Closes #254.

What

boxery prompt NAME "TASK" now starts pi -p TASK as a background job (the same mechanism as run --bg), instead of a hand-rolled tmux session with a log file. So the job commands work on agent tasks:

$ boxery prompt demo "fix the failing tests"
started job-20261109-153012-a1b2c3 on demo — wait: boxery job wait demo job-20261109-153012-a1b2c3   logs: boxery job logs demo job-20261109-153012-a1b2c3 -f

$ boxery job wait demo job-20261109-153012-a1b2c3     # blocks; exits with pi's own status
$ boxery job logs demo job-20261109-153012-a1b2c3 -f   # follows until it ends
$ boxery job ls demo                                   # state, exit code, started, took
$ boxery job kill demo job-20261109-153012-a1b2c3

Before, the same command printed started task-… on demo — watch: boxery attach demo pi task-… log: boxery run demo cat .boxery/task-….log, and none of job ls|logs|wait|kill could see the task. Waiting for one meant polling the log for a [boxery] task finished line by hand.

(The transcript above shows the output format the tests assert; I did not run this against a live VM.)

Behavior changes

  • prompt prints a job id (job-…) and the job wait / job logs -f commands, not a tmux session name and a log path.
  • There is no ~/project/.boxery/task-*.log and no attach NAME pi task-… for a prompt task any more. The output is the job's log (job logs). pi -p is non-interactive and prints its answer when it finishes, so attaching showed nothing more than the log did.
  • The job's tmux session is named after the job id, so agent ls lists it as job-…. (From the helper code; not observed on a live VM.)
  • Unchanged: the llm: grant pre-check (needPiGrant) still runs first, and the task text reaches pi byte-for-byte as one argument (it now travels as the job's base64 argv, so there is no quoting to get wrong). The child still runs in ~/project.

Not in this PR

Tests

  • test/jobs.test.mjs: new end-to-end test with the real CLI and VM helper against the fake VM. prompt starts a job whose log is pi's output, job wait exits with pi's status (a stub pi exits 7), job ls lists it, the task is one argv word, and the cwd is ~/project.
  • test/cli-families.test.mjs: the two prompt tests now decode the job's argv instead of the old tmux script.
  • test/shell/common/controller-local.sh: the "started" and "log hint" cases become "starts a job" and "runs pi -p with the task as one argument".
  • Help text and goldens, docs/cli.md, and two comments in test/parity.test.mjs updated.

npm test (533 passed, 1 skipped), npm run lint, npm run typecheck, npm run docs:cli (no diff) and npm run test:shell pass.

Developed with an AI agent assistant and reviewed by me.

@benvinegar

benvinegar commented Nov 10, 2026 •

Copy link
Copy Markdown
Member Author

Ran it for real on a libvirt VM (Hornet pool VM, llm:chatgpt granted), using this branch's CLI:

  • boxery prompt pool1 "Run uname -a with bash and reply with just the result on one line." returned at once with a job id; job ls showed it running with the real pi -p '…' command.
  • job wait blocked about 7s and exited 0; job logs held pi's answer (Linux pool1 6.8.0-149-generic … x86_64 GNU/Linux); job ls --json showed exited, exit_code: 0, cwd /home/agent/project.
  • With BOXERY_STATUS=1, job wait emitted OSC 7501 state=working and then state=done ("pool1: wait done"). Not tried in a Rex terminal.
  • A long task (pi asked to sleep 300): job wait --timeout 15 reported done ("timed out (the job is still running)") with pi still running; job logs -f stayed silent while pi ran (pi -p prints at the end); job kill stopped it (killed … (exit 143)), job ls showed killed, job wait returned 143, and no pi or sleep processes were left in the VM.

Not checked live: the PR description says a running job's tmux session shows up in agent ls as job-…. I only ran agent ls after both jobs had ended (it printed (no tmux sessions)), so that line is from reading the helper code, not observed.

@benvinegar
benvinegar merged commit c3e5cfd into master Nov 10, 2026
10 checks passed
@benvinegar
benvinegar deleted the prompt-as-job branch November 10, 2026 02:02
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.

prompt tasks are tmux sessions, so job ls/logs/wait cannot see them

1 participant