Files
gstack/lib/coordinator-contract.ts
T
Garry Tanandcapy-ai[bot] fd13cf25e8 v1.91.133.0 docs(coordinator-contract): Before done treats requires-remote as unfinished (#3261)
* docs(coordinator-contract): Before done treats requires-remote as unfinished and names the --remote clear

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>

* chore(release): v1.91.133.0

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>

---------

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
2026-10-18 02:51:19 +00:00

25 lines
2.7 KiB
TypeScript

/**
* coordinator-contract — the block every lane prompt inherits word for word
* (plan E2). A coordinator thread that runs several lanes states its merge
* conditions, behavior-change notices, spend caps and handoff format once;
* the `{{COORDINATOR_CONTRACT}}` resolver renders this text into the plan
* template, `bin/gstack-autoplan` prints it into every reviewer prompt
* (lib/autoplan-prompts.ts writePrompts), and `gstack-autoplan contract`
* prints it for a parent that writes its own lane prompts. One source, no
* paraphrase: test/coordinator-contract.test.ts pins that the three outputs
* are byte-identical.
*/
export const COORDINATOR_CONTRACT_HEADING = '## Coordinator contract (inherited by every lane)';
export const COORDINATOR_CONTRACT = `${COORDINATOR_CONTRACT_HEADING}
Merge conditions. A lane's PR merges only when: the required gate lanes are green on the stamped tree or the tree receipt says \`gate-reuse: eligible\`; \`gstack-lane-check\` reports \`clear\` for its planned files against every other open lane; the PR body opens with the \`gstack-ship-receipt\` block; and the coordinator, not the lane, says merge. A lane never merges, rebases another lane, or force-pushes.
Behavior-change notices. Every user-visible behavior change outside the plan's own items is listed in the PR body under \`## Behavior changes\` with the file, the old behavior and the new one, before the review starts. An omitted change found in review is a CRITICAL finding, whatever its size.
Spend caps. Each lane runs under the \`--spend-cap\` the coordinator names; a lane that reaches it stops \`incomplete\` (\`STOP: reason=budget_exhausted\`) and reports spent, reserved and unknown charges. Paid evals are never retried to change a verdict; a rerun needs a named repair. Host-subagent spend is reported as \`unknown\`, never zero.
Before done. A lane pushes a WIP commit to its branch after each step and gates a pushed SHA. It is done only when \`gstack-pregate run --allow-repo-commands\` passes; \`requires-remote\` needs \`--stage tests --remote --spend-cap <cap>\`. Where \`.gstack/pregate.json\` has a \`sealed\` key, it runs \`gstack-pregate sealed\` before any push or PR creation; a refusal stops the push.
Handoff format. A lane reports in this order, identifiers first: PR URL (or \`no PR\` with branch and SHA), \`GSTACK_RESULT\` line, the \`gstack: ok|fail <rev>\` line, the \`PREGATE:\` line, gate summary (lanes passed/failed/skipped), behavior changes (or \`none\`), spend (spent/reserved/unknown), then what it could not verify. Full thread ids (\`jam_…\`), never short codes, in every cross-thread message. Prose after the identifiers may be truncated; nothing before them may be.`;