Merge branch 'next' into feat/1279-fail-first-prover

This commit is contained in:
Rezolv
2026-06-16 17:35:55 -04:00
committed by GitHub
30 changed files with 653 additions and 96 deletions

View File

@@ -6,9 +6,13 @@ block — do not inline a copy elsewhere. History of coordinated edits: #2924, #
**Contract for orchestrators:** before dispatch, capture `EXPECTED_BASE=$(git rev-parse HEAD)`,
then embed the block below into the sub-agent prompt verbatim, substituting `{EXPECTED_BASE}`
with that captured SHA. The sub-agent only *verifies* and fails closed; the orchestrator
(the worktree lifecycle owner) performs any base recovery — the sub-agent never rewrites a
worktree it did not create (#48).
with that captured SHA. Orchestrators that intentionally create a docs-only pre-dispatch
plan commit may also substitute `{EXPECTED_BASE_ALTERNATE}` with that commit's immediate
parent so runtimes that fork from either side of the docs-only commit pass the same
fail-closed guard (#1265). Otherwise substitute `{EXPECTED_BASE_ALTERNATE}` with an empty
string. The sub-agent only *verifies* and fails closed; the orchestrator (the worktree
lifecycle owner) performs any base recovery — the sub-agent never rewrites a worktree it
did not create (#48).
<worktree_branch_check>
FIRST ACTION: HEAD assertion MUST run before anything else, and this block is
@@ -30,8 +34,10 @@ if ! echo "$ACTUAL_BRANCH" | grep -Eq '^worktree-agent-[A-Za-z0-9._/-]+$'; then
echo "FATAL: worktree HEAD '$ACTUAL_BRANCH' is not in the worktree-agent-* namespace; refusing to commit (#2924)." >&2
exit 42
fi
if [ "$(git rev-parse HEAD)" != "{EXPECTED_BASE}" ]; then
echo "FATAL: worktree base mismatch — HEAD is $(git rev-parse HEAD), expected {EXPECTED_BASE}. Orchestrator owns recovery; sub-agent refuses to rewrite the worktree (#48)." >&2
ACTUAL_BASE=$(git rev-parse HEAD)
EXPECTED_BASE_ALTERNATE="{EXPECTED_BASE_ALTERNATE}"
if [ "$ACTUAL_BASE" != "{EXPECTED_BASE}" ] && { [ -z "$EXPECTED_BASE_ALTERNATE" ] || [ "$ACTUAL_BASE" != "$EXPECTED_BASE_ALTERNATE" ]; }; then
echo "FATAL: worktree base mismatch — HEAD is $ACTUAL_BASE, expected {EXPECTED_BASE}${EXPECTED_BASE_ALTERNATE:+ or $EXPECTED_BASE_ALTERNATE}. Orchestrator owns recovery; sub-agent refuses to rewrite the worktree (#48)." >&2
exit 42
fi
```