spawn_dev.py should run session_state.py --init, so no dev ever meets it nf-oadu ← Beads

closed priority 2 task unassigned

Twinned from https://github.com/cfsh/ninefold/issues/837 by tools/beads/import_github.py's reconcile pass.

session_state.py --init is a session-start chore that every dev is told to run once, and it is the last thing in the PR loop that ./dev.py pr cannot do for them. It should not be a dev's job at all — the spawner should do it when it creates the worktree.

What it is for

--init creates tracked-prs.txt empty, and that is what makes NO-LEDGER mean exactly one thing: *something removed it*. Without it, a session is ABSENT from start until its first PR, so "absent" is ambiguous during that window. → notes/operating.md, *Where session state lives*.

Why the current mechanism is not enough on its own

Since #830, devcli.resolve_session() prints a note on every dev.py invocation while the file is missing:

``` ⓘ no ledger at /root/nf/tmp/<session>/tracked-prs.txt — absent is not empty (#618). Run: ./tools/pr/session_state.py --init ```

That is real and it fires at the moment it matters, but it is an advisory note, not a refusal — nothing is blocked, and a dev can ignore it for the whole window. Making it a refusal would be worse, not better: blocking dev.py pr on a session-start chore is a front door that locks on the commonest thing behind it (devcli.py's own C1 carve-out).

The change

tools/office/spawn_dev.py already creates the worktree, sets branch.autoSetupMerge=false and push.autoSetupRemote=true, and launches claude. Have it also run ./tools/pr/session_state.py --init in the new worktree. Then:

⚠️ Worth checking while in there: an adopted session (spawn_dev.py --adopt, or a worktree that predates this) does not go through the create path, so it needs the same call or the guarantee has a hole exactly where a session is least likely to be watched.

Provenance

@aedanpope on [#830](https://github.com/cfsh/ninefold/pull/830#issuecomment-5248791845), reading the claim that the note replaced --init: *"Do you mean on the first ./dev.py pr run, the dev will see an error and it will crash?"* — it does not, and answering that honestly is what surfaced that the concept should not reach a dev at all. Out of scope for #824 (dev.py pr), and tools/office/ is a different tier from the PR loop.

Unclaimed. Filed by nf-dev-dev-py-pr; not taking it.

Dependencies

None.

Comments

No comments.

Add a comment