Skip to content

Takeover gate: every change of owning chief goes through the owner's gate (T656, PR A) - #448

Merged
erickb336 merged 5 commits into
mainfrom
sage/t656-takeover-gate
Nov 7, 2026
Merged

erickb336 merged 5 commits into
mainfrom
sage/t656-takeover-gate

Conversation

@erickb336

Copy link
Copy Markdown
Owner

What this is

PR A of T656, the takeover gate. In a shared logbook, every change of owning chief away from another chief now ends in one write path: the owner's answer to a takeover gate, in either direction between Claude and Codex. It follows the owner-approved design and the PE plan (R2576), with the owner's answers Q1 to Q4.

What changes

Command Before Now
accept <T> Wrote the new chief at once Opens a takeover gate (kind replace) from the owning chief to the recipient. The owner's answer replace gives the task through the existing Replace write; keep changes nothing.
claim <T> Any chief claimed an unclaimed task Refuses a task that another chief released last, and names the takeover gate. The releasing chief claims it back. After the move, a chief claims the tasks that its own provider started (Q1 b).
gate replace <T> Refused a task with no owning chief Also opens a gate for a task with no owning chief ("Replace no chief of T..."). replaceOf reads that question and the providers.
task-adopt Worked in a shared logbook Refuses in a shared logbook (Q4 a). An old, separate logbook keeps it.
merge-check No chief --chief C<n> applies the owner rule, as the hook does for its session. The Codex server passes the chief (actorOptions).
Takeover answer - When another worktree holds the task's branch, the line names it and one safe command: git -C <worktree> switch --detach, never --force (Q3 a).
Board "replace, when you know that X stopped" for every Replace gate After an accept, the recommendation says that the owning chief offered the task. Inferred PR work reads the owning chief's provider, not the codex/ prefix (C6).

The Q2 shape (F4 gap)

The owner's Q2 (b): when Claude takes over a ready Codex PR, it runs one fresh Claude cycle on a sage-pr import, then lands it through sage-pr.

Shape chosen: one rule in the merge check, switched on by the Claude adapter only (takeoverCycle in createStateTool). A task whose last cross-provider takeover answer is in its decisions needs one clean cycle on the SHA recorded after that answer. The cycles of both providers still count together (one ledger). The PR script's import check reads only the task's verdicts after the takeover, so the older Codex verdicts do not refuse the review copy.

  • It closes the plain-path gap: the hook's merge check refuses Codex cycles alone, and names the step to take.
  • The Codex adapter does not switch it on, so a Codex chief that takes a Claude task counts the Claude cycles, and the owner lands it in GitHub (design 6R).
  • Core names no provider: the adapter gives the step text, as it gives claimStep and replaceStep.

Not in this PR

C5 (the push rule by owning chief, PR B) and C7 (the new standing order).

Tests

  • scripts/chiefs.test.mjs, both pair directions: accept opens the gate and keep changes nothing; claim after another chief's release refuses and the own claim-back passes; a moved task of the own provider claims and of the other provider refuses; task-adopt in a shared logbook refuses; merge-check --chief of the chief that lost the task refuses; Codex verdicts, takeover to Claude, the Claude merge check refuses until one Claude cycle and then passes; the takeover line names the worktree that holds the branch, and its command frees it.
  • scripts/codex-state-mcp.test.mjs: accept returns the gate line; merge_check passes the caller's chief.
  • scripts/board-shared.test.mjs: the takeover recommendation after an offer, the no-chief text, and no prefix inference.
  • scripts/sage-pr.test.mjs: a task taken from a Codex chief lands after one Claude cycle on its review copy.
  • scripts/shared-root.test.mjs: a Codex chief's merge check now judges for its chief.

🤖 Generated with Claude Code

erickb336 and others added 5 commits November 7, 2026 10:38
…eck --chief; one Claude cycle after a takeover from Codex (T656)

accept opens a takeover gate (kind replace) and the owner's answer moves the task. claim refuses a task that another chief released last, or that the move brought from the other provider. gate replace takes a task with no owning chief. task-adopt refuses in a shared logbook. merge-check takes --chief, and the Codex server passes it. The Claude adapter needs one Claude cycle after a takeover from another provider, and sage-pr reads only the verdicts after it. The takeover answer names a worktree that holds the branch and one safe command. The board's takeover recommendation names the offer, and inferred work reads the owning chief's provider.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ard that agrees with the merge check, a quoted Q3 line (T656)

- F-T656-1: the gate's question says when the new chief runs one fresh cycle, so the board's landing check and every reader keep that rule.
- F-T656-2: the rule compares the provider of the chief that held the task last (the release, or the move); a move between two chiefs of one provider needs no fresh cycle.
- F-T656-3: release says that only the releasing chief claims the task back.
- F-T656-4, F-T656-9: a second accept or gate replace of the same task and chiefs prints the open gate; the board's offer line names the gate after an accept.
- F-T656-10: "takeover gate" in the refusal and on the board card, with the takeover path.
- F-T656-11: "Hand T and PR n from A to B?" with approve and decline; gates of an older sage with replace and keep still answer.
- F-T656-13: each open line names the next step; the Q3 line says to check out the branch; the board's recommendations read alike.
- F-T656-14, F-T656-6: the Q3 line quotes the worktree path for a POSIX shell, reads the list with -z, and prints no command for a path with a control character.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…, and the quoted Q3 line (T656)

- F-T656-12: the README usage row and the guide say that a Claude chief that takes a task from Codex runs one fresh Claude cycle before it merges.
- F-T656-3, F-T656-10: the board guide says who claims an unclaimed task, and "takeover gate" on its cards.
- F-T656-11: the guide names approve and decline, and the gates of an older sage.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…on decline, shorter text (T656)

- F-T656-23: the fresh cycle after a takeover counts only review and QA
  verdicts whose run started after the owner's answer; the PR script's
  import check reads the same rows (takenRows).
- F-T656-20: the last takeover answer decides the fresh cycle: back to a
  provider that needs none clears it; a move within one provider keeps the
  answer before it.
- F-T656-21: the question takes only a plain PR number (040 reads as 40).
- F-T656-28: a decline of a gate that an accept opened also ends that
  offer, in one saved change with the answer's decision row; the question
  says so. A decline of a gate replace changes nothing, as before.
- F-T656-24, F-T656-27: the Approve part is short sentences, with the runs
  clause only when a run ends; the README row is three short sentences.
- F-T656-25: the board recommends approve with a reason when no run ends.
- F-T656-26: the command that frees a held branch stands on its own line.
- F-T656-22: the Codex guide and the task_adopt tool say that task-adopt
  refuses in a shared logbook, and name the takeover gate.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@erickb336
erickb336 merged commit 587598a into main Nov 7, 2026
1 check passed
@erickb336
erickb336 deleted the sage/t656-takeover-gate branch November 7, 2026 23:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant