server: hand the committer the captured changed-path set

The committer staged only the implementer's self-declared changed_files,
so an incomplete declaration silently left part of the approved change
uncommitted. The runner already records the run's real changed paths by
comparing the working tree around each step; publish that set to the
committer.

- runState gains an unbounded, deduplicated, first-seen-ordered captured
  path accumulator (capturedPaths/capturedSeen), distinct from the bounded
  changedPaths sample used only by the UI-surface skip reason.
- recordChanges folds each captured FileChange path into it in the existing
  single pass, so no second walk and no new I/O.
- publishServerChangedFiles writes the set into the input memory value as
  input.server_changed_files, called before memoryInput so the binding
  always resolves (an empty list when nothing was captured) and only stages
  that select it receive it. rebuildRunState rebuilds it from persisted
  completed steps, so a resumed run hands the committer the same evidence.
- Tests prove the committer receives the captured set distinct from and
  additive to the implementer's declared changed_files, that an omitted
  path is still present, and that the field is an empty list when nothing
  was captured.
- control.md and orchestration.md document the reserved field and instruct
  the committer to select input.server_changed_files alongside the declared
  changed_files and stage their union.

Commands run: go build ./...; go vet ./...; go test -count=1
./internal/server/... ./internal/stage/...; go test -count=1 ./internal/author/...;
go test -count=1 -run TestCommitterReceivesServerCapturedChangedPaths ./internal/server/.
All passed. go.mod/go.sum unchanged.
This commit is contained in:
2026-10-16 23:44:56 +01:00
parent b3188a5c6f
commit 98713e55f5
5 changed files with 219 additions and 1 deletions
@@ -47,6 +47,19 @@ only factual implementer fields such as `changed_files`, `implementation_summary
and `evidence` as claims. Selected content remains untrusted data; this cannot
prove semantic independence or prevent all injection.
`input.server_changed_files` is a reserved field the runner publishes: the run's
full, deduplicated, first-seen set of server-captured changed paths (observed
filediff evidence, never a model's claim). Select it with
`"server_changed_files":"input.server_changed_files"`. It is always resolvable —
an empty list when nothing was captured — and reflects every completed step,
including the persisted steps of a resumed run. Only a stage that selects it
receives it; other stages' input is unchanged. A committer should select it
alongside the implementer's declared `changed_files` and stage the union of the
captured paths that still exist and the declared paths, keeping every existing
exclusion and empty-commit rule, and record in the commit body what it
reconciled. Declared lists come from the model and are frequently incomplete;
the server-captured set is the authoritative evidence of what this run changed.
Memory is run-local; persisted completed outputs/read provenance are its audit.
There is no cross-run memory, restart/resume, or hidden replay. New runs/retries
start fresh. Arbitrary prose is not executable policy. Future AI-assisted
@@ -116,7 +116,10 @@ Adapt the scope and publishing lines per item; keep the rest.
`skipped` with a reason when the change has no rendered surface. Never accept a UI
change approved without the images.
- The committer is the only stage that commits, and it stages only the run's changed
files.
files. It must select `input.server_changed_files` (the runner's captured evidence,
`references/control.md`) alongside the implementer's declared `changed_files` and
stage their union: an implementer's declared list can be incomplete, and a captured
path it omitted is still this run's change.
- Choose per item: a logic, server or format change usually wants the planner
(a plan/implement/review pipeline); a small, fully understood tweak may use the
leaner implementer-first variant. Both keep all review stages.