fix(stella-cli): stop a worker mirroring its private board over the lead's tasks rows (#1708) - #1967
Merged
Merged
Conversation
…ead's tasks rows A sub-session worker's closeout wrote its own task board into the shared tasks table under the LEAD's session id. At UNIQUE(session_id, task_id) the worker's ordinal "1" upserted over the lead's unrelated task "1", and the write ran on the worker's own thread where /clear's driver-side seal (#1692) cannot reach, so a pre-clear worker repopulated the mirror the user destroyed. The fix is subtraction: a worker's private board is scaffolding for its one run, and the driver already mirrors the lead's board at both of its own write sites. The worker closeout moves to subsession/closeout.rs — a seam whose signature takes no session id, so it structurally cannot address session-keyed rows — and two witness tests drive that production path against a real store. Closes #1708
Contributor
There was a problem hiding this comment.
Sorry @macanderson, you have reached your weekly rate limit of 500000 diff characters.
Please try again later or upgrade to continue using Sourcery
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
Contributor
Reviewer's GuideRefactors worker closeout handling to remove worker task-board mirroring into the shared session tasks table, centralizing session task persistence in the driver and adding a dedicated closeout module with witness tests to prevent regressions in task-board corruption and /clear seal bypass. Sequence diagram for worker closeout and session task board writessequenceDiagram
participant WorkerThread as run_worker
participant Closeout as closeout_close_worker_execution
participant Driver as SubSessions_driver
participant Store as Store
WorkerThread->>Closeout: close_worker_execution(execution, registry, files_before, label, cost, persistence_complete)
Closeout->>Store: record_execution_end
Driver->>Store: record_task_board(lead_execution_id, session_id, items, now_ms)
Driver->>Store: clear_session_tasks(session_id)
Driver->>Store: seal_task_board
Driver->>Store: settle_worker_task
note over WorkerThread,Store: Worker closeout no longer calls record_task_board;
note over Driver,Store: Driver is now the sole writer of session tasks rows
File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
This was referenced Aug 7, 2026
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.
What
A sub-session worker's closeout wrote its own private task board into the shared
taskstable under the lead'ssession_id(crates/stella-cli/src/subsession.rs,run_worker). At the table'sUNIQUE(session_id, task_id)key that write was pure corruption, twice over:/clearseal bypass (A sub: worker that finishes after /clear still mutates the task board of the conversation that was cleared #1692) — the seal that quarantines pre-clear workers lives on the driver (SubSessions::seal_task_board→session_clear::settle_worker_task); this write ran on the worker's own thread where no seal can reach, so a pre-clear worker repopulated the mirror the user destroyed.The decision (of the three shapes in #1708)
Drop the write — the shape #1708's investigation identified as the only one that fixes both defects alone:
tasksqueries see sub-agent boards too") is unachievable at this key — neither reader (Store::list_session_tasks, the Observatory's sessions query) can distinguish a worker row from a lead row.command_deck.rs, worker settlement insession_clear::settle_worker_task)./clearseal airtight rather than advisory, because the driver becomes the session mirror's sole writer.The witness seam (the part #1708's investigation could not find)
The worker's store closeout moves to a new sibling module,
crates/stella-cli/src/subsession/closeout.rs— required anyway, sincesubsession.rssits 24 lines under the file-size gate's 1500-line ceiling and could not absorb tests.close_worker_executionis the exact production pathrun_workercalls, and its signature takes no session id, so the closeout structurally cannot address session-keyed rows.Two witness tests drive that seam against a real in-memory store:
a_workers_private_board_never_lands_in_the_sessions_tasks_rows— the lead's mirror survives a worker closeout byte-identical, the table row count is pinned too (so a NULL-session append can't hide), and the execution row still closes (so "fixed by deleting the closeout" can't pass).a_pre_clear_workers_closeout_cannot_repopulate_a_cleared_mirror— afterclear_session_tasks(the persisted half of/clear), a worker closeout leaves the mirror exactly as empty as the user made it.Fail→pass flip, demonstrated: the seam is new, so
git stashalone can't show the flip. Instead the pre-#1708 board mirror was temporarily grafted back intoclose_worker_execution(same write, keyed to the lead's session exactly asrun_workerwas) — both witnesses fail against the graft with the exact corruption #1708 describes ("the lead's mirror survives a worker closeout untouched" assertion trips), and pass with it removed. The graft was reverted before shipping.Verification
Measured on this branch with current
mainmerged in (head73f99926):cargo test -p stella-cli— 1456 pass, 0 fail, including both new witnessescargo clippy -p stella-cli --all-targets -- -D warnings— cleancargo fmt --check— cleanmake guards-fast(all 25 guards) — clean;file-sizereports "none grew" against main's regenerated baselineCI is red for reasons outside this diff
fmt + clippy + testfails on five breaks inherited frommain, none in a file this PR touches (the diff is 3 files, allstella-cli):unresolved link to SkipReason::NoResumePoint(daemon/boot.rs:59, added bya2806246/ #1939)too many arguments (8/7)(clippy)PassingShellnot foundshell_call_resultnot foundModelCallRole::Researchnot coveredThe last one is the root cause of three of these:
mainadded aResearchvariant tostella_protocol::ModelCallRolewithout updating downstream exhaustive matches. This branch point has noResearchvariant at all, which is why the break is provably inherited rather than caused.No competing unbreak is included here deliberately — duplicate PRs racing the same seam is how
maingets re-broken. This PR should go green once #1970 and #1971 land; it is already merged up to currentmainand conflict-free.No migration: the corrupted rows self-heal — the driver's next lead-board mirror upserts the colliding ordinals back to the lead's state, and
/cleardeletes the rest; stray rows beyond the lead's ordinal range in existing databases are dead rows in a table whose only production readers are per-session queries the driver now exclusively feeds.Exemplar for the shape: the pipeline's witness stage gives authored witnesses exactly this lifetime — scaffolding for one run, discarded with it — which is the model applied to a worker's private board here.
Filed, not fixed
lanecolumn + migration, routing through the driver, and a lane-aware reader, all three together; the issue scopes each and says why any one alone reintroduces a defect.Refs #1692, #1631.
Closes #1708