Skip to content

fix: a worker session no longer vanishes without a record (lets-11zwo) - #186

Merged
restarter merged 15 commits into
mainfrom
lets-11zwo-a-worker-session-can-vanish-leaving-no-record-and-noth
Sep 22, 2026
Merged

restarter merged 15 commits into
mainfrom
lets-11zwo-a-worker-session-can-vanish-leaving-no-record-and-noth

Conversation

@restarter

Copy link
Copy Markdown
Owner

Summary

A worker session could finish or vanish leaving no record, and nothing noticed: lets-g5wuz and lets-cbmg7 shipped (#184, #185) and their sessions left no snapshot, no released- marker, nothing that surfaced them. The same session model (stable session id, changing pid and terminal) also broke on resume: lets peers tell to an orchestrator resumed with claude -r failed peer_unreachable while lets peers orchestrator reported it alive.

Why the archive hook never fired

Orca never archived those two worktrees. gh 2.101.0 (installed 2026-09-15) includes cli/cli#14007 (gh >= 2.99): gh pr merge --delete-branch, run from another checkout, removes the head branch's linked worktree itself. Orca's trace (~/Library/Application Support/orca/logs/main.trace.ndjson.1) has no worktree.remove / archive_hook span for either; each worktree vanished one second after its merge (#185 10:19:39Z -> cbmg7 PTYs killed 10:19:40Z; #184 10:33:15Z -> g5wuz 10:33:16Z), while every Orca "Delete" in this repo ran the hook, second-exact with its marker. Their task-state files are still in .lets/sessions/ - release never ran. /lets:done's own merge is not this path: gh never removes the current or main worktree.

What changes

  • Session record. A snapshot records the full HEAD it covers (- head: <sha>, 40 or 64 hex); /lets:done writes one before its final gate, whatever is picked.
  • lets worktree record --task <id>... [--ref]. Per task: present / stale / missing by git ancestry (never by time; legacy -snapshot-precompact files still read), the local traces (task-state files, refs/heads/ branches), live worktrees, the marker, and orphan. An incomplete inventory fails instead of answering orphan=false.
  • /lets:start --main offers orphans (in progress, a local trace, no worktree, no marker) in Reopen next to archived claims.
  • release writes its marker (now with snapshot=) first, then compare-and-deletes the task-state file under its lock (taskstate.RemoveIfTask) - a file that changed meanwhile, an unreadable one or an invalid id is kept, with the reason in released.task_state_kept. A missing record, a failed marker or a kept file prints a lets: line on stderr (even with --quiet) and fires lets notify.
  • taskstate temps moved to .tasktmp-*: .task-<slug>.<digits>.tmp is also the state file of a legal branch (feature.12345.tmp), which Remove used to delete as a stranded temp.
  • Rule (lets-rules ## Worktrees): a worker's PR merged from another checkout goes without --delete-branch, only after record shows present; archive in Orca afterwards.
  • Resumed sessions (peerscmd): one peer per session id - two live pids, counted machine-wide, are session_duplicated; a binding resolves to the live holder of the name, else the one role file registered under it (bound_ambiguous on a tie); tell reports why it cannot reach (state); lets peers tail <name>.

Review

The plan went through three Codex review rounds and the branch through two; every finding was checked against the code, the confirmed ones are folded in, and the two answered differently are argued in the plan's Key Decisions. TestResume_NewPidNewName is intentionally RED at eaf120f (it reproduces the renamed-resume mismatch) and green from 942d519.

Test plan

  • make test (race) - green
  • make lint - 0 issues
  • cd cli && GOOS=windows go vet ./internal/cli/ - clean
  • ./cli/lets worktree record --task lets-cbmg7 --task lets-g5wuz --json - both show their surviving task-state trace, no worktree, no marker, record=missing, orphan=true (the vanished state, now visible)
  • Owner smoke, resume: bind a worker to a throwaway orchestrator (claude --model opus, /rename SMOKE-ORC, /lets:start --main), /lets:orc ping hi from the worker; close the orchestrator tab, claude -r <sid> in a new Orca pane, ping again - expect delivery via the claude route, or a named refusal at resolution (session_duplicated when the old process still runs, target_in_other_repo when resumed from another directory), never alive then peer_unreachable
  • Owner smoke, archive: in a throwaway Orca worktree with a claimed task and no snapshot, press Delete - expect the stderr/notify alarm and a marker ending |snapshot=missing

Task

lets-11zwo: A worker session can vanish leaving no record, and nothing notices

🤖 Generated with Claude Code

restarter and others added 15 commits September 22, 2026 22:25
Task-state temps move to .tasktmp-* so no temp shares the .task- namespace
with a legal slug; an incomplete trace inventory fails instead of answering.

Task: lets-11zwo

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Task: lets-11zwo

Co-Authored-By: Claude Opus 5.5 <[email protected]>
TestResume_NewPidNewName reproduces the renamed-resume mismatch and goes
green with the next commit (bound match by registered name).

Task: lets-11zwo

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The live holder of the bound name wins; a registered-name fallback that
finds several sessions refuses with bound_ambiguous instead of picking one.

Task: lets-11zwo

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Task: lets-11zwo

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Task: lets-11zwo

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A 64-hex head from a SHA-256 repository anchors like a SHA-1 one, and a
snapshot is matched by its exact artifact name, so lets-a never owns
lets-a-snapshot-v2's record.

Task: lets-11zwo

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Task: lets-11zwo

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The exact-name filter now accepts the -snapshot-precompact suffix older
sessions wrote, so such a task reads stale, not missing.

Task: lets-11zwo

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@restarter
restarter merged commit 7b38276 into main Sep 22, 2026
3 checks passed
@restarter
restarter deleted the lets-11zwo-a-worker-session-can-vanish-leaving-no-record-and-noth branch September 22, 2026 21:54
restarter added a commit that referenced this pull request Sep 23, 2026
Keep both [Unreleased] Fixed entries: lets-11zwo's two from #186 and
lets-l6ah9's /lets:commit staged-review entry.

Task: lets-l6ah9

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@restarter restarter mentioned this pull request Sep 23, 2026
restarter added a commit that referenced this pull request Sep 23, 2026
Version bump for v0.9.2. `make bump VERSION=0.9.2` edited the
version-source files plus the two shipped tracker adapters, renamed
`[Unreleased]` to `[0.9.2]`, and committed only after `make test`, `make
build` and `verify-versions` passed.

**Rebuilt.** The first cut of this branch was taken at `58e2441`, before
lets-f8x54 landed. Rather than let that fix fall under a fresh empty
`[Unreleased]` and miss the release, the branch was recreated from main
at `514afff` and the bump re-run, then force-pushed. The 0.9.2 section
now carries all 15 entries of this round.

What ships: `--fix` across check / review / handoff (#189), the
implementers run mode and `/lets:execute` picker change (#187), handing
an approved plan to an agent tab (#184), `lets worktree record` and the
vanished-worker fix (#186), the peers reachability batch (#185),
`/lets:orc --yes` (#183), the language-rule split (#188), and a peer
role that survives a changed session id (#191).

Known defects shipping with this release, stated deliberately rather
than discovered later: `/lets:done` still creates a duplicate PR when
one is already open (lets-0g49b); the session boundary still breaks on a
branch reused after its PR merged (lets-2t5ns); worktree provisioning
correctness (lets-41cpf) and parallel implementers (lets-7dwc1) are
unfinished. None is new, and none is made worse here.

After merge: `make release-tag VERSION=0.9.2`, then curated release
notes.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
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