CommitAll discards its context and can stage and commit after task cancellation.
Confirmed still present on main: Manager.CommitAll (internal/worktree/worktree.go:387) takes _ context.Context and never reads it. Between entry and wt.Commit it performs AddWithOptions{All: true} and wt.Commit, neither of which is context-aware in go-git, so a task cancelled just before the call still mutates the index and HEAD.
Steps to Reproduce
Prepare a task worktree with uncommitted changes.
Create an already-cancelled context: ctx, cancel := context.WithCancel(context.Background()); cancel().
Call Manager.CommitAll(ctx, dir, "msg").
Observe it returns (true, nil): the index was staged and a new commit is on HEAD despite the context being cancelled before the call.
In production this leaves a commit on the task branch for work the operator cancelled, which the subsequent push/PR path can then publish.
Acceptance Criteria
A pre-canceled context causes no index or HEAD mutation; cancellation is checked between non-context-aware go-git phases where possible, with regression tests.
Acceptance criteria
A pre-canceled context causes no index or HEAD mutation; cancellation is checked between non-context-aware go-git phases where possible, with regression tests.
Close reason
Fixed: CommitAll now takes a live context and checks ctx.Err() before open, worktree, staging, status and commit (worktree.go:398-430), so a pre-cancelled context mutates neither index nor HEAD. Proven red against pre-fix code: 'CommitAll() error = nil, want context canceled' for both a cancelled context and an expired deadline. task check green; fresh adversarial review zero findings.
Imported from beads archie-core-1ysw.8 · GitHub #603 · type bug · priority P3 · created 2026-08-22 · closed 2026-08-24
CommitAll discards its context and can stage and commit after task cancellation.
Confirmed still present on main: `Manager.CommitAll` (internal/worktree/worktree.go:387) takes `_ context.Context` and never reads it. Between entry and `wt.Commit` it performs `AddWithOptions{All: true}` and `wt.Commit`, neither of which is context-aware in go-git, so a task cancelled just before the call still mutates the index and HEAD.
## Steps to Reproduce
1. Prepare a task worktree with uncommitted changes.
2. Create an already-cancelled context: `ctx, cancel := context.WithCancel(context.Background()); cancel()`.
3. Call `Manager.CommitAll(ctx, dir, "msg")`.
4. Observe it returns `(true, nil)`: the index was staged and a new commit is on HEAD despite the context being cancelled before the call.
5. In production this leaves a commit on the task branch for work the operator cancelled, which the subsequent push/PR path can then publish.
## Acceptance Criteria
A pre-canceled context causes no index or HEAD mutation; cancellation is checked between non-context-aware go-git phases where possible, with regression tests.
### Acceptance criteria
A pre-canceled context causes no index or HEAD mutation; cancellation is checked between non-context-aware go-git phases where possible, with regression tests.
### Close reason
Fixed: CommitAll now takes a live context and checks ctx.Err() before open, worktree, staging, status and commit (worktree.go:398-430), so a pre-cancelled context mutates neither index nor HEAD. Proven red against pre-fix code: 'CommitAll() error = nil, want context canceled' for both a cancelled context and an expired deadline. task check green; fresh adversarial review zero findings.
---
_Imported from beads `archie-core-1ysw.8` · GitHub #603 · type bug · priority P3 · created 2026-08-22 · closed 2026-08-24_
sam
added the lowbug labels 2026-10-27 13:34:41 +00:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
CommitAll discards its context and can stage and commit after task cancellation.
Confirmed still present on main:
Manager.CommitAll(internal/worktree/worktree.go:387) takes_ context.Contextand never reads it. Between entry andwt.Commitit performsAddWithOptions{All: true}andwt.Commit, neither of which is context-aware in go-git, so a task cancelled just before the call still mutates the index and HEAD.Steps to Reproduce
ctx, cancel := context.WithCancel(context.Background()); cancel().Manager.CommitAll(ctx, dir, "msg").(true, nil): the index was staged and a new commit is on HEAD despite the context being cancelled before the call.Acceptance Criteria
A pre-canceled context causes no index or HEAD mutation; cancellation is checked between non-context-aware go-git phases where possible, with regression tests.
Acceptance criteria
A pre-canceled context causes no index or HEAD mutation; cancellation is checked between non-context-aware go-git phases where possible, with regression tests.
Close reason
Fixed: CommitAll now takes a live context and checks ctx.Err() before open, worktree, staging, status and commit (worktree.go:398-430), so a pre-cancelled context mutates neither index nor HEAD. Proven red against pre-fix code: 'CommitAll() error = nil, want context canceled' for both a cancelled context and an expired deadline. task check green; fresh adversarial review zero findings.
Imported from beads
archie-core-1ysw.8· GitHub #603 · type bug · priority P3 · created 2026-08-22 · closed 2026-08-24