Repository navigation
cli: hold input for harnesses that can't take it mid-turn - #167
Merged
Merged
Conversation
morajabi
force-pushed
the
claude/bridge-held-input-204ab2
branch
from
November 23, 2026 11:34
0453181 to
7594524
Compare
acp agents advertise no steering and no native queue, yet v2 sent every message typed during a turn as a steer, so it failed with "could not take this". such input is now held in order, the sender is told it's queued, the run state counts it as queued, and each held message starts its own turn when the one before ends, whether it completed, failed or was stopped. pause keeps it until resume; a release or a lost session keeps it pending and offers it next time. /queue without a native queue does the same. steering harnesses are unchanged.
while an approval, plan or question card waited, a message typed without replying to it went into the blocked turn, where the harness could not act on it, and the sender was not told. it is now held with a note pointing at the card, and goes in once the card is answered: after a "no", it reaches the agent as what to do differently.
a card left by a session that crashed or was released held every later message, since nothing cleared it and no turn started. input now waits only for an open card whose interaction the current session still reports pending, so answering the newer of two cards keeps waiting for the older one. held input a release keeps is offered once, with one note, and a held message that loses a race to a turn isn't told twice.
morajabi
force-pushed
the
claude/bridge-held-input-204ab2
branch
from
November 23, 2026 14:39
886cfed to
a4fc164
Compare
morajabi
marked this pull request as ready for review
November 23, 2026 15:13
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.
Rebuilds the "hold input for harnesses without steering" part of the closed #153, written fresh on current main.
Bug on main
ACP drivers advertise
SteerNow/SteerNext/Queueas unavailable (crates/agent-driver-acp/src/harness.rs,acp_availability; every ACP driver reportsSteeringSupport::Unsupported). Butwork.rsdeliver()turned every message typed during a turn intoDelivery::Steer. The ACP harness then returnedSendError::Unavailable, so the input was markedFailedwith "could not take this"./queueon ACP failed the same way. Codex, Claude and OpenCode declare steering, so they never hit this.Change (
cli/src/bridge/v2/work.rsonly)SteerNext, or noQueuefor/queue), the input goes into a FIFOheldlist. The ledger marks itPending. The sender gets one reply ("Queued: … runs after the current turn"), andqueued_countin the run state includes it.Turn, after that turn's answer posts. The rest wait for that turn to end.Pendingpath.retained, so it's offered ("Run it?") at the next acquisition, like native queued input a release keeps. A CLI restart reports it through the existing "restarted before this ran" path.Busy), the input is held at the front and keeps the context it already took./queueon a harness with no native queue starts a turn when nothing is running, instead of failing.While an approval, plan or question card waits (second commit)
On main, a message typed without replying to the card went into the blocked turn as a steer. Claude and Codex can't act on it until the card is answered, and the sender wasn't told. It is now held the same way, with the note "Held: … is waiting on your answer to the request above. This goes to it once you answer." When the card closes (answered, cancelled, or the turn ends), held input goes out: as a steer on Claude/Codex/OpenCode, or as the next turn on ACP.
Chosen: hold, not deny-with-feedback. Turning any typed message into the denial's feedback would deny a tool the person might have meant to approve ("yes go ahead"). Holding makes no decision for them and composes with the existing buttons: tap "No, and tell Claude what to do differently" and the held message then reaches Claude as that "what to do differently". The button itself still sends Claude's fixed denial text. Card rendering, Codex elicitation and the card-rejection path are untouched.
A card blocks input only while the live session still reports its interaction pending, and any open card counts. A card left by a crashed or released session never holds input, and answering the newer of two parallel cards keeps waiting for the older one. Input is released when the turn ends or any interaction closes.
Apart from both cases above, harnesses that support steering are unchanged. One side effect:
/queueduring a turn on a Codex without the gatedthread/queue/addused to fail and now waits the same way.Protocol / schema
No proto, wire or DB schema changes.
AgentSessionState.queued_countis an existing field. It now also counts input the bridge is holding.Tests (
faults.rs, through the real runtime, work actor and SQLite ledger)The scripted session gets an ACP-shaped mode: turns stay live until the test ends them, with no steering and no native queue.
without_steering_a_message_waits_for_the_turn_whatever_its_end: held, not failed; delivered as a turn after Completed, Failed, Interrupted and ConnectionLostheld_messages_run_one_turn_each_in_order: 3 held messages go out one per turn, in order, each exactly oncepause_keeps_held_input_until_resumequeue_without_a_native_queue_runs_after_the_turnan_edited_held_message_runs_once: edits while held and after it ran don't deliver it againa_steering_harness_still_steers_the_running_turna_message_typed_while_a_card_waits_goes_in_once_it_is_answered: held while an approval card waits, untouched by other events, then steers the turn once the card closes with a "No"held_input_waits_for_every_open_card: answering the newer of two cards keeps input held for the older onea_card_from_an_ended_session_holds_no_input: after a crash with a card up, the next message runs in the fresh session; held input is offered once even when the hold machine reports it tooThe card test fails when the card check is disabled. The last two fail with the earlier
waiting-based check.Against main's
work.rs, the first 5 fail and the steering test passes.cargo test -p inline-cli --bin inline bridge::: 670 passed, 0 failed.cargo clippy -p inline-cli --bin inline --tests -- -D warnings: clean.Review notes
🤖 Generated with Claude Code