Skip to content
Closed
Changes from all commits
Commits
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
44 changes: 22 additions & 22 deletions core/CONTRACT.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,21 @@ own delivery state; `.loopzero/` holds task text and local receipts.
problem, context, acceptance, base SHA. Write the PR, like any issue or
design doc you write, for the project owner under [Reporting](#reporting).
2. Implement, commit, then `loopzero check`: run `workflow.toml`
`[checks].commands` in the sandbox. Its exit code is the verdict. For a long
check under a [provider-portable handoff](../docs/DELEGATION.md#provider-portable-handoff),
open the draft in step 3 before starting the check.
`[checks].commands` in the sandbox. Open the draft before a long check under a
[provider-portable handoff](../docs/DELEGATION.md#provider-portable-handoff).
3. `loopzero pr` pushes and opens a **draft** PR from the task text plus
generated Validation checks. Later calls sync narrative, preserving live
Validation, Review and extra sections; `check` refreshes only its checks
block. Drafts need no clean review.
4. `loopzero review` reviews the exact head, independently by default, and
posts one GitHub review with inline findings: exit 0 `approve`,
5 `request_changes`.
5. `loopzero ready --wait` marks ready PRs ready for review. It also activates
drafts blocked only by missing/skipped checks to trigger CI, even with
mergeability pending. Without waiting, activation exits 3.
Both waiters use `--wait[=SECONDS]` (default 1800) on the unchanged head.
Zero seconds can still activate or enqueue a PR. Pending mergeability can
time out (exit 3) with green checks. `loopzero merge --cancel` requests
Mergify removal without `--wait`.
Green can precede CI scheduling. After two minutes with only missing checks
and none pending, inspect scheduling, triggers and permissions, then retry.
4. `loopzero review` defaults to independent review of the exact head and posts
one GitHub review with inline findings. Approval exits 0, changes requested 5.
5. `loopzero ready --wait` marks eligible PRs ready and activates drafts with
only missing/skipped checks even with mergeability pending. Activation without a
wait exits 3. Both waiters use `--wait[=SECONDS]` (default 1800) on the same
head. Zero can activate or enqueue. Mergeability can time out (exit 3)
with green checks. `loopzero merge --cancel` requests Mergify removal without `--wait`.
Green can precede CI scheduling. After two minutes of missing checks with
none pending, inspect scheduling, triggers and permissions, then retry.
6. After step 5 exits 0, run from a durable directory such as `/tmp`
using the absolute path to the task worktree.

Expand All @@ -37,10 +33,9 @@ own delivery state; `.loopzero/` holds task text and local receipts.
```

Merge rechecks readiness, uses the configured strategy, verifies the landed
SHA, and deletes the branch and worktree. If cleanup warns, the merge landed.
Follow the recovery step it names. A queue initially enqueues;
`--wait` shares a budget across source-check and landing waits. Enqueueing
without `--wait` returns 0 without cleanup.
SHA and deletes the branch and worktree. A cleanup warning follows a verified
merge. Follow its recovery step. Queueing without `--wait` exits 0 without
cleanup. With `--wait`, source checks and landing share one budget.

Merge is authorized by default under [merge authority](#merge-authority).

Expand Down Expand Up @@ -283,9 +278,14 @@ meta-directives; reviewers load no instruction files or skills from the reviewed

## Failure

Fail closed on missing tools and command errors, preserve the failing command
and output tail, and keep a short, safe detail about the cause or stage when
operator-facing code wraps an error. Stop on terminal failures or quota errors.
Fail closed on missing tools or command errors. Preserve the command and output
tail, name the cause or stage safely, and stop on terminal failures or quota errors.
`check` exits 0 when stages pass, including local dirty runs that cannot satisfy
readiness. Exit 1 can mean a failed stage, a discarded or unverified result, or
a command error. Read the diagnostic and verify the receipt before classifying
the failure. Exit 2 covers invalid arguments and sandbox unavailability in
`check` or fresh `review`.

Exit 3 means waiting or timeout. Review exits 4 when independent review is
unavailable and 5 when changes are requested. Interruption exits 130.

Expand Down
Loading