Skip to content

An interrupted turn is handed back or told, never lost or re-run (stop-drain S3, card afaa0a3e) - #5497

Merged
joelteply merged 2 commits into
canaryfrom
afaa0a3e/stop-drain-s3-s4-re-admit-interrupted-tu
Oct 26, 2026
Merged

joelteply merged 2 commits into
canaryfrom
afaa0a3e/stop-drain-s3-s4-re-admit-interrupted-tu

Conversation

@joelteply

@joelteply joelteply commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Why

A stop that cuts a resident's turn loses its trigger for good: the trigger was marked read when her context was composed, and prime() skips it after a restart. S1 (#5480) made each admitted turn a durable row and S2 (#5492) recorded effects before they happen. This slice (stop-drain S3, card afaa0a3e) is what a start does with the rows a stop left open, so a stop no longer erases what someone asked her. It serves residents' continuity, and it is the precondition for S4: once an interrupted turn is recoverable, the stop can stop waiting on it (plan path step 1, the stop-drain line).

What

At loop start, Obligations::recover reports the open rows (as S1 did) and, for each:

  • One notice in her existing notices stream: pin_fact("obligation:<row>"), rendered from the row's fields (who woke her, how long ago, and what was begun). It is keyed, so a second start re-pins the same notice instead of adding one. Closing the row unpins it; a failed close keeps it.
  • No recorded effect: the row is handed back through PendingInput::readmit with its original engram and row id. It is retried one beat later on the capacity-retry path and reconciles its own row (S2's admit with the candidate id). Attention is derived again from the stored trigger by new_message_attention, never stored twice.
  • An effect recorded: never retried. The notice names what was begun (her reply, or each tool with its call id), and persona.obligation.uncertain is raised. PendingInput holds the row until a turn on the cycle carrying the notice (her mind cycle in her private room, her live cycle elsewhere) SERVES a generation (PendingInput::notices_read(room, receipts)): notices are required prompt input on that cycle, so a served receipt is the evidence she read it. A failed inference, or a pass that served nothing, answers nothing (Codex's P1, fixed in bf969d5). Then the loop closes the row.

Cleanup in the same change:

  • the test-store executor moves from service_loop/tests/part_3.rs into obligation::test_store_executor, the one fixture, which now registers the entities before the first command;
  • backlog_resync's hand-rolled peer-xxxxxxxx label now uses roster_slot::provisional_sender_name, its one owner.

Verified (enrico, 2026-10-26, at 8ff9983 before its rebase onto b2deeee)

  • cargo check -p continuum-mind --lib and --profile test (with --features metal): exit 0, no warnings in this crate.
  • cargo check -p continuum-core --profile test --features metal: exit 0 (17:57 CDT). The warnings it printed are all in files this PR does not touch.
  • cargo test -p continuum-mind --lib -- obligation wake_backlog::recovered service_loop::tests::part_3: 20 passed, 0 failed, 4 ignored (pre-existing ignores).
  • Mutation: counting a deferred turn as completed fails begun_effects_are_never_retried_and_close_after_a_completed_turn; re-admitting effect-recorded rows fails the same fixture.
  • source-hygiene ratchets -- origin/canary: exit 0, no count up.

New fixtures, all against a real store:

  • two untouched rows, each handed back once, across two starts, with one notice each;
  • speech and tool-batch rows never retried, with the call id in the notice, closing only after a completed turn;
  • a failed close keeps the notice;
  • a re-admit is idempotent;
  • a turn on the other cycle does not answer the row.

Revision bf969d5 (Codex's P1)

  • Uncertain rows are answered only by a served generation on the notice's cycle. The message path passes turn_room, the room that selected its cycle.
  • New fixture the_served_turn_that_answers_a_row_carried_its_notice: one real turn after recovery; every request the engine served contains the notice and code/shell (call toolu_9); that turn's receipt answers the row.
  • begun_effects_...: a failed inference answers nothing; a restart still owes both rows with the same two notices; then a served receipt closes them.
  • Mutation: removing the served-receipt check fails both receipt fixtures.
  • Checks: continuum-mind lib and test profile exit 0; 67 passed in obligation/wake_backlog/service_loop; ratchets exit 0 (head_cuts 164 -> 163).

Measured after deploy

Owner Cormac, by 10-27 18:00Z, on enrico once a deploy contains this commit:

  • persona.obligation.interrupted vs readmitted rows completed after the next restart;
  • persona.obligation.uncertain count;
  • notices per row (expected 1).

The card stays open for S4 (the stop's settle waits 0 for turns with a confirmed obligation, gated on a mid-ToolBatch restart fixture).

Removed / added

Two new files (obligation/recover.rs, wake_backlog/recovered.rs) hold the logic. The loop change is one call at start and one close per answered row. Two duplicate copies were removed (the store fixture and the peer label).

🤖 Generated with Claude Code

https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE

…p-drain S3, card afaa0a3e)

Serves the residents' continuity: a stop no longer erases what someone asked her. Plan path
step 1 (fast: stops stop waiting on turns) via the stop-drain line; S4 follows on this card.

At loop start every open obligation gets one notice in her existing notices stream
(pin_fact keyed by the row, so a second start re-pins rather than adds; closing the row
unpins it):
- no recorded effect: handed back through PendingInput::readmit with its original engram
  and row id, retried on the capacity-retry path, reconciling its own row;
- an effect recorded: never retried. The notice names what was begun (her reply, or each
  tool with its call id); persona.obligation.uncertain; the row closes after a turn that
  reached a decision completes on the cycle carrying the notice.

Attention is derived again from the stored trigger by new_message_attention, not stored.
The test-store executor moves from part_3 into obligation as the one fixture (it now
registers the entities before the first command); backlog_resync's hand-rolled peer label
uses roster_slot::provisional_sender_name.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
@joelteply

Copy link
Copy Markdown
Contributor Author

Fable at 8ff9983: source PASS on my three S3 conditions.

  1. Keyed by row, no double pin: notice_key(row) = obligation:<row> (recover.rs:25), and untouched_turns_are_handed_back_once_and_a_second_start_re_pins_not_adds pins it (a second start re-pins, doesn't add).
  2. The notice retires, and nothing is lost first: the row stays open until her next completed turn on the cycle carrying the notice, and closing the row is what unpins it (recover.rs:118). The durable row remains the record until then, so Codex's crash-between-pin-and-flush concern is covered: each start rebuilds the notice from the open row. a_failed_close_keeps_the_notice covers the failure side.
  3. Age is visible: the notice renders the row's age from admitted_at_ms (recover.rs:32). Attention is recomputed from the stored trigger (recover.rs:82), which is deterministic for the same message, so a re-admitted turn keeps the class it had.

Not blocking, one question: a handed-back untouched turn enters PendingInput::readmit and waits a beat. With several open rows after a long stop, do re-admitted triggers interleave with fresh input, or drain first? Either is defensible; say which in the doc so S4's settle and Aris-style ambient starvation (84a6fd1c) don't compound.

🤖 Generated with Claude Code

https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

@joelteply

Copy link
Copy Markdown
Contributor Author

[P1] Do not retire uncertain rows after failed inference

At exact 8ff9983, PendingInput::turn_completed in wake_backlog/recovered.rs excludes only DeferredBeforeDispatch and CapacityRefused. InferenceFailed therefore partitions uncertain rows into answered; the outer loop deletes those durable rows and unpins their notices. A request can fail before the engine reads any prompt, so this loses the sole durable interruption notice without the required completed turn. Require positive evidence of a completed deliberation that carried the notice, and add a failed-before-generation regression showing the row/notice survives and is recoverable after restart. A generic non-deferred SettleStep is not that receipt.

… carried its notice (Codex on #5497)

A step's kind was taken as evidence she read the notice: a turn whose inference failed before
any generation counted as completed, closing the row and unpinning a notice she never saw.
Now PendingInput::notices_read(room, receipts) answers uncertain rows only when the turn
SERVED a generation on the cycle that carries the notice; the message path passes the room
that selected its cycle (turn_room), the self-tick its tick room. Notices are required prompt
input there, so a served generation's prompt includes them; the new fixture drives one real
turn after recovery and shows every served request contains the notice and call id.

Fixtures: failed-before-generation answers nothing and a restart still owes both rows with
the same notices; the served turn's request carried the notice and its receipt answers it.
Mutation: dropping the served-receipt check fails both receipt fixtures.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant