Skip to content
Merged
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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: Line-budget rewrites reach into unrelated steps

To stay within the core-docs line cap, this commit rewrites the review, ready and merge text (steps 4–6), which have nothing to do with check/sandbox exit codes. Each rewrite is a chance to change meaning without anyone noticing (see the other findings). Lines 22 and 25 also no longer wrap like the rest of the list (84 and 90 columns). Next time, take the saved lines from the Failure section itself, or wrap the edited lines consistently.

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)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: Shortened text drops 'pending' from the mergeability timeout

The old text said "Pending mergeability can time out (exit 3) with green checks." The new text says "Mergeability can time out (exit 3)". That reads as if any mergeability state can time out, when the case is a still-pending computation. "Zero can activate or enqueue" is also hard to parse now that "seconds" is gone, since --wait=0 is no longer obviously the subject. Smallest fix: write "Pending mergeability can time out" and "--wait=0 can still activate or enqueue". Both still fit on the same lines.

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: Merge paragraph no longer says that a queue enqueues

The old sentence "A queue initially enqueues" told callers that with a merge queue configured, merge enqueues instead of merging directly. The new "Queueing without --wait exits 0 without cleanup" assumes the reader already knows that, which matters for the step-6 handoff. Consider "With a queue, merge enqueues; without --wait it exits 0 without cleanup."

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: Failure-rule rewrite drops the scope 'when operator-facing code wraps an error'

The old rule limited the safe cause/stage detail to cases where operator-facing code wraps an error, and asked for a short detail. The new rule "name the cause or stage safely" applies to every failure and drops the brevity limit. This quietly broadens a code-facing requirement in a PR that says it only clarifies check exit codes. If the only goal was to save lines, keep the qualifier, e.g. "name a short, safe cause or stage when wrapping errors".

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