Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
50d3a30
ORB-262: make orchestrate own final-head readiness
thomasluizon Aug 7, 2026
c7ab13f
ORB-262: bound connector review waits
thomasluizon Aug 7, 2026
74fd402
ORB-262: accept measured connector aliases
thomasluizon Aug 7, 2026
3c3db39
ORB-262: revalidate readiness against GitHub
thomasluizon Aug 7, 2026
f16d005
ORB-262: close canonical review blind spots
thomasluizon Aug 7, 2026
0ad30d5
ORB-262: close frozen readiness blockers
thomasluizon Aug 7, 2026
c61556c
ORB-262: close connector readiness gaps
thomasluizon Aug 7, 2026
599edae
ORB-262: scope thread mutations to target repo
thomasluizon Aug 7, 2026
b2ac5c1
ORB-262: sync required API contract artifact
thomasluizon Aug 7, 2026
ece5bf9
Merge remote-tracking branch 'origin/main' into chore/orchestrate-rea…
thomasluizon Aug 7, 2026
6d9937d
ORB-260: align review parity guidance
thomasluizon Aug 7, 2026
3d5dc3b
Merge remote-tracking branch 'origin/main' into chore/orchestrate-rea…
thomasluizon Aug 7, 2026
09940dd
fix: close final readiness review gaps
thomasluizon Aug 7, 2026
7c51ce9
Merge remote-tracking branch 'origin/main' into chore/orchestrate-rea…
thomasluizon Aug 7, 2026
5ee1c95
Merge remote-tracking branch 'origin/main' into chore/orchestrate-rea…
thomasluizon Aug 7, 2026
c837583
fix: close final connector and review findings
thomasluizon Aug 7, 2026
130be12
Merge remote-tracking branch 'origin/main' into chore/orchestrate-rea…
thomasluizon Aug 7, 2026
d2782e8
Merge branch 'main' into chore/orchestrate-ready-lifecycle
thomasluizon Aug 7, 2026
e5467b9
Merge remote-tracking branch 'origin/main' into chore/orchestrate-rea…
thomasluizon Aug 7, 2026
f0ee2eb
Merge remote-tracking branch 'origin/chore/orchestrate-ready-lifecycl…
thomasluizon Aug 7, 2026
312e765
fix(orchestrate): harden Linear synchronization
thomasluizon Aug 7, 2026
da73811
fix(orchestrate): close final readiness bypasses
thomasluizon Aug 7, 2026
5be4976
fix(orchestrate): block abbreviated pathspec staging
thomasluizon Aug 7, 2026
f09476a
fix(orchestrate): complete thread and staging guards
thomasluizon Aug 7, 2026
d8187b2
fix(orchestrate): bound commit and thread pagination
thomasluizon Aug 7, 2026
a413a82
fix(orchestrate): block abbreviated commit staging
thomasluizon Aug 7, 2026
cef4f90
fix(orchestrate): close final readiness gaps
thomasluizon Aug 7, 2026
9d5c30a
fix(orchestrate): revalidate live readiness
thomasluizon Aug 7, 2026
0ee82f9
fix(orchestrate): close final readiness gaps
thomasluizon Aug 7, 2026
abc4d2e
fix(orchestrate): revalidate aggregation live
thomasluizon Aug 7, 2026
2e3051c
fix(orchestrate): pin salvage branch
thomasluizon Aug 8, 2026
c56770e
Fix launcher body-edit CI invalidation
thomasluizon Aug 8, 2026
2543b28
Close final readiness invalidation gaps
thomasluizon Aug 8, 2026
d9bb423
Bind reviews and body edits to frozen evidence
thomasluizon Aug 8, 2026
acade79
Await body-edit invalidation during CI polling
thomasluizon Aug 8, 2026
c2937f0
Harden final readiness evidence
thomasluizon Aug 8, 2026
a6105a7
Close final volatile readiness gaps
thomasluizon Aug 8, 2026
6627da4
Anchor final review readiness
thomasluizon Aug 8, 2026
7b5b647
Seal immutable review evidence
thomasluizon Aug 8, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .claude/hooks/_lib/rules-orchestrator.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ const API_CLIENTS = new Set(["gh", "curl", "wget", "http", "https", "httpie"])
// bypass is not a prohibition, and this is the one everything else rests on.
const HTTPIE_BINARIES = new Set(["http", "https", "httpie"])
const BARE_PUT = /(?<![\w-])PUT(?![\w-])/
const BROAD_GIT_ADD = /(?:^|\s)git(?:\.exe)?(?:\s+-C\s+(?:"[^"]+"|'[^']+'|\S+))?\s+add\s+(?:-A|--all|\.)(?:\s|$)/i

/**
* Everything before the first real word: leading grouping punctuation and any number of
Expand Down Expand Up @@ -134,6 +135,24 @@ export function checkEngineInvocation(command, { env = {}, cwd = "", repoRoots =
return null
}

/** Workers stage only named paths. Broad staging can sweep prompt residue, generated output, or a
* colleague's tracked `.orca/` edit into the commit. The rule applies only to launcher children and
* linked worktrees; ordinary user Git outside a worker remains untouched. */
export function checkBroadStaging(command, { env = {}, cwd = "", repoRoots = [] } = {}) {
if (typeof command !== "string") return null
if (!env[LAUNCHER_MARKER] && !(cwd && insideLinkedWorktree(cwd, repoRoots))) return null
for (const segment of segmentsOf(command)) {
if (!BROAD_GIT_ADD.test(segment)) continue
return blocked(
command,
"Worker worktrees may stage only explicitly named paths. `git add -A`, `git add --all`, and\n" +
"`git add .` can capture unrelated or runtime residue. Inspect `git status --short`, then\n" +
"pass each intended path to `git add` by name. Tracked `.orca/` changes are source.",
)
}
return null
}

/**
* Refuse the admin merge in every shape, with NO launcher or worktree exemption: the prohibition
* is absolute for every agent, and forbidding only the CLI flag would leave both raw API paths
Expand Down
21 changes: 14 additions & 7 deletions .claude/hooks/_lib/rules-sleep.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,23 @@ export function checkSleepStop({ state, wakeSources = [], sessionId = "", stopHo
* re-entered step 7. A queue is not done while one of its pull requests has not been through the
* rest of the algorithm.
*/
const unreviewed = Array.isArray(state.unreviewedPullRequests) ? state.unreviewedPullRequests.filter((entry) => Number.isInteger(entry)) : []
if (remaining.length === 0 && unreviewed.length === 0) return null
const rawPullRequests = Array.isArray(state.pullRequests) ? state.pullRequests : []
const pullRequests = rawPullRequests.filter(
(entry) => typeof entry?.repositoryKey === "string" && entry.repositoryKey !== "" && Number.isInteger(entry?.prNumber) && typeof entry?.receiptPath === "string" && entry.receiptPath !== "",
)
const invalidPullRequestIdentities = rawPullRequests.length - pullRequests.length +
(Array.isArray(state.unreviewedPullRequests) ? state.unreviewedPullRequests.length : 0)
if (remaining.length === 0 && pullRequests.length === 0 && invalidPullRequestIdentities === 0) return null
Comment thread
thomasluizon marked this conversation as resolved.
Resolved

const live = wakeSources.filter((source) => Number.isInteger(source?.pid) && isAlive(source.pid))
if (live.length > 0) return null

const outstanding =
remaining.length > 0
? `${remaining.length} ticket(s) left (${remaining.join(", ")})`
: `every ticket done but pull request(s) ${unreviewed.map((number) => `#${number}`).join(", ")} carrying no review verdict`
: invalidPullRequestIdentities > 0
? `${invalidPullRequestIdentities} pull request identity record(s) are bare or invalid; repositoryKey, prNumber, and receiptPath are required`
: `every ticket done but pull request(s) ${pullRequests.map((entry) => `${entry.repositoryKey}#${entry.prNumber}`).join(", ")} lack a READY final-head receipt`

return {
block: true,
Expand All @@ -55,11 +62,11 @@ export function checkSleepStop({ state, wakeSources = [], sessionId = "", stopHo
"When every slot is free and work remains, the action is to LAUNCH THE NEXT TICKET, not to end\n" +
"the turn. `node tools/launch-worker.mjs` registers itself as a wake source, so starting the\n" +
"next worker or the next reviewer clears this by construction.\n\n" +
"A pull request listed in unreviewedPullRequests has not been through steps 7, 8 and 12. Run\n" +
"them, then drop it from the list. A salvaged pull request is not an exception: opening it is\n" +
"the middle of salvage, never the end.\n\n" +
"A pull request listed in pullRequests has not reached simultaneous final-head readiness. Run\n" +
"the readiness loop, then drop it only after its receipt says READY. A salvaged pull request\n" +
"is not an exception: opening it is the middle of salvage, never the end.\n\n" +
"If the queue really is done and every pull request is reviewed, write `remaining: []` and\n" +
"`unreviewedPullRequests: []` into .git/orbit-orchestrate-run.json, then print the step 14\n" +
"`pullRequests: []` into .git/orbit-orchestrate-run.json, then print the step 15\n" +
"report. Never leave the record saying work remains when it does not.",
}
}
3 changes: 2 additions & 1 deletion .claude/hooks/orchestrator-guardrails.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { fileURLToPath } from "node:url"

import { readStdinJson } from "./_lib/io.mjs"
import { declaredRepoRoots } from "./_lib/repo-roots.mjs"
import { checkAdminMerge, checkEngineInvocation } from "./_lib/rules-orchestrator.mjs"
import { checkAdminMerge, checkBroadStaging, checkEngineInvocation } from "./_lib/rules-orchestrator.mjs"

try {
const input = readStdinJson()
Expand All @@ -23,6 +23,7 @@ try {
const repoRoots = declaredRepoRoots(resolve(dirname(fileURLToPath(import.meta.url)), "..", ".."))
const verdict =
checkAdminMerge(command) ??
checkBroadStaging(command, { env: process.env, cwd: input?.cwd || process.cwd(), repoRoots }) ??
checkEngineInvocation(command, { env: process.env, cwd: input?.cwd || process.cwd(), repoRoots })
if (verdict?.block) {
process.stderr.write(verdict.message)
Expand Down
17 changes: 13 additions & 4 deletions .claude/hooks/test-hooks.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { fileURLToPath } from "node:url"
import { checkGitCommand, checkGitWorktreeRemove } from "./_lib/rules-git.mjs"
import { checkEfMigrationRawIndex } from "./_lib/rules-source.mjs"
import { checkLinearMutation } from "./_lib/rules-linear.mjs"
import { checkAdminMerge, checkEngineInvocation } from "./_lib/rules-orchestrator.mjs"
import { checkAdminMerge, checkBroadStaging, checkEngineInvocation } from "./_lib/rules-orchestrator.mjs"
import { checkSleepStop } from "./_lib/rules-sleep.mjs"
import { checkWorkerBrowser } from "./_lib/rules-worker.mjs"

Expand Down Expand Up @@ -135,6 +135,12 @@ mkdirSync(linkedWorktree, { recursive: true })
writeFileSync(join(linkedWorktree, ".git"), `gitdir: ${join(mainCheckout, ".git", "worktrees", "feat")}\n`)
T("engine: a cwd inside a linked worktree allows", checkEngineInvocation("codex exec", { cwd: linkedWorktree, repoRoots: [mainCheckout] }), null)
T("engine: the main checkout is not a linked worktree", blocks(checkEngineInvocation("codex exec", { cwd: mainCheckout, repoRoots: [mainCheckout] })), true)
const workerStaging = (command) => checkBroadStaging(command, { cwd: linkedWorktree, repoRoots: [mainCheckout] })
for (const command of ["git add -A", "git add --all", "git add .", `git -C "${linkedWorktree}" add .`]) {
T(`staging: ${command} blocks in a worker worktree`, blocks(workerStaging(command)), true)
}
T("staging: explicitly named paths are allowed", workerStaging("git add tools/verify-delivery.mjs .claude/skills/orchestrate/SKILL.md"), null)
T("staging: broad add outside a worker is untouched", checkBroadStaging("git add -A", { cwd: mainCheckout, repoRoots: [mainCheckout] }), null)
// REGRESSION (fixed 2026-08-04). The previous revision split the command on a
// bare /[&|;\n]/, so the `|` inside the quoted search pattern produced a phantom
// segment whose first token resolved to `codex`, and a read-only grep was
Expand Down Expand Up @@ -200,11 +206,12 @@ T("sleep-stop: an exhausted queue allows", checkSleepStop({ state: { ...sleeping
// A salvaged pull request that never re-entered step 7 is unfinished work, not a finished queue.
// PR #690 was opened by hand and reported as done while two required checks were red and a bot
// thread was unresolved, because opening it was treated as the end of salvage.
const salvaged = { ...sleeping, remaining: [], unreviewedPullRequests: [690] }
const salvaged = { ...sleeping, remaining: [], pullRequests: [{ repositoryKey: "ui", prNumber: 690, receiptPath: "C:/receipt.json" }] }
T("sleep-stop: an open pull request with no review verdict blocks the queue from reading as done", blocks(stop({ state: salvaged })), true)
T("sleep-stop: the refusal names the pull request and the steps it owes", stop({ state: salvaged })?.message.includes("#690") && stop({ state: salvaged })?.message.includes("steps 7, 8 and 12"), true)
T("sleep-stop: the refusal names the repository-qualified pull request and receipt debt", stop({ state: salvaged })?.message.includes("ui#690") && stop({ state: salvaged })?.message.includes("READY final-head receipt"), true)
T("sleep-stop: a live reviewer allows the turn to end", checkSleepStop({ state: salvaged, wakeSources: [{ pid: 1 }], sessionId: "s1", isAlive: alive }), null)
T("sleep-stop: nothing remaining and nothing unreviewed allows", checkSleepStop({ state: { ...sleeping, remaining: [], unreviewedPullRequests: [] }, sessionId: "s1", isAlive: dead }), null)
T("sleep-stop: bare PR numbers are invalid run state and cannot clear readiness", blocks(stop({ state: { ...sleeping, remaining: [], unreviewedPullRequests: [690] } })), true)
T("sleep-stop: nothing remaining and no pull requests allows", checkSleepStop({ state: { ...sleeping, remaining: [], pullRequests: [] }, sessionId: "s1", isAlive: dead }), null)
T("sleep-stop: a run that is not --sleep allows", checkSleepStop({ state: { ...sleeping, sleep: false }, sessionId: "s1", isAlive: dead }), null)
T("sleep-stop: no record at all allows", checkSleepStop({ state: null, sessionId: "s1", isAlive: dead }), null)
// A record from a previous run must never block today's session, and the session id is exact.
Expand Down Expand Up @@ -294,6 +301,8 @@ T("adapter orchestrator: gh pr merge --squash -> 0", runHook(ORCH, bash("gh pr m
T("adapter orchestrator: codex --version -> 0", runHook(ORCH, bash("codex --version")), 0)
T("adapter orchestrator: grep over a codex pattern -> 0", runHook(ORCH, bash("grep -rnE 'claude|codex' tools/")), 0)
T("adapter orchestrator: the launcher marker -> 0", runHook(ORCH, bash("codex exec"), { ORBIT_LAUNCH_WORKER: "1" }), 0)
T("adapter orchestrator: worker git add -A -> 2", runHook(ORCH, bash("git add -A"), { ORBIT_LAUNCH_WORKER: "1" }), 2)
T("adapter orchestrator: worker named git add -> 0", runHook(ORCH, bash("git add tools/verify-delivery.mjs"), { ORBIT_LAUNCH_WORKER: "1" }), 0)

// The launcher marker means the opposite for the browser ban: it identifies the worker, which is
// the only caller this gate refuses.
Expand Down
2 changes: 0 additions & 2 deletions .claude/orchestrator.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@
"pollSeconds": 60
},
"caps": {
"diffLines": 400,
"affectedFiles": 8,
"reviewRounds": 2,
"parallelTickets": 3,
"botReviewWaitSeconds": 900
Expand Down
Loading
Loading