change begin: add --resume for an existing agent branch #230

Merged
vnprc merged 1 commit from agent/begin-resume into master 2026-09-27 01:24:52 +01:00
Member

allod change begin --resume <description> <repo> picks up an agent/<description> branch that already exists on origin. It creates the same worktree under ~/changes that -d does, on a local branch that starts from and tracks the remote one, so record and submit continue the branch instead of starting a new one. It writes the same allod-change-branch handoff file -d writes; note that nothing reads that file yet (allod/tools#118 is the reader), so the continuation rests on the tracking branch, not on the file. It refuses when the branch is missing on origin, when a local branch of that name already exists, or when -d is also given. The -d path itself is unchanged, and no other change subcommand is touched. The shell suite proves each of those, and the flake's go-checks passes. If it is wrong, revert the one commit; the flag simply disappears.

Closes allod/tools#229

What changes

  • cmd/allod/change.go: begin parses --resume <description>. The start ref becomes a single start variable: the default branch for -d, the agent branch itself for --resume. The existing fetch, worktree add -b <branch> origin/<start>, and handoff-file write are shared; git sets the upstream because the start point is a remote-tracking ref.
  • cmd/allod/main.go: usage line and a paragraph for --resume.
  • README.md: a paragraph and example beside the -d flow.
  • tests/allod-change.sh: 19 new assertions. The resume fixture pushes the agent branch from a throwaway clone so the shared checkout holds no local agent/* ref, matching a branch another session started.

Risk

R1. One new flag on a code path that only creates a worktree and a local branch. Every collision case refuses before worktree add runs, and the worst credible failure after validation is a refusal with the wrong message. Rollback is a straight revert.

Validation

  • nix build .#checks.x86_64-linux.go-checks: passed. That runs go test for every package and tests/allod-change.sh against the built binary.
  • tests/allod-change.sh against a local build: 217 tests passed, 19 of them new. Covered: resume of an existing remote branch lands under ~/changes, checks out the agent branch at the remote commit, tracks origin/agent/<desc>, writes the handoff file, leaves the shared checkout on master; record from the resumed worktree pushes additively; refusal and no worktree when the branch is missing on origin; refusal and no second worktree when the branch exists locally; refusal of -d with --resume in either order; refusal of --resume without a value.
  • gofmt -l and go vet ./cmd/allod/: clean.
`allod change begin --resume <description> <repo>` picks up an `agent/<description>` branch that already exists on origin. It creates the same worktree under `~/changes` that `-d` does, on a local branch that starts from and tracks the remote one, so `record` and `submit` continue the branch instead of starting a new one. It writes the same `allod-change-branch` handoff file `-d` writes; note that nothing reads that file yet (allod/tools#118 is the reader), so the continuation rests on the tracking branch, not on the file. It refuses when the branch is missing on origin, when a local branch of that name already exists, or when `-d` is also given. The `-d` path itself is unchanged, and no other `change` subcommand is touched. The shell suite proves each of those, and the flake's `go-checks` passes. If it is wrong, revert the one commit; the flag simply disappears. Closes allod/tools#229 ## What changes - `cmd/allod/change.go`: `begin` parses `--resume <description>`. The start ref becomes a single `start` variable: the default branch for `-d`, the agent branch itself for `--resume`. The existing fetch, `worktree add -b <branch> origin/<start>`, and handoff-file write are shared; git sets the upstream because the start point is a remote-tracking ref. - `cmd/allod/main.go`: usage line and a paragraph for `--resume`. - `README.md`: a paragraph and example beside the `-d` flow. - `tests/allod-change.sh`: 19 new assertions. The resume fixture pushes the agent branch from a throwaway clone so the shared checkout holds no local `agent/*` ref, matching a branch another session started. ## Risk R1. One new flag on a code path that only creates a worktree and a local branch. Every collision case refuses before `worktree add` runs, and the worst credible failure after validation is a refusal with the wrong message. Rollback is a straight revert. ## Validation - `nix build .#checks.x86_64-linux.go-checks`: passed. That runs `go test` for every package and `tests/allod-change.sh` against the built binary. - `tests/allod-change.sh` against a local build: 217 tests passed, 19 of them new. Covered: resume of an existing remote branch lands under `~/changes`, checks out the agent branch at the remote commit, tracks `origin/agent/<desc>`, writes the handoff file, leaves the shared checkout on master; `record` from the resumed worktree pushes additively; refusal and no worktree when the branch is missing on origin; refusal and no second worktree when the branch exists locally; refusal of `-d` with `--resume` in either order; refusal of `--resume` without a value. - `gofmt -l` and `go vet ./cmd/allod/`: clean.
allod change begin --resume <description> creates the same worktree under
~/changes that -d does, but on a local agent/<description> that starts
from and tracks origin/agent/<description>, and writes the same
allod-change-branch handoff file so record and submit continue the branch.
It refuses a branch missing on origin, a branch already present locally,
and -d combined with --resume; the -d path is unchanged.

The shell suite covers the resume itself, the tracking ref, the handoff
file, an additive record on the resumed branch, and each refusal.

Refs allod/tools#229
vnprc approved these changes 2026-09-27 01:24:46 +01:00
vnprc merged commit 5dc53a255b into master 2026-09-27 01:24:52 +01:00
vnprc deleted branch agent/begin-resume 2026-09-27 01:24:52 +01:00
Sign in to join this conversation.
No description provided.