Document review complete (headless mode).
Applied 1 fix:
- U2 Files: added
internal/adapter/contract/schema/initialize.json (schema-parity tests enforce exact key parity with the struct) and made pkg/adapterkit/types.go unconditional — it does mirror InitializeParams (feasibility)
Proposed fixes (concrete fix, requires user confirmation):
[P1] Section: R10 / U6 — Update's reachability check is vacuous as specified (feasibility, adversarial, +1 anchor → 100)
Why: The existing defense checks IsAncestor(targetSHA, ref-tip), but in the update flow the target SHA is the freshly resolved ref tip — always true by construction. The plan ships a supply-chain defense that can never fire at exactly the moment the trust anchor moves, and the U6 force-push test scenario is unwritable as specified.
Suggested fix: Respecify R10 as a fast-forward guard in the other direction — IsAncestor(oldPin, newSHA) on the fetched mirror. On failure, refuse with a rewritten-history warning requiring a distinct explicit override flag (not the routine acceptance flag), rendering both SHAs. Rename the U6 scenario to "non-fast-forward (history rewritten): refused."
[P1] Section: R7 / U6 — Post-re-pin sync failure leaves undefined inconsistent state (scope-guardian, adversarial, +1 anchor → 100)
Why: The manifest write happens before engine.Sync and outside the run lock, so a sync failure (or lock contention from a concurrent sync) after a successful re-pin produces exactly the state R7 claims cannot exist: trust anchor advanced, files stale, no defined remediation. U6's scenarios cover every refusal path except this one.
Suggested fix: Acquire the per-workspace run lock before WriteResolvedSHA so write+sync are covered by one lock; scope R7's byte-identical guarantee to "any failure before the gate passes"; define the post-re-pin sync-failure outcome (distinct exit code + "pin moved, files did not land — re-run agent-sync sync" message) and add the test scenario.
[P1] Section: KTDs / U2 / U3 — Header source URL not required to be credential-stripped (security-lens, 75)
Why: The plan plumbs SourceURL from the manifest layer without specifying the canonicalized form. cache.Canonicalize exists precisely because the raw URL can carry userinfo/query-string tokens; skipping it bakes credentials verbatim into the Source: header of every emitted file in every workspace — a far wider distribution surface than the audit trail the stripping was built for.
Suggested fix: Require engine.Request.SourceURL to carry the already-canonicalized URL (the value materialize computes via cache.Canonicalize), never the raw manifest field, plus a test asserting a token-bearing manifest URL never appears in a rendered header.
[P1] Section: R7 / U6 — Update confirm shows SHA pair only, no content context (security-lens, 75)
Why: The confirm gate is the sole human checkpoint before the trust anchor moves, and no one can evaluate 40 hex characters for maliciousness — the "deliberate act" the plan relies on becomes a reflexive rubber stamp.
Suggested fix: Extend the interactive confirm to print a change summary from the local mirror ( / ) alongside the SHA pair.