Repository navigation
Show what a working child does now, and let the main agent interrupt its current command - #44
Merged
Merged
Conversation
…its current command A child takes the main agent's messages only between its steps. When a child hung in a command, the main agent saw only "working, for 2.7 h", sent "wrap up", got "Sent to c5", and could not tell that the message was still waiting; it stopped the child and lost its work. Wherever a working child is described (the task tool's list, the answer to send, the children lines of place and timed wakes, the handoff of a new page, pots children), it now says what the child does now: the tool call it is in and for how long, the start of the command (and the call its script makes), its last line of output and how old that is, its model answering or trying again, and how many messages from the main agent wait for it. New task action interrupt: it aborts the tool calls a child is in (bash and screen kill the command's process group) and leaves the child running; the child sees the aborted result and takes the messages that waited. The task tool's description and the Children part of the prompt say how messages reach a working child and what interrupt does.
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
A child takes the main agent's messages only between its steps. On 2026-11-12 a child hung for 2.5 h in a
bashcommand with no timeout. The main agent sent it "wrap up" and got "Sent to c5". Its wakes showed onlyc5 "…": working, for 2.7 h, so it could not tell that the message was still waiting. It stopped the child and lost its work, one minute before the hung process was killed by hand.What changes
What the main agent sees. Wherever a working child is described (the task tool's
list, the answer tosend, the children lines in place wakes and timed/fallback wakes, the handoff of a new page,pots children), lines now follow that say what the child does now, read from its conversation each time:Other cases:
In codemode for 10 min: …followed byIts script is in bash for 9 min: sleep 999;No output yet.;Its model is answering.;Its model's last request failed (…); it tries again in 20 s.;It is compacting its context.Commands and output lines go on one line and are cut at 150 characters. An output line shows the text after its last carriage return, with terminal escape codes removed.Where the facts come from: pi-durable's
pi.live(the current tool calls, their output, nested calls, generation and retry, compactions),pi.inbox(queued messages), and each running tool task's record (startedAt, and the arguments from itsexecutecheckpoint). Wrappers aroundbash,screenandcodemodekeep the time of each running call's last output in memory. That is enough, because a running call never lasts past a restart.New task action
interrupt. It aborts the tool calls a child is in (Harness.abortTaskon each running tool task). It waits at most 10 s for them to end, and leaves the child running.bashandscreenkill the command's process group, and acodemodecall aborts the calls its script made. The child gets the usual "Tool bash was aborted" result with the output so far, takes the messages that waited, and goes on. The answer looks like this:Interrupted c5: ended its bash, which ran 2.5 h (cd /tmp/rdtest && node rfbping.mjs …). It goes on: it sees that the call was aborted, and takes the message from you that waits.Text that changes. The task tool's description:
sendno longer says the message "joins its work"; there are newlistwords and a newinterruptaction. One new line in the Children part of the prompt: a child takes messages only between its steps;interruptends its tool calls and the child goes on;stopends the child. The README's children section and the test table indocs/development.mdare updated too.There is no default timeout, and nothing new in
bot.json. The inbox, the waker, the outbox and the timers do not change, sospec/does not change.Tests
test/children.test.ts, two new tests on a real gateway with the fake model. (1) A child hangs inbashafter one line of output.pots children, the place wake and the answer tosendshow the command, its age and its last output.pots childrenshows the waiting message, and the child takes nothing while the command runs.interruptends the command; the hung process is gone (checked by PID, except on Windows). The child's next request has the aborted result and then the waiting message, and its report reaches the channel. (2) The same with the command run from acodemodescript.test/children.parts.test.ts: the description on its own (progress lines, escape codes, cutting, nested calls, model retry, compacting, waiting messages, a child that waits or was stopped).npm run checkand the fullnpm testpass on Linux arm64 (305 passed, 2 skipped).