docs(coding-agent): guide non-blocking long bash tasks - #1316
Conversation
jonaowen
left a comment
There was a problem hiding this comment.
This prompt tells the agent to end the turn while an unowned asyncio.Task runs only in the kernel. That is not a persistent/durable task contract: kernel restart, session rotation, process teardown, or task GC/cancellation loses the command and its result. asyncio.create_task() also leaves exceptions unobserved until a later turn that may never occur, and there is no cleanup/adoption registry.
Moreover the stacked base #1187’s bash() explicitly terminates background descendants and drains pipes as part of collection. Turning its coroutine into a detached task does not provide receipt paths, durable process identity, restart reconstruction, or cancellation ownership—the properties needed for an actual long job. Do not describe this as “persistent.” Either scope the guidance to short same-kernel work and require an immediate owner plus exception-safe callback/finally cleanup, or land a real managed task registry/detached-job substrate with durable receipts, restart/adoption semantics, bounded output, terminal observation, and cancellation tests. It should also remain stacked until #1187’s contract is accepted.
Summary
Adds one concrete prompt example for running a long command without holding the agent turn open:
The prompt tells the model to end the turn, inspect
check.done()later, and callcheck.result()after completion instead of waiting with sleep loops.Stacked on #1187. Supersedes #1188.
Validation
npx tsx ../../node_modules/vitest/dist/cli.js --run test/system-prompt.test.tsnpm run checkcloses #1034
Note
Add guidance for running long bash commands as non-blocking asyncio tasks in coding agent prompts
Adds a new guidance block to the
IPYTHON_CONTROL_PROMPTin rlm.ts instructing the agent to wrap long-running shell commands inasyncio.create_task(bash(...))so they run without blocking the current agent turn. Includes a concrete example usingasyncio.create_task(bash("npm run check", timeout=1800)). Updates the system prompt snapshot test to reflect the new prompt content.Macroscope summarized 8e42a5d.