Existing and product PR worktrees

Part of the reintegration policy. Its Markdown source preserves the detailed contract for this domain.

PR-backed integration

The caco pr namespace has three separate workflows. caco pr close --pr <N> [--project <project>] is the canonical explicit-close path: it re-reads exact provider state, head, and base before one provider close. A provider merge is not explicit close, and an already-closed PR is an idempotent no-op.

Ordinary project PR source updates

A running worker uses caco pr checkout <N> [--project <project>] to open an isolated checkout under its owning agent directory and outside the managed Git root, without spawning or adopting the historical author's runtime. Fresh defaults and operation records stay outside that repository; existing registered legacy paths are retained rather than relocated, and unregistered legacy evidence refuses a parallel default. Explicit launch options retain the new-agent path and its github_integration.enabled opt-in. caco pr adopt --pr <N> is also supported; --bead-id is optional attribution, not a transfer of the original author's claim.

The CLI authenticates the actual project-scoped agent against the daemon's configured head and target repositories; node credentials and a different project/actor are refused. Each worker owns its own checkout metadata, not a project-wide exclusive PR registry. Dirty files and unpublished commits in original checkouts remain untouched; ordinary source work needs no cleaning, upstream repair, old-owner liveness check, controller interaction, or hand-carried receipt. The bounded clone/partial-resume machinery and immediate-parent topology checks still apply.

After editing and committing, use caco pr push --worktree <path>. It checks actual origin, open PR identity, branch, cleanliness, ancestry, and remote head, then publishes the immutable commit with a Git head lease to the same branch/PR. Fetch and merge/rebase concurrent changes normally, resolve conflicts, and retry; another project worker's publication requires no ownership transfer. The publisher creates no replacement PR for changed authorship and invokes no second queue actor. The selected queue and required checks own delivery: a successful source push is not target-branch merge or bead completion.

Default/shared/provider refs, administrative merges, lifecycle transfers, and privileged non-fast-forward recovery are not granted by this source path.

Privileged repair adoption

caco pr adopt --repair retains its controller/transfer authorization, exact receipt, lease, and preservation requirements. It is not a prerequisite for ordinary project-authorized source updates.

Repair adoption re-reads live PR identity immediately before issuing its receipt, resolves the base OID from the configured PR-target remote, and records provider-projection and local-tracking freshness independently. For the configured root target, a stale provider base OID is diagnostic rather than checkout authority; provider base-ref races, configured-target mismatches, true apply-time retargets, provider outages, and stale receipts remain distinct typed refusals.

Adopted publication acquires canonical bead-scoped custody on the authoritative board node, in addition to local checkout and PR locks. Ownership transfer and explicit ownership/status mutations refuse active or indeterminate publication; a different registry on another node cannot create a second writer. Definite publication or provider refusal releases custody; process loss never silently expires it.

Register metadata for an existing source-only PR

caco pr reconcile-metadata was removed in existing PRs no longer need metadata registration.

Continue an already-published generic product

For the configured native-auto-merge lane, managed and owned product checkouts use the same actions: non-force push of the owner's branch, open or reuse its PR, and arm native squash auto-merge on the pushed head. caco pr push and mode-less caco agent reintegrate --project <project> --checkout <path> use GitHub's current state; an unpublished product needs no preliminary registration or preview receipt. A read-only preview reports native_pr_actions without reading a cached target commit or writing a ledger.

Recorded base_head, generation-scope diffs against tracking refs, local PR snapshots, checkout receipts and landing journals do not gate these actions. Task attribution can change without transferring branch ownership. The source branch must belong to the authenticated worker; Git rejects non-fast-forward pushes without a force fallback.

The protected pr merge --auto --squash --match-head-commit <head> command retains required GitHub checks and never uses an admin merge. Already-armed PRs need no second arm; GitHub-confirmed merge is distinct from accepted auto-merge. A failed provider read is unknown, not an absent PR or successful action; lost replies are resolved by provider readback, not a local attempt ledger.

Drafts remain pending review, and review never requests a merge. Other configured landing backends and privileged repair custody retain their contracts; native publication does not select another queue or acquire another worker's branch.

For a published-unjoined product operation, the owner stays blocked on the typed completion blocker and retries its own completion after the cause is fixed (see Completion blockers). The retry reuses the original PR, source head, source bead and idempotency key. It never publishes another generation, substitutes another owner, or accepts a changed project, repository, base, dirty source or removed assignment.

Native auto-merge updates the owned source branch and reuses its open PR. caco pr init remains the distinct separate product-PR worktree flow for another repository or base: it writes deterministic sibling partial-init metadata before bounded clone/fetch/checkout, records phase/PID/attempt/error under one sub-client deadline, and resumes an exact matching dead/failed operation on retry or --resume. Default sibling placement requires a path-free --name; use --branch for namespaced refs or an explicit --worktree to retain an existing recorded path.

An unpublished one-path merge partial has distinct local recovery provenance, binding owner, metadata, heads, base, index, paths and content without fabricating a PR or published head. Its exact receipt permits resume/abort, including abort of an unresolved conflict; an interrupted mutation requires receipt-only readback before retry, and the original partial remains preserved. Published recovery retains its existing PR/provider checks, and neither recovery route publishes.