Resume: update the working copy's remote branches first; say when -review is skipped #41

Merged
dario merged 1 commit from dario/resume-fetch into main 2026-11-20 13:59:40 +01:00 AGit
Owner

Evidence

On #28, after #38–#40 were merged, factory resume on run 20261120-125020-implement-issue-dario-factory-27-… started a session in which the model found no merge conflict. The branch should conflict with main in internal/config/config_test.go.

The resumed working copy still had origin/factory/issue-27-… and origin/main at 856bb43: the remote branches from when the run started at 12:50. So git merge origin/main correctly answered "Already up to date". The agent can't fetch itself, because the working copy has no credentials. Afterwards -review was skipped without a word, because the run didn't succeed.

Changes

  • internal/dispatch: a resumed run first updates the working copy's remote branches (origin/*, without origin/HEAD) to the forge's current state.
    • The factory clones the forge into the run's private directory and fetches from that clone. The credentials never meet the working copy's git configuration, which the agent could have changed (e.g. url.*.insteadOf, http.proxy).
    • Local branches and uncommitted changes are untouched.
    • If the update fails, it's a warning and the session still starts.
  • cmd/factory: when -review is set and the run didn't succeed, the factory logs "not reviewing: -review runs only after a successful run", with the status.
  • Docs: README (take over a run) and docs/developing-the-factory.md.

Test evidence

  • just check: passes (gofmt, vet, staticcheck, govulncheck, go test -race ./...)
  • New TestResumeUpdatesRemoteBranches: main moves on the forge while a run waits to be resumed, and the resumed session's origin/main must equal the forge's. With the fetch pointed elsewhere, it fails: origin/main … = 79914a0…, want the forge's cb3051f….

🤖 Generated with Claude Code

## Evidence On #28, after #38–#40 were merged, `factory resume` on run `20261120-125020-implement-issue-dario-factory-27-…` started a session in which the model found no merge conflict. The branch should conflict with main in `internal/config/config_test.go`. The resumed working copy still had `origin/factory/issue-27-…` and `origin/main` at `856bb43`: the remote branches from when the run started at 12:50. So `git merge origin/main` correctly answered "Already up to date". The agent can't fetch itself, because the working copy has no credentials. Afterwards `-review` was skipped without a word, because the run didn't succeed. ## Changes - `internal/dispatch`: a resumed run first updates the working copy's remote branches (`origin/*`, without `origin/HEAD`) to the forge's current state. - The factory clones the forge into the run's private directory and fetches from that clone. The credentials never meet the working copy's git configuration, which the agent could have changed (e.g. `url.*.insteadOf`, `http.proxy`). - Local branches and uncommitted changes are untouched. - If the update fails, it's a warning and the session still starts. - `cmd/factory`: when `-review` is set and the run didn't succeed, the factory logs "not reviewing: -review runs only after a successful run", with the status. - Docs: README (take over a run) and `docs/developing-the-factory.md`. ## Test evidence - `just check`: passes (gofmt, vet, staticcheck, govulncheck, `go test -race ./...`) - New `TestResumeUpdatesRemoteBranches`: main moves on the forge while a run waits to be resumed, and the resumed session's `origin/main` must equal the forge's. With the fetch pointed elsewhere, it fails: `origin/main … = 79914a0…, want the forge's cb3051f…`. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
A resumed run reused its working copy with the remote branches from when
it started, so merging origin/main brought in nothing that was merged
since. The factory now clones the forge into a private directory and
fetches its branches from there, so the credentials never meet the
working copy's git configuration.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
dario merged commit 2c3b702fa4 into main 2026-11-20 13:59:40 +01:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
dario/factory!41
No description provided.