Repository navigation
fix(move): read the agent again, last of all, right before typing its exit - #4111
Conversation
… exit The move to herdr-core read an agent's status and conversation, then its input box, then typed the exit command. An agent that took work or switched conversation during the input-box read, or while the exit waited for the pane's input lane, was still typed into. sendExit now reads the input box and then the agent inside the pane's input lane, and refuses when the pane no longer shows the same idle agent on the conversation the plan showed. The queue is asked again in herdr's pre-write guard, since a held message can be re-keyed to the pane outside the lane. A refusal comes back as a value: runMove stops with a reason the page already translates (agent_busy, input_left, plan_changed) instead of a raw "failed: ..." line, and an agent that was not typed into is no longer listed as ended. That covers a failed read, the guard refusing before a byte went out, herdr answering that it refused (agent_blocked, agent_not_found, agent_not_ready) and a herdr that was never reached (connect_failed, still shown as what failed). Any other error may follow the keys: it still throws and keeps the journal entry. Still typed into: work or a draft that starts between those reads and herdr's Enter, 300 ms after its paste, from outside the lane (the terminal, herdr's own clients, POST /api/pane/input). herdr has no call that types only into an idle agent with an empty input box. Co-Authored-By: Claude Fable 5.2 <[email protected]>
|
No actionable comments were generated in the recent review. Summary
Merge Risk:
|
|
Merged through Merged by the session that opened it. Reviews: CodeRabbit at this head, no actionable comments. Codex gpt-6.2-sol and gpt-6.2-astra, read-only, on the first head: the same seven findings, four about this change and fixed, three older and listed in the PR body. gpt-6.2-sol on the second head: an unreachable herdr left in the journal (fixed), the prompt adapter (removed). gpt-6.2-sol on the third head: CLEAR; its one medium (an error code carried in herdr's reply counted as nothing typed) and one low (an empty pane.get answer) are fixed in this head with tests. bun run check fast passed on this head. |
What
Before the move to herdr-core ends an agent, it types the agent's exit command into its pane. It
read the agent's status and conversation, then its input box, then typed. An agent that took work
or switched conversation during the input-box read, or while the exit waited for the pane's input
lane, was still typed into. The comment the restore pass put back in
server/runtime-move-run.tsnamed this gap (#4094).
herdrSource.sendExitnow reads, inside the pane's input lane, the input box and then the agent(kind, status, conversation), and refuses unless the pane still shows the same idle agent on the
conversation the plan showed. The pending queue is asked once more in herdr's pre-write guard: a
held message can be re-keyed to the pane outside the lane.
runMovestops with a reason the page alreadytranslates (
agent_busy,input_left,plan_changed) where it used to show a rawfailed: a message waits for the pane.rollback neither lists it as left behind nor restarts it. Certain means: a check refused, the
guard refused before a byte went out, herdr answered
agent_blocked,agent_not_foundoragent_not_ready, or herdr was never reached (connect_failed, still shown as what failed).Any other error may follow the keys: it still throws and the entry stays.
Not changed, on purpose
outside the lane is still typed into: the terminal, herdr's own clients,
POST /api/pane/input.herdr has no call that types only into an idle agent with an empty input box. The order is box,
then agent: the agent's status is what the wait for the lane leaves stale.
freshplan carries no conversation id (shared/runtime-move.tsis a wire type), so itsconversation is not compared.
names an agent it never typed into.
rollBackcallsdestination.endMoveeven when nothing was built on herdr-core.agent_blockedand a queued message are all reported asagent_busy, asrunMove's own first read already reports them.The last four predate this PR.
Reviews
gpt-6.2-solandgpt-6.2-astra, read-only, on the first head: the same seven findingsfrom both. Four were about this change and are fixed here (conversation not compared, read order,
a failed read left in the journal, a message re-keyed during the read). Three predate it and are
listed above.
gpt-6.2-solon the second head: the read order again (decided as above), an unreachable herdrleft in the journal (fixed), the default prompt adapter not covered by a test (the adapter is
gone:
agentPromptis called directly), and thefreshplan (listed above).gpt-6.2-solon the third head: CLEAR, with one medium (an error code carried in herdr's replycounted as nothing typed) and one low (an empty
pane.getanswer), both fixed in this head.Validation
bun run check faston this head: passed.server/runtime-move-service.test.tsandserver/runtime-move-run.test.ts: the new and changedtests fail on
main'sruntime-move-run.tsandruntime-move-service.tsand pass here.bun run check full, the browser regressions (no UI change), a real move on a liveherdr.
🤖 Generated with Claude Code