Skip to content

fix: confirm typed input by the core's projected turn, not Herdr's raw status - #1967

Merged
yansfil merged 4 commits into
mainfrom
fix/typed-input-reads-projected-turn
Nov 1, 2026
Merged

yansfil merged 4 commits into
mainfrom
fix/typed-input-reads-projected-turn

Conversation

@yansfil

@yansfil yansfil commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Hide checks a brief or letter it typed against the agent's own record. If the agent never records it, Hide tells the parent and types it again once someone answers the screen.
That check decided "the agent is working" from Herdr's raw status. The row, the doorbell and sleep all read the core's one turn instead (hook first, then session file, then Herdr, #1954).
When the two disagreed, the typed-input decision disagreed with the row:

  • hook says working, Herdr says idle: the parent got a false "has not confirmed" notice, and once the screen was answered the brief could be typed into a working agent a second time.
  • hook says the turn ended, Herdr still says working: the record wait never started, so the notice and the retype never came.

Now the confirmation, the composer read before a retype, and omp's "a turn after the typing is its record" all read the same projected turn.
The composer read goes through the same gate a bell is typed through, now shared with the doorbell (doorbell::unheld_turn, doorbell::takes_keys).

One more rule for the same decision: a brief also counts as taken when the agent's own hook reports a turn that started after the typing, and no other input or bell could have started it.
It is confirmed by: turn, as omp's already is: the parent is not told, the row asks nothing, and it is never typed again, even if the prompt digest never matches.
Today a long brief to Claude Code reads unconfirmed though it was taken (its digest is being fixed separately), and nothing may type a brief twice (principle 11).

Review

  • Judgement call: when the core has no turn for the pane (a stale read, or the moment between a pass's observation and the turn it lays), nothing moves, and the row and hide agent show keep the last verdict for that typing (plans.input_verdicts).
    A state ends this, never a timer: the next agent list (asked every second) lays a fresh turn; a stale read ends with the list that confirms the agents again, and until then the row also shows activity unknown; a pane Herdr no longer lists drops its input.
    Without this, the doorbell's 250 ms pass falls into that moment on every session pass. It would drop the asked reread (so the verdict starts over) and make the row's ask blink.
    A stale read used to drop the row's ask; it now keeps it.
  • Behavior change for tool-letter agents (OpenCode, Pi, omp, Antigravity, Grok): when their hook says idle and Herdr still says working, they are now judged at rest, so after the record wait the parent gets the "has not confirmed" notice.
    Hide still does not retype or read the composer while Herdr reads them working (takes_keys, the same rule the bell follows).
  • Judgement call: the turn rule counts only a turn the hook reports (TurnProjection::reported), never Herdr's reading alone. It misses a turn shorter than one pass, input during the turn, a core restart (the latch is memory until the store confirms), and agents whose hook reports no turn. Those keep the record-only rule.
  • Files to watch:
    • herdr-core/src/delivery/doorbell.rs: judge is split into two helpers with the same holds in the same order; the bell's behavior must not change.
    • herdr-core/src/delivery/typed.rs: composer_readable is now the doorbell's gate, so for a kind without tool letters, a turn at rest that Herdr still reads as working gets its composer read. The off-lock readiness.accepts_input() check still holds before any key is sent.
  • Cost: no new work per input. Each doorbell pass rebuilds plans.input_verdicts, one entry per unconfirmed input (bounded by open inputs), under the lock it already holds, with no I/O.
  • Left on purpose: delivery/watch.rs reads Herdr status changes as an inactivity clock for quiet-child warnings, and worker.rs same_target compares samples. Neither decides whether the agent works now, so neither is changed.

Evidence

  • Checked: two runtime tests cross the hook and Herdr and assert what the doorbell receives (typed_input_work notice and retype, input_asks row). Both fail against the old raw-status read and pass now.
  • Checked: a_stale_read_keeps_the_briefs_verdict_until_a_fresh_turn_is_laid drives telemetry_stale through Unsettled and back: across a 10-minute stale read the row's ask and agent show's unconfirmed stay, nothing is sent, and the reread is not asked again. A fresh turn continues the verdict, an unlaid pass holds it the same way, and the pane leaving drops it. It fails when a stale read falls back to Waiting, as before this PR.
  • Checked: a_brief_whose_hook_reports_a_turn_after_the_typing_is_confirmed_by_that_turn: during the turn and after it ends (record still unmatched, screen answered), the doorbell gets only recorded: turn, with no notice, reread or resubmit; the row has no ask and agent show lists no pending brief.
  • Checked: a_turn_herdr_alone_reads_or_other_input_started_is_no_record_of_the_brief: Herdr-only working, a key after the typing, and a letter bell after the typing each still end in the parent's notice.
  • Checked: omp's turn record now follows the core's turn (an omp hook turn while Herdr reads idle confirms the brief). The existing typed, doorbell and turn_authority tests pass unchanged except fixtures that now lay a turn.
  • Checked locally: full herdr-core nextest, clippy -p herdr-core --all-targets, cargo fmt, check-engine-boundary.py, check-core-touches-no-machine.py, check-capability-readers-off-lock.sh.
  • Not checked: no live run with a real agent at a hooks-review or trust screen. The change is a pure decision over facts the core already holds, so it was proven at the runtime layer. Linux and Windows run on PR CI only.
Verification record

…w status

The typed-input confirmation, the composer read before a retype and omp's turn record read Observation::projected_turn, the turn the row and the doorbell read; the composer read shares the doorbell's input gate (doorbell::unheld_turn, doorbell::takes_keys). A turn not laid yet keeps the last verdict for UNSETTLED_HOLD_MS at most.
…tled, with no timer

Drop the 5 s cap: a stale read or an unlaid pass keeps the verdict the doorbell's last pass reached for that typing (plans.input_verdicts), which the row's ask and hide agent show both read; the next agent list or the pane leaving ends it.
… typing

A pass that sees the core's turn working since after the typing, with no input routed to the pane and no letter bell typed there since, remembers that typing as taken (plans.input_turn_started); an empty composer then holds with turn_started, while the parent's notice and the Enter for a brief still in the composer stay.
…omp's

A latched turn-started brief is recorded with by: turn, so its parent is not told, its row asks nothing and agent show lists nothing; only a turn the agent's own hook reports latches (TurnProjection::reported), never Herdr's reading alone. The separate retype hold is gone.
@yansfil
yansfil merged commit 9f23328 into main Nov 1, 2026
34 checks passed
@yansfil
yansfil deleted the fix/typed-input-reads-projected-turn branch November 1, 2026 07: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.

1 participant