Skip to content

feat: hand an approved plan to an agent tab for execution (lets-g5wuz) - #184

Merged
restarter merged 6 commits into
mainfrom
lets-g5wuz-hand-an-approved-plan-to-an-agent-tab-for-execution
Sep 20, 2026
Merged

restarter merged 6 commits into
mainfrom
lets-g5wuz-hand-an-approved-plan-to-an-agent-tab-for-execution

Conversation

@restarter

Copy link
Copy Markdown
Owner

Summary

/lets:handoff gains --execute: a second brief kind that hands an approved plan to an agent tab of this worktree to IMPLEMENT, not to review. /lets:execute cannot be handed over - its gate is Claude Code's native plan mode and its Deviation gate runs before every edit - so the brief carries those rules in plain words instead of a pointer into the plugin.

The brief is the plan itself, prepended verbatim minus its STOP banner and closing reminder (an agent reading "never implement this plan directly" would rightly refuse), followed by a contract: implement task by task and run each Verify, commit at the plan's own commit points in this repo's convention, change only the files the plan names, stop and write the reason to the report instead of adapting, never push / open a PR / merge / touch the tracker, and finish with the report file. What comes back is relayed UNVERIFIED next to what git shows - each handed-over task against the commits that touched its files - and the next step is always /lets:review --branch.

/lets:handoff also names its three delivery lanes: --send [<tab>] (an open agent tab), --open [<agent>] (a new Codex tab - until now only a picker option), --codex (headless). --execute goes only through --send; --codex and --open are refused by name because both start read-only.

No Go production code: the banner is stripped by a positional awk filter inside the command markdown, and TestHandoffPlanFilter extracts that program and runs it against the real banner lines read from plan.md / plan-workflow.md, so a reworded banner fails the test instead of the feature.

Changes

  • 60ee9fe feat: add the --execute brief to /lets:handoff - parsing, refusals, plan facts, Step 5b
  • 0379639 feat: name three handoff lanes, relay execution - Step 7 lane table, --open, the new 7.5
  • b6e6373 test: pin execution brief and plan filter - TestHandoffExecuteLint, TestHandoffPlanFilter
  • d1662b1 feat: name handoff --execute as a way into code - workflow rules, execute.md pointer, install table
  • 8b348ac docs: document handoff --execute and lanes - CHANGELOG, CLAUDE.md, README, 5 docs pages
  • fa8e129 fix: close review findings in the execution brief - two review rounds plus a final check

Review trail

Three rounds, all findings verified against the code before fixing: an inline /lets:check --plan on the plan, a hand-off to an Antigravity tab via /lets:handoff --branch --send (4 findings, dogfooding the very lane this PR extends), and a final /lets:check that caught 2 more in the fixes themselves.

Not verified

The end-to-end live smoke has not been run - it needs an open agent tab in the worktree and real commits from that agent. In particular it is unverified whether a sandboxed Codex can git commit in an Orca worktree, whose git directory lives in the main checkout; the contract handles a failed commit by stopping and reporting rather than adapting.

Task

lets-g5wuz: Hand an approved plan to an agent tab for execution, not review


🤖 Generated with Claude Code

restarter and others added 6 commits September 20, 2026 12:29
Task: lets-g5wuz
Co-Authored-By: Claude Sonnet 5 <[email protected]>
Task: lets-g5wuz
Co-Authored-By: Claude Sonnet 5 <[email protected]>
Task: lets-g5wuz
Co-Authored-By: Claude Sonnet 5 <[email protected]>
The plan lookup skips idea documents, the scope covers Delete: paths, the
commit convention drops the scope and footer with no task, and the routing
line waits for the tab pick. In 7.5 the report signals are what Go actually
measures: HEAD says whether anything was committed, workspace_changed says
whether the uncommitted state left the shape the brief described. The filter
test now reads the real banner lines from plan.md and plan-workflow.md, so a
reworded banner fails the test instead of the feature.

Task: lets-g5wuz

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@restarter
restarter force-pushed the lets-g5wuz-hand-an-approved-plan-to-an-agent-tab-for-execution branch from fa8e129 to 5bf2684 Compare September 20, 2026 10:31
@restarter
restarter merged commit 88f53ac into main Sep 20, 2026
3 checks passed
@restarter
restarter deleted the lets-g5wuz-hand-an-approved-plan-to-an-agent-tab-for-execution branch September 20, 2026 10:33
restarter added a commit that referenced this pull request Sep 22, 2026
#186)

## 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

- [x] `make test` (race) - green
- [x] `make lint` - 0 issues
- [x] `cd cli && GOOS=windows go vet ./internal/cli/` - clean
- [x] `./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](https://claude.com/claude-code)

---------

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