Repository navigation
fix: start a fresh supervision branch for every main session - #3600
Merged
kunchenguid merged 3 commits intoSep 3, 2026
Merged
Conversation
The supervision branch reopened one recorded conversation forever, so every main session start reloaded the current generated prompt and then weeks of accumulated thread, where a superseded rule could still outweigh today's. The branch conversation is now scoped to one main session: the session generation owns the recorded conversation, so a cold start, /new, /resume, /fork, or a reload always builds a new one, while a rebuild inside one session (a model or effort change) still continues that session's own conversation. The dialog mirror re-anchors with it. Its durable cursor records what the previous branch conversation received, so a /resume or reload - which keeps main's own session file - would otherwise leave the new branch blind to dialog main itself still has. The reset is bounded by the current main session, and the cursor keeps advancing incrementally within it. The durable outcome store and its processed marker are untouched, so unacknowledged captain-facing outcomes still re-present on the new main session.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains. Reviews (2): Last reviewed commit: "no-mistakes(ci): Fixed the flaky concurr..." | Re-trigger Greptile |
…sition now retries when a competing lock disappears between a failed claim and inspection. Added a behavioral regression covering that race. Verified the full inbox test four times, project lint, and git diff checks
kunchenguid
deleted the
fm/fm-supervision-branch-fresh-on-session-start-r1
branch
September 3, 2026 09:09
Intent
Make the Pi supervision branch start a FRESH conversation on EVERY main session start, including /new, /resume, /fork, and reload, instead of reopening the persistent JSONL that had been the same file since 2026-08-24. Captain authorized this on 2026-09-03.
Problem: the persistent branch session was actively harmful. Each session start re-armed the extension generation and the next wake reopened the branch session recorded in state/.branch-session, so the branch reloaded today's generated prompt and then weeks of old thread, letting stale memory (for example an old 'any PR mention is captain-facing' rule) outweigh current verdict rules.
Intent: whenever MAIN goes through a session start, the supervision branch must start a NEW conversation, and the old JSONL must not be reopened as the live branch context.
Must keep, explicitly not regressed: the durable outcome store and processed marker, so captain-facing sequences still re-present until MAIN acknowledges; generation and lock ownership and the fallback-to-main path on a broken branch; the branch prompt still generated from bin/fm-branch-prompt.sh.
Deliberate decisions made while implementing:
Tests are colocated behavioral tests in tests/fm-pi-branch-extension.test.sh and assert observable behavior through the extension's real event and dispatch surface, never implementation source text: a new test proves a main session start (/new and a process restart) builds a NEW branch conversation and repoints state/.branch-session at it while a rebuild inside one session continues the same conversation, and a second new test proves the mirror re-anchor delivers the whole current main session's dialog to the new conversation and stays incremental afterwards. The old test that asserted reopen-from-pointer across restarts is gone, and the model-pin and effort-pin tests were re-targeted so their reopen-restore hazard is asserted on the intra-session rebuild path that still reopens. The stubbed SessionManager.create now names files per process so cross-restart file identity is observable.
Docs updated in their owners without duplicating the contract: docs/pi-supervision-branch.md (the contract owner: the per-main-session conversation, the mirror re-anchor, the cost model, and the verification list), docs/configuration.md (model and effort pins apply on the new conversation each session start opens and on the intra-session reopen), docs/supervision-protocols/pi.md, docs/verification/runtime-backends.md, AGENTS.md's state-layout line, and the extension's own header and inline comments.
Constraints: firstmate shared tracked material, so .agents/skills/firstmate-coding-guidelines applies - bin/fm-timeout-lib.sh stays the single owner of bounded execution, bash stays bash-3.2-safe for macOS, one sentence per line in tracked Markdown, plain dashes, and no co-author trailer on any commit. Delivery is no-mistakes with yolo off: the captain owns the merge, so stop at green CI and do not self-merge.
What Changed
Risk Assessment
✅ Low: The change is well-bounded, preserves durable outcome and fallback behavior, and correctly scopes branch conversations and mirror re-anchoring to each main-session generation.
Testing
An initial broad extension test invocation encountered an unrelated stock-rendering mismatch that also reproduces at the base commit; the focused lifecycle, durability, fallback, prompt-generation, generation, and lock-ownership tests passed, the regression failed on the base as expected, and the evidence transcript directly shows fresh files after session replacement/restart, same-file continuation within a session, pointer updates, retained old files, and mirror re-anchoring. No screenshot was captured because this is a non-visual session/state lifecycle change.
Evidence: Fresh branch conversation and mirror re-anchor behavioral transcript
Source: Fresh branch conversation and mirror re-anchor behavioral transcript
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
✅ **Review** - passed
✅ No issues found.
✅ **Test** - passed
✅ No issues found.
bash tests/fm-pi-branch-extension.test.sh(initial broad invocation stopped at an unrelated installed-Pi stock-rendering mismatch)Targetedtests/fm-pi-branch-extension.test.shselectors covering dispatch/prompt generation, durable outcomes, fallback, in-flight selection changes, mirror re-anchoring, fresh session creation, generation safety, and lock ownershipFresh-session regression test against base commite1d1d692674b3908092e480ca0dee1743d9951a6(failed as expected because it reopened the previous conversation)Instrumented behavioral evidence run fortest_branch_mirror_reanchors_for_the_new_session_branch_conversationandtest_branch_session_is_new_at_every_main_session_startBaseline stock-rendering check against base commite1d1d692674b3908092e480ca0dee1743d9951a6(reproduced the unrelated installed-Pi mismatch)✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.