Skip to content

fix(daemon): settle a Run fork's dispatched shimmer when the fork closes#940

Merged
edwin-zvs merged 1 commit into
mainfrom
fork-close-settles-shimmer
Jul 22, 2026
Merged

fix(daemon): settle a Run fork's dispatched shimmer when the fork closes#940
edwin-zvs merged 1 commit into
mainfrom
fork-close-settles-shimmer

Conversation

@edwin-zvs

Copy link
Copy Markdown
Contributor

Problem

Follow-up to #935: the fork self-archives when its task is done, but the annotated selection keeps shimmering. The prompt's "settle before archiving" step is unenforced, and the owner run's auto-clear only fires on the owner's terminal state — which never comes for fork-executed runs. Result: a closed fork, a block shimmering forever.

Fix

Deterministic daemon-side backstop (spec 0076):

  • program.execute now records each Run fork's dispatch (owner session id + the annotated anchor) in a run_fork_dispatches map — the Run-fork sibling of pending_verb_merges.
  • archive and delete of a tracked fork settle the shimmer of its dispatched blocks directly against the run's pending set (mirroring settle_verb_shimmer), covering self-archive, the auto-close path, and manual archive/delete alike. The entry is consumed on first close, so archive-then-delete settles once.
  • Drift-proof: a fork typically rewrites its blocks while working, advancing their content ids past the dispatch anchor — those blocks are caught by scanning the live document for the fork's @{session:<id>} clip, which travels with the block.
  • The forked-run prompt is tightened into an explicit two-step finish: a final settle construct_program_edit, then the archive call — "Never archive before the settle edit has succeeded." The backstop guarantees the outcome either way.

Verification

  • cargo test --workspace green after fixing the feat(daemon): Run forks self-archive when their dispatched task completes #935 prompt-phrase assertion to the new wording (only failure in the run; daemon lib re-run 259/259).
  • New unit test run_fork_close_settles_dispatched_shimmer_even_after_drift — drifted block text + surviving clip still settles; tracking entry consumed.
  • e2e program_selection_fork_run_delivers_and_submits_prompt extended: archiving the fork (which never made a settle edit) leaves the owner run with zero pending blocks, observable immediately after the archive call returns.

🤖 Generated with Claude Code

A self-archived Run fork left its annotated block shimmering forever:
the prompt's settle-before-archive step is unenforced, and the owner's
run only auto-clears on the OWNER's terminal state — which never comes
for fork-executed runs.

Deterministic backstop (spec 0076): program.execute now records each
fork's dispatch (owner id + annotated anchor); archive and delete of a
tracked fork settle the shimmer of its dispatched blocks directly
against the run's pending set, mirroring settle_verb_shimmer. Blocks
whose text drifted while the fork worked are caught by scanning the
live document for the fork's @{session:<id>} clip. The prompt is also
tightened into an explicit two-step finish (settle edit, then archive).
@edwin-zvs
edwin-zvs merged commit 3525ab0 into main Jul 22, 2026
1 check passed
@edwin-zvs
edwin-zvs deleted the fork-close-settles-shimmer branch July 22, 2026 04:23
@edwin-zvs edwin-zvs mentioned this pull request Jul 22, 2026
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