room: steer mid-turn chat to the next step boundary
ci / checks (pull_request) Successful in 51s
ci / test (pull_request) Successful in 54s
ci / chart (pull_request) Successful in 4s
ci / web (pull_request) Successful in 16s
ci / docker (pull_request) Successful in 1m42s
ci / publish-edge-image (pull_request) Skipped
ci / publish-edge-chart (pull_request) Skipped

A message posted without a mention while the agent worked waited for the
next turn, so the model read it only once the work the line was about was
finished. The spec's turn rules already promised the mid-turn half ("the
next step of the running turn"); the runner implemented the turn-boundary
half only.

The turn now hands the framework a steering source. The driver drains it
between two steps and appends one User-role message per drain, so the line
lands in the history without the step in flight dying. The drain stops at
the first line it cannot carry -- a mention, which the drop path owns, or a
message with images, which a line cannot -- and leaves the cursor there, so
the boundary pass appends them in the log's order. What it drains advances
`absorbed_seq`, so nothing is appended twice.

A mention still drops the turn: that is the only way to stop a running
command, and this change does not touch it.
This commit is contained in:
kosmos committed 2026-12-02 13:18:14 +00:00
1 parent 2e17e7463c
commit d310735c71
4 files changed
+123 -12

No files matched your search

+14 -1
View File
@@ -190,6 +190,16 @@ an `absorbed_seq` cursor, so nothing is appended twice. The cursor
advances on every append, whatever the path, so the boundary pass and
the interrupt path cannot both write the same line.
The mid-turn half of that is the framework's steering hook
(`HostAgentConfig::steering`), not a step-level drop: the turn's
`RoomSteering` source hands the driver one User-role line per drain at a
step boundary, so a member can correct the agent while it works without
the step in flight dying. It stops at the first line it cannot carry —
a mention, which the drop path owns, or a message with images, which a
line cannot — and leaves the cursor there, so the boundary pass appends
them in the log's order. What steering still cannot do is stop a running
command: only the mention drop does that, and only between steps.
A burst of mentions that lands before the first drop completes all goes
into the same restart, in order, one message each. Nothing is folded.
@@ -663,7 +673,10 @@ Backups: the SQLite file (attachments included) and the secret key.
Small and additive, in the framework's own terms:
1. `HostAgent::step` plus the turn setup around it, so a frontend can own
the loop and drop one step. `rhema-code` steers at turn level: it
the loop and drop one step. The steering hook covers the common case
today: chat lands at a step boundary without a drop. A drop is still
what stops a long command, and it still costs the whole turn.
`rhema-code` steers at turn level: it
drops the whole turn future and starts a new turn with the nudge on
the same agent and session (`turn.rs`). That is enough for a
single-user TUI, where a turn boundary is a ledger row. A room wants