@jesdi/skills 0.0.94 → 0.0.95
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/skills/implement-spec/README.md +9 -9
- package/skills/implement-spec/SKILL.md +1 -1
- package/skills/implement-spec/driver.py +31 -28
- package/skills/implement-spec/driver_decisions.py +12 -7
- package/skills/implement-spec/driver_final.py +57 -28
- package/skills/implement-spec/driver_final_gate.py +41 -0
- package/skills/implement-spec/driver_fixloop.py +0 -27
- package/skills/implement-spec/driver_report.py +1 -1
- package/skills/implement-spec/driver_run.py +1 -1
- package/skills/implement-spec/driver_state.py +2 -2
- package/skills/implement-spec/prompts/final-gate-fixer.md +33 -0
- package/skills/implement-spec/prompts/landing-red.md +1 -1
- package/skills/implement-spec/prompts/pr-body.md +2 -2
- package/skills/implement-spec/tests/test_arbitration.py +1 -1
- package/skills/implement-spec/tests/test_driver.py +57 -62
- package/skills/implement-spec/tests/test_final.py +57 -1
- package/skills/implement-spec/tests/test_final_gate.py +155 -0
- package/skills/implement-spec/tests/test_fixloop.py +26 -79
- package/skills/implement-spec/tests/test_review.py +16 -3
- package/skills/implement-spec/tests/test_tidy.py +16 -15
- package/skills/implement-spec/tests/test_walk.py +9 -10
- package/skills-manifest.json +3 -3
package/package.json
CHANGED
|
@@ -32,7 +32,7 @@ A driver before this change named the ticket branches `ticket/<NN>` and the reco
|
|
|
32
32
|
|
|
33
33
|
| Flag | Meaning |
|
|
34
34
|
|---|---|
|
|
35
|
-
| `--gate COMMAND` | Required. The full gate: the whole check command of the repository, as one shell line. The driver runs it
|
|
35
|
+
| `--gate COMMAND` | Required. The full gate: the whole check command of the repository, as one shell line. The driver runs it after all tickets have merged and the branch has been tidied and rebased, then after each final repair, with `IMPLEMENT_SPEC_BASE` set to the PR branch and no `IMPLEMENT_SPEC_LOCKED`. No agent is told this command. |
|
|
36
36
|
| `--fast-gate COMMAND` | Required. The fast gate: the ticket's locked tests, lint and types, as one shell line. The driver runs it on each candidate (the tip an implementer, a fixer or a test-writer correction made) before its review, with `IMPLEMENT_SPEC_BASE` set to the PR branch and `IMPLEMENT_SPEC_LOCKED` set to the space-separated locked file paths it checks: the ticket's locked files. Another ticket's locked files are not in a candidate's list. A green record is settled per tier and commit, whatever the list was: a commit is fast gated in one context. The implementer, the fixers and the final fixer run it on their own work: their prompts name this command and the same locked list, and for the final fixer the list is every merged ticket's locked files. No agent prompt names the `--gate` command. What it checks is the operator's choice. |
|
|
37
37
|
| `--spec FILE` | Required without `--dry-run`. The spec file the prompts point at. Its first heading is the PR title. |
|
|
38
38
|
| `--tickets DIR` | The directory of the ticket files. Default: `.agent/tickets`. |
|
|
@@ -88,7 +88,7 @@ Everything is under `.agent/`, which is never committed.
|
|
|
88
88
|
| `.agent/implement/<NN>/` | One folder for each ticket. |
|
|
89
89
|
| `.agent/implement/<NN>/<role>-<K>.json`, `.log`, `.prompt.md` | The report, the log and the prompt of one agent. K is the fix round. |
|
|
90
90
|
| `.agent/implement/<NN>/gate-<tier>-<sha7>.log` | One gate record, `<tier>` is `fast` or `full`: start, tier, commit, status, command, output, exit, the state after the command, end. A command that a signal ended, with the tree clean and HEAD unmoved, did not judge the commit: the driver runs it once more, that run overwrites the record, and the ledger says the gate was killed by the signal and runs again. A signal ended the command when its exit is negative, or when it is 128+N for N in SIGHUP (1), SIGINT (2), SIGKILL (9) or SIGTERM (15): the gate runs in `/bin/sh -c`, and a shell that does not exec the command, as Ubuntu's dash does not, outlives its killed child and exits with 128+N. Any other exit, 142 (128+SIGALRM) among them, is a red record with no second run. A second signal leaves the record red. |
|
|
91
|
-
| `.agent/implement/<NN>/findings-<K>.json` | The merged findings of the review after fix round K, or the red fast gate of round K.
|
|
91
|
+
| `.agent/implement/<NN>/findings-<K>.json` | The merged findings of the review after fix round K, or the red fast gate of round K. |
|
|
92
92
|
| `.agent/implement/final/` | The same files for the end of run, and `pr-body.md`: the pr-writer's body, then the facts of the run. |
|
|
93
93
|
| `.agent/implement/pycache/` | Compiled Python of the gate, kept out of the slots. |
|
|
94
94
|
| `.agent/implement-review.html` | The page with the open questions. |
|
|
@@ -107,8 +107,8 @@ A ticket is ready when each ticket in its **Blocked by** line is merged and no r
|
|
|
107
107
|
4. **Review.** The **reviewer** (`prompts/reviewer.md`) runs, the one agent of a ticket review. Its prompt holds the diff of each locked file of another ticket that the ticket's test-writer changed (`prompts/elsewhere.md`), to judge against the spec: a change that the spec does not support is a `fixture` finding. Its prompt carries the ticket's **Risk** line as one more criterion, or says that the ticket names no risk: a risk that the diff does not handle is a finding with basis `criterion`, under the same round and cap rules as any unmet criterion. A read-only role (reviewer, final-reviewer, the three lenses of the final review, pr-writer) leaves its slot and the git config as it found them: all worktrees share one config, and one key written there, such as a `core.worktree` on a temp directory, breaks git in each of them. To run a check off the slot, a reviewer reads the driver's gate record or makes its own `git worktree add --detach` copy and removes it. After a read-only role, the driver checks the slot and the keys of the shared config (`git rev-parse --git-common-dir`, then `config`) against what they were before. One change does not count: a new `branch.<name>` section with only `remote` on a configured remote and `merge` on `refs/heads/...`, which another session's `git worktree add -b` writes while a review runs. When the slot or another key changed, the driver restores the slot and only the changed keys, so other sessions' writes stay; when git cannot write them back (a held `config.lock`, a valueless key), the whole file goes back, and when that fails too the ticket is blocked, writes `a read-only role broke its rule: ...` to the ledger, and runs the review one more time; a second change blocks the ticket.
|
|
108
108
|
|
|
109
109
|
The ticket reviewer puts unmet criteria and merged-ticket regressions in `findings`; other observations go to final review. A re-review repeats its own open findings and can add regressions caused by the fix. Newly noticed issues outside that scope are deferred. The driver stores deferred observations in `observations-<round>.json` and gives them to each lens of the final review.
|
|
110
|
-
5. **Merge.** The driver merges the reviewed tip into the PR branch with git plumbing, then deletes the ticket branch. A conflict goes to the **conflict** agent (`prompts/conflict.md`) once. Its resolution may change no locked file of the ticket. A second conflict blocks the ticket.
|
|
111
|
-
**The landing.** Merges are serial. The PR branch moves only from the tip that the merge was made on; when another hand moved the branch in between, the driver makes the merge and the
|
|
110
|
+
5. **Merge.** The driver merges the reviewed tip into the PR branch with git plumbing, then deletes the ticket branch. A conflict goes to the **conflict** agent (`prompts/conflict.md`) once. Its resolution may change no locked file of the ticket. A second conflict blocks the ticket. The full gate waits until every ticket has merged.
|
|
111
|
+
**The landing.** Merges are serial. Successful checkout, the expected ticket tip and a clean slot are checked before merging and after conflict resolution; these inexpensive safeguards run without invoking either gate. The PR branch moves only from the tip that the merge was made on; when another hand moved the branch in between, the driver makes the merge and the locked-file check again, one time. The second try runs no conflict agent, so a conflict there blocks the ticket, and so does a branch that moved again. The commit that would land must leave every other ticket's locked file as the PR tip has it, but those the ticket lists in its own `locked`: a changed file, or a git error, blocks the ticket with one `ticket-blocked` question naming it, and the PR branch does not move. Its `retry` runs the implementer again from the ticket tip, whose locked-file check names the file until the ticket branch leaves it as the merge base has it. So a ticket's edit of a test file that another ticket locked later cannot land unseen.
|
|
112
112
|
**The locked-file check.** After the implementer, a fixer and the conflict agent report (DONE, BLOCKED or NEEDS_CONTEXT), the driver diffs the locked files: the ticket's own against its last test-writer commit, every other ticket's whose test-writer has run, merged or not, against the merge base of the ticket branch and the PR tip. Another ticket's file as the PR tip has it is no change; the ticket's own file is no change when it is the clean three-way merge (`git merge-file`) of its test-writer's version and the PR tip's, from their merge base, so a conflict merge can take in another ticket's listed change and keeps the test-writer's tests, and neither a conflict agent nor an implementer can put the file back to the PR tip's version. A changed locked file rejects the report with `locked file changed: <path>`, so the role runs once more on its next entry and then asks `ticket-blocked`. The baseline does not move with a rerun or a `retry`, so a breach left on the tip is found again. A test-writer correction (`prompts/correction.md`: after a `test-wrong` ruling, after `correct-test`, or for a `fixture` finding or a `test` finding on a locked file) changes only the files that it lists in `locked`. When it adds a requirement, it updates each shared fake or fixture that other locked tests use, runs each whole locked file and each locked test of merged tickets, and names each red test in `concerns`.
|
|
113
113
|
|
|
114
114
|
Rules for each agent:
|
|
@@ -141,7 +141,7 @@ A fix round has three steps: the **fixer** (`prompts/fixer.md`) makes the fast g
|
|
|
141
141
|
|
|
142
142
|
A red fast gate on the commit of the implementer or of a fixer is a critical finding with source `gate`, titled `the fast gate is red on <sha7>`. Its file is the gate record, and the record holds the output. No review runs on that tip, and the next round starts: a red gate on the commit of the implementer starts round 1. The review after that round covers each fix since the last review. A red fast gate after round 2 or on a test-writer correction blocks the ticket.
|
|
143
143
|
|
|
144
|
-
|
|
144
|
+
The full integration gate has its own final repair allowance (see End of run); it never consumes a completed ticket’s fix rounds.
|
|
145
145
|
|
|
146
146
|
- Round 1 runs on the first entry of the implementer list; round 2 runs on the second. Both entries are required.
|
|
147
147
|
- After round 2, a red gate or an unmet ticket criterion blocks the ticket and its dependents. Independent tickets continue. When the gate is green and criteria are met, other open findings move to the final must-fix list; the ticket can merge.
|
|
@@ -151,8 +151,8 @@ A red full gate on the commit that would land is a gate finding too, inside the
|
|
|
151
151
|
The end of run starts only when every ticket is merged and every slot is idle. Its agents work in slot 1.
|
|
152
152
|
|
|
153
153
|
1. **Tidy.** The driver saves the PR tip in `refs/implement-spec/<key>/recovery`. It then makes one commit for each ticket, in merge order, named `feat(NN): <title>`. Each commit holds the tests, the implementation and the fixes of its ticket. The tree of the new tip must equal the tree of the old tip, or the branch stays as it was.
|
|
154
|
-
2. **Rebase** onto the fetched tip of the `--base` branch, or without it of the default branch of `origin`. A conflict goes to the conflict agent (`prompts/rebase-conflict.md`) once
|
|
155
|
-
3. **Full gate
|
|
154
|
+
2. **Rebase** onto the fetched tip of the `--base` branch, or without it of the default branch of `origin`. A conflict goes to the conflict agent (`prompts/rebase-conflict.md`) once; the integrated tip gets the full gate in the next step. When the agent leaves the rebase open with no conflict, the driver goes on with it, then checks the rebased tip, in place of the commits the report names: a report whose rebased tip changes a locked file of any ticket from the recovery point is rejected, and the rerun fixes that tip with `git commit --amend`. When git cannot go on at the stop the agent resolved (a resolved file it did not stage), the report is rejected with git's error and the agent reruns. A second conflict leaves the branch at its recovery point.
|
|
155
|
+
3. **Full gate.** A red result saves the exact gate log and sends one repair batch to the final fixer (`prompts/final-gate-fixer.md`). An evidenced no-op is allowed when no code change is needed: it consumes the same repair attempt and reruns the full gate on the unchanged tip. Its commits are attributed to tickets and obey the same locked-file checks as final-review fixes. The driver reruns the full gate on the repaired tip. A second red result asks `final-ticket-blocked` with `retry` or `edit`; retry grants one further repair batch using the saved log. This allowance is independent of completed-ticket rounds and final-review rounds. Only a green integrated tip starts the **final review**: three agents at the same time in slot 1, one for each lens of the `review-diff` method, on the whole range, each with the one lens prompt `prompts/final-lens.md` and its own method lines in it. `final-spec` follows review-diff's `spec.md` with the run's spec; `final-correctness` has review-diff's `correctness.md` inlined, reads files from git at the reviewed tip and runs no tests; `final-structure` follows the `deep-quality-review` skill. `final-spec` and `final-structure` run on the first `final-reviewer` entry, `final-correctness` on the first `final-reviewer` entry on another provider than the first `implementer` entry, or on the first `final-reviewer` entry when there is none. Each reads the driver's full gate record of the reviewed tip as its gate evidence and runs no gate. Each gets ticket observations, minor findings, the must-fix list and the rulings of the operator, writes its own report and never sees another's. The driver merges their findings into one `findings-0.json`: each finding has a `source` (`spec`, `correctness` or `structure`), and two findings with the same file, line and title are one, the more severe one, or on a tie the earlier one in the order spec, correctness, structure. The ledger line of each finding names its source. A lens that stops or is rejected runs once more on the next entry; when the rerun stops or is rejected too, the round stops once the other lenses have ended, no fix batch runs, and the end of run asks `final-ticket-blocked-<n>`. The driver keeps each accepted lens report with the tip it covers (`run.final.lenses`): the next review of that tip runs only the lenses with no kept report, and a review of another tip runs all three. A lens that changes the slot makes all three run again.
|
|
156
156
|
4. **Fix batch.** Critical and important findings, including every must-fix item, go to one fixer (`prompts/final-fixer.md`), which makes the fast gate green on its final commit, with every merged ticket's locked files in `IMPLEMENT_SPEC_LOCKED`. A report whose commits change a locked file of any ticket from the tidied tip is rejected naming the file, so the fixer runs once more on its next `fixer` entry. The driver names each of its commits `fix(NN): …` from the ticket in the report. Then the full gate, then one scoped review of those commits: the **final-reviewer** (`prompts/final-reviewer.md`), one agent on the entry of `final-correctness`, so on another provider than the first `implementer` entry when the lists have one. It reads the merged findings, checks that each critical and important one is fixed and that the fix commits break nothing else, and lists each must-fix item it verified in `resolved_must_fix`; a must-fix item it leaves out stays open. The driver runs no fast gate at the end of the run.
|
|
157
157
|
5. Each critical or important finding the scoped review leaves open, a must-fix item too, asks one `final-ticket-blocked-<n>` question, and nothing is pushed while one is open. `retry` runs one more fix batch and one more scoped review on the open findings; `edit` keeps the end of run BLOCKED. There is no third review unless the operator answers `retry`.
|
|
158
158
|
6. **Push.** With `--push` or `--unattended`, the driver pushes the reviewed tip once, with no force, and opens the PR into the branch of step 2 with `gh`, ready for review. The **pr-writer** (`prompts/pr-writer.md`) writes the body with the method of the `pr` skill; the driver puts the facts of the run after it: the ticket-to-commit map, the fix commits, the rulings and the review coverage (`prompts/pr-body.md`). The body carries the merge-risk block of the `pr-risk` skill under `## Merge Danger`, above the facts; the driver validates it, runs the pr-writer once more with the errors when it is invalid, and blocks the run, opening no PR, when the second body is invalid too. A push stops before any agent when no `pr` skill or no `pr-risk` skill is next to this skill, in `${CLAUDE_CONFIG_DIR:-~/.claude}/skills` or in `~/.agents/skills`. Without them it prints the two tips and the command to run again with `--push`.
|
|
@@ -170,7 +170,7 @@ A repository with no `origin` remote skips only step 2 and step 6. The tidied co
|
|
|
170
170
|
|
|
171
171
|
- A green gate record is settled per tier and commit. The driver never runs the same tier again on that commit, and a green fast record never stands in for a full one. A `state.json` before `schema` 3 has one untiered list of green commits and one gate count: every gate then was the full gate, so the resume makes them the full tier.
|
|
172
172
|
- A ticket whose recorded tip is not on its branch goes back to `implement`, from the test-writer commit. A merged ticket whose tip is not in the PR branch does the same.
|
|
173
|
-
- A red
|
|
173
|
+
- A red integration gate saves its tip and exact log in `run.final.gate_failure`; an accepted repair increments `gate_repairs`. The initial `gate_allowance` is one; a capped question carries its next allowance in structured resume fields, applied only when the operator chooses retry. Question wording never grants repairs. Resume uses the saved red log, preserves the repair cap and leaves merged tickets closed. Older states gain these fields with an unused allowance; a pending legacy landing repair still finishes its already-started ticket round, then lands without another full gate.
|
|
174
174
|
- A `state.json` before `schema` 4 can hold questions of kinds this driver no longer has (`finding`, `locked-test`, `locked-test-again`, `review-stopped`, `review-rejected`, `implementer-stopped`, `fixer-stopped`, `merged-locked-file`, `final-finding`). An open one ends the run with exit 3 before any agent, naming each such question: answer it with the driver version that asked it, or start the run again. An answered one keeps the ruling sentence the older driver wrote, in the ledger and in the PR body (`driver_legacy.py` keeps those sentences; only a kind or an answer it does not know gets `Ruling: <NN> <kind> (<answer>): <subject>.`). Every answered question keeps its ruling sentence in `state.json`.
|
|
175
175
|
- A `state.json` before `schema` 5 keys `disputes` and `corrected` by the locked file. The resume moves each record to the test it names; a review correction that named only its file stays under the file, the key of a `fixture` finding that names no test. Each finding in the evidence of the ticket's `spec-ambiguous` questions gets the key of its file's record, so a `keep-test` answered before now keeps that test, not the whole file. `settled` starts at one per record that is not the correction of a ruling: an arbitration of two files counts two, so the cap comes no later than it would.
|
|
176
176
|
- A run of an older driver that stopped after its first final review round goes on to its fix batch and the scoped review with its `findings-0.json`, whose findings have no `source`; the findings of the scoped review have the source `final-reviewer`. A run that stopped inside that round runs the three lenses.
|
|
@@ -246,7 +246,7 @@ For an older questionless BLOCKED record, see [operator recovery](recovery.md).
|
|
|
246
246
|
|---|---|
|
|
247
247
|
| Demonstrated red plus green for locked tests | `driver_report.py` `_red_errors`: each red line of a test-writer report (and of a correction) must be in its log. `driver_gate.py` `run`, called from `driver_run.py` `Run.gate` and `driver_fixloop.py` `_gate`: the fast gate gets the ticket's locked files in `IMPLEMENT_SPEC_LOCKED` and must be green on the candidate before its review. |
|
|
248
248
|
| Locked files changed only by the test-writer | `driver_locked.py` `errors`, one diff check after the implementer, a fixer, the ticket conflict agent, the final fixer and the rebase conflict agent report (the baseline from `for_ticket`, or at the end of run `for_end_of_run`): the ticket's own locked files against its last test-writer commit, every other ticket's against the merge base of the branch and the PR tip, at the end of run every ticket's against the tidied tip (for the rebase conflict agent, the recovery point). A changed file rejects the report. `driver.py` `_refuse_breach` (with `driver_locked.py` `landing_errors`), under the merge lock: the commit that would land against every other ticket's locked files as the PR tip has it; a changed file blocks the ticket with one `ticket-blocked` question. `driver_locked.py` `_unlisted_errors`: a test-writer that changes another ticket's locked file must list it in `locked`, and the reviewer gets its diff (`prompts/elsewhere.md`) to judge against the spec. |
|
|
249
|
-
| The full gate
|
|
249
|
+
| The final full integration gate | `driver_final_gate.py` saves red evidence and bounds repair. `driver_final.py` `_review_until_reviewed` runs the full gate after every ticket is integrated, tidied and rebased, and after each final fix batch, before reviewing that exact tip. |
|
|
250
250
|
| The ticket reviewer and the final correctness lens (and the scoped review) on another provider than the implementer | `models.json`: the `reviewer` list starts on another provider than the `implementer` list, which a `--models` file can change. `driver_agents.py` `other_provider_entries`: the correctness lens and the scoped review run and rerun on `final-reviewer` entries of another provider than the first `implementer` entry, when the lists have one. When the config has none, or the preflight finds none usable (a provider out of credits), `correctness_entries` falls back to the `final-reviewer` entries that are left, and the ledger says so. When the reviewer's other-provider entry is skipped, its next entry may share the implementer's provider. The PR body's Review coverage names the entries each review ran on and flags one on a provider that also wrote code. |
|
|
251
251
|
|
|
252
252
|
## Known limits
|
|
@@ -14,7 +14,7 @@ to upstream: a model list per role; a context-isolated test-writer that commits
|
|
|
14
14
|
locked acceptance tests at the ticket's Seam; a review before each merge by one
|
|
15
15
|
reviewer, with the ticket's Risk line as one more criterion; at most 2 fix rounds
|
|
16
16
|
with escalation at round 2; one gate record per trusted commit, run by the driver;
|
|
17
|
-
tickets that touch the same function run in sequence; a gate
|
|
17
|
+
tickets that touch the same function run in sequence; fast gates per ticket, then a full gate after all tickets merge; one commit per ticket before the
|
|
18
18
|
final review; a final review by the three lenses of review-diff, with correctness on another provider when the config has one; no push and no PR until every ticket is merged and the final review
|
|
19
19
|
has passed. The review rounds adapt superpowers' subagent-driven-development
|
|
20
20
|
(obra/superpowers, MIT).
|
|
@@ -185,38 +185,46 @@ def _merge_commit(ticket: Ticket, slot: str, run: Run, tip: str, may_resolve: bo
|
|
|
185
185
|
return _Landing(tip, pr_tip, commit)
|
|
186
186
|
|
|
187
187
|
|
|
188
|
-
def _red_landing(number: str, slot: str, run: Run, commit: str, record: str) -> None:
|
|
189
|
-
"""A red full gate on `commit`, the commit that would land: a finding of the fix loop, inside the cap."""
|
|
190
|
-
git(slot, "checkout", "-q", run.names.ticket(number)) # the fixer works on the ticket branch
|
|
191
|
-
driver_fixloop.red_landing(run, number, slot, commit, record)
|
|
192
|
-
|
|
193
|
-
|
|
194
188
|
def _refuse_breach(number: str, run: Run, landing: _Landing) -> None:
|
|
195
189
|
"""The commit that would land leaves every other ticket's locked file as the PR tip has it, but those the ticket
|
|
196
190
|
lists as its own (driver_locked.landing_errors). A change blocks the ticket with one `ticket-blocked` question: its
|
|
197
191
|
`retry` runs the implementer
|
|
198
192
|
again, whose locked-file check names the file until the ticket branch leaves it as the merge base has it."""
|
|
199
193
|
if errors := driver_locked.landing_errors(run.state.read()["tickets"], number, landing.pr_tip, landing.commit):
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
194
|
+
_block_landing(number, run, landing.ticket_tip, "; ".join(errors))
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
def _block_landing(number: str, run: Run, tip: str, error: str) -> None:
|
|
198
|
+
run.ask(number, "ticket-blocked", [f"the landing: {error}"], str(STATE),
|
|
199
|
+
retry_point("implementer", tip, 0))
|
|
200
|
+
raise Blocked(error)
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
def _landing_slot(number: str, slot: str, run: Run, tip: str) -> None:
|
|
204
|
+
"""Keep cheap checkout/cleanliness safeguards and their retry handoff outside the full gate."""
|
|
205
|
+
branch = run.names.ticket(number)
|
|
206
|
+
if driver_slots.on_branch(slot) != branch or driver_slots.head(slot) != tip:
|
|
207
|
+
_block_landing(number, run, tip, f"the landing slot is no longer on {branch} at {tip[:7]}")
|
|
208
|
+
status = git(slot, "status", "--porcelain")
|
|
209
|
+
if status.returncode:
|
|
210
|
+
_block_landing(number, run, tip, f"cannot inspect the landing slot: {status.stderr.strip()}")
|
|
211
|
+
if status.stdout:
|
|
212
|
+
_block_landing(number, run, tip, f"the landing slot has uncommitted work: {status.stdout.strip()}")
|
|
204
213
|
|
|
205
214
|
|
|
206
215
|
def _checked_landing(ticket: Ticket, slot: str, run: Run, may_resolve: bool) -> _Landing:
|
|
207
|
-
"""The commit to land, with
|
|
216
|
+
"""The reviewed commit to land, with locked-file invariants checked. Call it under the merge lock."""
|
|
208
217
|
number = ticket.number
|
|
209
218
|
# An earlier try left the slot on its merge commit.
|
|
210
|
-
|
|
219
|
+
branch = run.names.ticket(number)
|
|
211
220
|
tip = run.state.ticket(number, phase="merge")["tip"]
|
|
221
|
+
checkout = git(slot, "checkout", "-q", branch)
|
|
222
|
+
if checkout.returncode:
|
|
223
|
+
_block_landing(number, run, tip, f"the landing checkout failed: {checkout.stderr.strip()}")
|
|
224
|
+
_landing_slot(number, slot, run, tip)
|
|
212
225
|
landing = _merge_commit(ticket, slot, run, tip, may_resolve)
|
|
226
|
+
_landing_slot(number, slot, run, landing.ticket_tip)
|
|
213
227
|
_refuse_breach(number, run, landing)
|
|
214
|
-
if landing.commit != landing.pr_tip:
|
|
215
|
-
# The full gate runs on the commit that lands, a fast-forward as well as a merge commit: a fast green record
|
|
216
|
-
# does not count. When the checkout fails, the slot is on another commit and the gate refuses to run.
|
|
217
|
-
git(slot, "checkout", "-q", "--detach", landing.commit)
|
|
218
|
-
if record := run.red_gate(number, slot, landing.commit, driver_gate.FULL):
|
|
219
|
-
_red_landing(number, slot, run, landing.commit, record)
|
|
220
228
|
return landing
|
|
221
229
|
|
|
222
230
|
|
|
@@ -246,7 +254,7 @@ def _record_landing(state: dict, number: str, landing: _Landing) -> None:
|
|
|
246
254
|
def _merge(ticket: Ticket, slot: str, run: Run) -> None:
|
|
247
255
|
"""Land the reviewed ticket tip on the PR branch, then delete the ticket branch."""
|
|
248
256
|
number, branch = ticket.number, run.names.ticket(ticket.number)
|
|
249
|
-
#
|
|
257
|
+
# Locked-file checks and conflict resolution run under the lock on the commit that lands.
|
|
250
258
|
with run.merging, during("the merge"):
|
|
251
259
|
landing = _land(ticket, slot, run)
|
|
252
260
|
run.state.update(lambda state: _record_landing(state, number, landing))
|
|
@@ -284,15 +292,10 @@ def _run_ticket(ticket: Ticket, slot_number: int, run: Run) -> bool:
|
|
|
284
292
|
try:
|
|
285
293
|
_run_roles(ticket, slot_number, run)
|
|
286
294
|
if not run.args.only:
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
try:
|
|
292
|
-
_merge(ticket, slot, run)
|
|
293
|
-
break
|
|
294
|
-
except driver_fixloop.Unlanded:
|
|
295
|
-
pass # the merge lock is released and the next fix round has started: its fixer runs now
|
|
295
|
+
# A ticket that an earlier run left in `merge` has passed its review.
|
|
296
|
+
if run.state.read()["tickets"][number]["phase"] != "merge":
|
|
297
|
+
driver_fixloop.run(ticket, slot, run, _prompt_values(ticket, slot, run))
|
|
298
|
+
_merge(ticket, slot, run)
|
|
296
299
|
except Blocked as blocked:
|
|
297
300
|
run.block(number, ledger(f"Ticket {number}: BLOCKED at {blocked}."))
|
|
298
301
|
print(f"{ticket.file}: BLOCKED at {blocked}")
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
A question in state.json `run.questions`; `answer` is None while it is open:
|
|
4
4
|
{id, title, why, evidence, options: [{id, description}], recommended, ticket, kind, subject, stop, answer,
|
|
5
|
-
resume: {phase[, tip][, round]}, the record fields a `retry` or a `keep-test` sets (`Resume`),
|
|
5
|
+
resume: {phase[, tip][, round][, gate_allowance]}, the record fields a `retry` or a `keep-test` sets (`Resume`),
|
|
6
6
|
ruling: the ruling sentence, once answered}
|
|
7
7
|
decisions.json: {run: <run.revision>, questions: [the open ones, first six fields], revision: <SHA-256 of the rest>}."""
|
|
8
8
|
from __future__ import annotations
|
|
@@ -25,11 +25,16 @@ class Resume(NamedTuple):
|
|
|
25
25
|
phase: str
|
|
26
26
|
tip: str | None = None # the tip it goes on from, for a role that commits
|
|
27
27
|
round: int | None = None # the fix rounds done, for a fixer: its own round runs again
|
|
28
|
+
gate_allowance: int | None = None # explicit operator grant for final integration repair
|
|
28
29
|
|
|
29
30
|
def fields(self) -> dict:
|
|
30
31
|
"""The fields of the record; one that is None stays as it is."""
|
|
31
32
|
return {name: value for name, value in self._asdict().items() if value is not None}
|
|
32
33
|
|
|
34
|
+
def checkpoint(self) -> dict:
|
|
35
|
+
"""Retain completed work at a stop without applying a future operator grant."""
|
|
36
|
+
return self._replace(gate_allowance=None).fields()
|
|
37
|
+
|
|
33
38
|
|
|
34
39
|
class Option(NamedTuple):
|
|
35
40
|
description: str
|
|
@@ -67,16 +72,16 @@ KINDS = {
|
|
|
67
72
|
"Ruling: {ticket} stays BLOCKED for an edit of the spec (edit-spec): {subject}.", False)}),
|
|
68
73
|
# The end of run asks it too, with the ticket `final`: for an agent, or for a finding open after the scoped review.
|
|
69
74
|
"ticket-blocked": Kind(
|
|
70
|
-
"{owner}: an agent stopped or was rejected, and its rerun too, or a final-review finding
|
|
75
|
+
"{owner}: an agent stopped or was rejected, and its rerun too, or a final-review finding or integration gate remains red: {subject}",
|
|
71
76
|
"An agent ran two times, using the same model for a timeout or moved branch and the next entry otherwise, "
|
|
72
|
-
"and stopped or was rejected both times; or the
|
|
73
|
-
"
|
|
74
|
-
"BLOCKED, each ticket that it blocks waits, and nothing is pushed.",
|
|
77
|
+
"and stopped or was rejected both times; or the final review left a finding open, or the integration gate "
|
|
78
|
+
"stayed red after its repair. {owner} is BLOCKED, each ticket that it blocks waits, and nothing is pushed.",
|
|
75
79
|
"retry",
|
|
76
80
|
{"retry": Option(
|
|
77
81
|
"The role runs again on its first entry from the tip the ticket left, with one rerun (the same model "
|
|
78
|
-
"for a timeout or moved branch, the next entry otherwise);
|
|
79
|
-
"
|
|
82
|
+
"for a timeout or moved branch, the next entry otherwise); an open final-review finding gets one more "
|
|
83
|
+
"fix batch and scoped review, and a red integration gate gets one more repair batch from its saved "
|
|
84
|
+
"log, followed by the full gate and review.",
|
|
80
85
|
"Ruling: {ticket} runs again (retry): {subject}.", True),
|
|
81
86
|
"edit": Option(
|
|
82
87
|
"Keep it BLOCKED, so the spec or the ticket can be edited before more work on it.",
|
|
@@ -32,6 +32,7 @@ from pathlib import Path
|
|
|
32
32
|
import driver_agents
|
|
33
33
|
import driver_decisions
|
|
34
34
|
import driver_gate
|
|
35
|
+
import driver_final_gate
|
|
35
36
|
import driver_locked
|
|
36
37
|
import driver_merge
|
|
37
38
|
import driver_review
|
|
@@ -243,7 +244,7 @@ def _run_rebase_conflict_agent(run: Run, values: dict) -> str:
|
|
|
243
244
|
|
|
244
245
|
|
|
245
246
|
def _resolve_rebase_conflict(run: Run, base: str, onto: str) -> None:
|
|
246
|
-
"""
|
|
247
|
+
"""Resolve the rebase in slot 1, with one agent rerun; the final integration gate checks its tip.
|
|
247
248
|
No rebase is open afterwards, also when this raises."""
|
|
248
249
|
files = _files_in_conflict()
|
|
249
250
|
values = {**_prompt_values(run), "branch": "HEAD", "start_sha": onto, "base": base, "files": " ".join(files)}
|
|
@@ -256,8 +257,6 @@ def _resolve_rebase_conflict(run: Run, base: str, onto: str) -> None:
|
|
|
256
257
|
if error:
|
|
257
258
|
raise Blocked(f"the conflict agent: {error}")
|
|
258
259
|
ledger(f"Rebase: the conflict agent resolved the conflict with {base} in {', '.join(files)} at {head('.')[:7]}.")
|
|
259
|
-
with during("the gate after the rebase"):
|
|
260
|
-
run.gate(FINAL, ".", head("."), driver_gate.FULL)
|
|
261
260
|
|
|
262
261
|
|
|
263
262
|
def _rebase(run: Run, tip: str, base: str, onto: str) -> None:
|
|
@@ -521,46 +520,68 @@ def _undo_rejected_batch(run: Run, tip: str) -> str:
|
|
|
521
520
|
commits = f"the commits of the batch end at {left} and stay in the reflog"
|
|
522
521
|
else:
|
|
523
522
|
commits = "the fixer made no commit"
|
|
524
|
-
ledger(f"End of run: the fix batch was rejected, so the driver moved {run.pr} back to its
|
|
523
|
+
ledger(f"End of run: the fix batch was rejected, so the driver moved {run.pr} back to its pre-batch tip "
|
|
525
524
|
f"{tip[:7]}; {commits}. The files of the fixer stay in slot 1 as they are.")
|
|
526
525
|
return ""
|
|
527
526
|
|
|
528
527
|
|
|
529
|
-
def
|
|
530
|
-
"""
|
|
528
|
+
def _fixer_call(run: Run, tickets: list[Ticket], final: dict, tip: str, gate_record: str = "") -> Call:
|
|
529
|
+
"""Build a final fixer call from review findings or the saved integration-gate failure."""
|
|
531
530
|
folder = OUT / FINAL
|
|
532
531
|
values = {**_prompt_values(run), "start_sha": tip, "findings": str(folder / f"findings-{final['round'] - 1}.json"),
|
|
533
532
|
"locked": " ".join(driver_locked.every(run.state.read()["tickets"])),
|
|
534
533
|
"must_fix_list": "\n".join(f"- {_title(finding)}" for finding in final["must_fix"]),
|
|
535
534
|
"findings_list": "\n".join(f"- {finding['severity']}: {_title(finding)}" for finding in final["open"])}
|
|
535
|
+
name = ""
|
|
536
|
+
if gate_record:
|
|
537
|
+
values.update(driver_final_gate.pointers(final, gate_record, tip))
|
|
538
|
+
name = f"gate-fixer-{final['gate_repairs']}"
|
|
536
539
|
tidied = final["tidied"]
|
|
540
|
+
return Call("fixer", FINAL, ".", values, template="final-gate-fixer" if gate_record else "final-fixer",
|
|
541
|
+
fix_round=final["round"], name=name,
|
|
542
|
+
check={"owners": [ticket.number for ticket in tickets],
|
|
543
|
+
"must_fix": [] if gate_record else [_title(finding) for finding in final["must_fix"]],
|
|
544
|
+
"fix": [values["gate_title"]] if gate_record else []},
|
|
545
|
+
locked=lambda _: driver_locked.for_end_of_run(run.state.read()["tickets"], tidied))
|
|
546
|
+
|
|
547
|
+
|
|
548
|
+
def _run_fixer(run: Run, tickets: list[Ticket], final: dict, tip: str, gate_record: str = "") -> dict:
|
|
549
|
+
"""Run the fixer on the PR branch in slot 1 and return its report. A rejected batch is undone."""
|
|
537
550
|
try:
|
|
538
|
-
return run.agent(
|
|
539
|
-
check={"owners": [ticket.number for ticket in tickets],
|
|
540
|
-
"must_fix": [_title(finding) for finding in final["must_fix"]]},
|
|
541
|
-
locked=lambda _: driver_locked.for_end_of_run(run.state.read()["tickets"], tidied)))
|
|
551
|
+
return run.agent(_fixer_call(run, tickets, final, tip, gate_record))
|
|
542
552
|
except Blocked as blocked:
|
|
543
553
|
raise Blocked(f"{blocked}{_undo_rejected_batch(run, tip)}") from None
|
|
544
554
|
except Halted as halted:
|
|
545
555
|
raise Halted(f"{halted}{_undo_rejected_batch(run, tip)}") from None
|
|
546
556
|
|
|
547
557
|
|
|
548
|
-
def
|
|
549
|
-
"""
|
|
558
|
+
def _name_batch(run: Run, tip: str, report: dict) -> list[str]:
|
|
559
|
+
"""Attribute new commits before gating/review; a validated gate-only no-op leaves the tip unchanged."""
|
|
560
|
+
made = git(".", "rev-list", "--reverse", f"{tip}..HEAD").stdout.split()
|
|
561
|
+
if not made:
|
|
562
|
+
return []
|
|
563
|
+
named = driver_tidy.rewrite(tip, [(commit, _fix_commit_message(commit, report)) for commit in made])
|
|
564
|
+
if not driver_tidy.same_tree(named[-1], made[-1]):
|
|
565
|
+
raise Blocked(f"the named commits do not have the tree of {made[-1][:7]}")
|
|
566
|
+
# Same tree: slot 1's index and working files remain correct as the ref moves.
|
|
567
|
+
if error := driver_merge.land(run.pr, named[-1], made[-1]):
|
|
568
|
+
raise Blocked(error)
|
|
569
|
+
return named
|
|
570
|
+
|
|
571
|
+
|
|
572
|
+
def _fix_batch(run: Run, tickets: list[Ticket], final: dict, tip: str, gate_record: str = "") -> None:
|
|
573
|
+
"""Run one bounded batch and settle its attributed tip before the next full gate."""
|
|
550
574
|
with during("the fix batch"):
|
|
551
|
-
report = _run_fixer(run, tickets, final, tip)
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
# Slot 1 has the branch checked out: the new tip has the same tree, so the index and the files stay right.
|
|
558
|
-
if error := driver_merge.land(run.pr, named[-1], made[-1]):
|
|
559
|
-
raise Blocked(error)
|
|
560
|
-
run.state.update(lambda state: state["run"]["final"].update(open=[], batch=named[-1]))
|
|
575
|
+
report = _run_fixer(run, tickets, final, tip, gate_record)
|
|
576
|
+
named = _name_batch(run, tip, report)
|
|
577
|
+
fields = dict(open=[], batch=named[-1] if named else tip)
|
|
578
|
+
if gate_record:
|
|
579
|
+
fields.update(gate_repairs=final["gate_repairs"] + 1, gate_failure=None)
|
|
580
|
+
run.state.update(lambda state: state["run"]["final"].update(fields))
|
|
561
581
|
subjects = ", ".join(f"{commit[:7]} {driver_tidy.text(commit).splitlines()[0]}" for commit in named)
|
|
562
|
-
|
|
563
|
-
|
|
582
|
+
label = "integration gate" if gate_record else "final review"
|
|
583
|
+
ledger(f"Fix batch of the {label}: {len(named)} commit{'s' if len(named) != 1 else ''} on {tip[:7]}: "
|
|
584
|
+
f"{subjects or 'no code change'}.")
|
|
564
585
|
|
|
565
586
|
|
|
566
587
|
def _review_until_reviewed(run: Run, tickets: list[Ticket]) -> None:
|
|
@@ -569,8 +590,10 @@ def _review_until_reviewed(run: Run, tickets: list[Ticket]) -> None:
|
|
|
569
590
|
final, tip = run.state.read()["run"]["final"], run.tip()
|
|
570
591
|
if final["reviewed"] != tip:
|
|
571
592
|
_check_review_is_due(run, final, tip)
|
|
572
|
-
with during("the gate"):
|
|
573
|
-
|
|
593
|
+
with during("the integration gate"):
|
|
594
|
+
if record := driver_final_gate.failure(run, tip):
|
|
595
|
+
_fix_batch(run, tickets, final, tip, record)
|
|
596
|
+
continue
|
|
574
597
|
_review(run, final, tip)
|
|
575
598
|
elif final["open"]: # after the full review, or after a `retry` of a finding the scoped review left open
|
|
576
599
|
_fix_batch(run, tickets, final, tip)
|
|
@@ -587,6 +610,13 @@ def _name(run: Run) -> str:
|
|
|
587
610
|
return next((line[2:].strip() for line in lines if line.startswith("# ")), run.pr)
|
|
588
611
|
|
|
589
612
|
|
|
613
|
+
def _review_coverage(final: dict) -> dict[str, str]:
|
|
614
|
+
"""The first full review may include gate repairs made after tidy; later reviews cover the remaining range."""
|
|
615
|
+
full_tip = next((lens["tip"] for lens in final["lenses"].values()), final["tidied"])
|
|
616
|
+
return {"full_review": f"{final['onto']}..{full_tip}",
|
|
617
|
+
"scoped": f"{full_tip}..{final['reviewed']}" if full_tip != final["reviewed"] else "not needed"}
|
|
618
|
+
|
|
619
|
+
|
|
590
620
|
def _facts(run: Run, final: dict, tickets: list[Ticket]) -> str:
|
|
591
621
|
"""The end of the PR body: the ticket-to-commit map, the fix commits, the rulings and the review coverage."""
|
|
592
622
|
titles, tip = {ticket.number: ticket.title for ticket in tickets}, final["reviewed"]
|
|
@@ -595,8 +625,7 @@ def _facts(run: Run, final: dict, tickets: list[Ticket]) -> str:
|
|
|
595
625
|
return driver_agents.render("pr-body", {
|
|
596
626
|
"map": "\n".join(f"- {number}: {commit[:7]} {titles[number]}" for number, commit in final["commits"].items()),
|
|
597
627
|
"fixes": fixes or "None.", "rulings": "\n".join(f"- {ruling}" for ruling in rulings) or "None.",
|
|
598
|
-
"tip": tip,
|
|
599
|
-
"scoped": f"{final['tidied']}..{tip}" if fixes else "not needed",
|
|
628
|
+
"tip": tip, **_review_coverage(final),
|
|
600
629
|
"providers": _review_providers(run.state.read()["run"]["agents"])})
|
|
601
630
|
|
|
602
631
|
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"""The full integration gate: one automatic repair batch, then an operator retry.
|
|
2
|
+
|
|
3
|
+
A red record is durable before repair starts. Interrupted repair resumes from it;
|
|
4
|
+
only an accepted batch spends the allowance. Ticket fix budgets never change.
|
|
5
|
+
"""
|
|
6
|
+
from __future__ import annotations
|
|
7
|
+
|
|
8
|
+
import json
|
|
9
|
+
|
|
10
|
+
import driver_gate
|
|
11
|
+
from driver_run import FINAL, FINAL_RESUME, OUT, Blocked, Run
|
|
12
|
+
|
|
13
|
+
RETRY_SUBJECT = 'the full integration gate remains red after its repair'
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def failure(run: Run, tip: str) -> str:
|
|
17
|
+
"""Return a repairable red record, empty for green, or park at the repair cap."""
|
|
18
|
+
state = run.state.read()
|
|
19
|
+
final = state['run']['final']
|
|
20
|
+
pending = final['gate_failure']
|
|
21
|
+
record = (pending['record'] if pending and pending['tip'] == tip
|
|
22
|
+
else run.red_gate(FINAL, '.', tip, driver_gate.FULL))
|
|
23
|
+
if not record:
|
|
24
|
+
return ''
|
|
25
|
+
run.state.update(lambda s: s['run']['final'].update(gate_failure=dict(tip=tip, record=record)))
|
|
26
|
+
if final['gate_repairs'] >= final['gate_allowance']:
|
|
27
|
+
subject = f'{RETRY_SUBJECT}: {tip[:7]}; read {record}'
|
|
28
|
+
run.ask(FINAL, 'ticket-blocked', [subject], record, FINAL_RESUME._replace(
|
|
29
|
+
gate_allowance=final['gate_repairs'] + 1))
|
|
30
|
+
raise Blocked(subject)
|
|
31
|
+
return record
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def pointers(final: dict, record: str, tip: str) -> dict[str, str]:
|
|
35
|
+
"""Keep gate-repair evidence separate from review findings and reports."""
|
|
36
|
+
finding = dict(severity='critical', kind='code', source='gate', file=record, line=0,
|
|
37
|
+
title=f'the full integration gate is red on {tip[:7]}',
|
|
38
|
+
evidence=f'Read the exact failure log: {record}')
|
|
39
|
+
path = OUT / FINAL / f"gate-findings-{final['gate_repairs']}.json"
|
|
40
|
+
path.write_text(json.dumps([finding], indent=1) + '\n')
|
|
41
|
+
return dict(gate_title=finding["title"], findings=str(path), findings_list=f"- critical: {finding['title']}; read {record}")
|
|
@@ -263,33 +263,6 @@ def _act_on(job: Job, found: list[dict]) -> bool:
|
|
|
263
263
|
return False
|
|
264
264
|
|
|
265
265
|
|
|
266
|
-
class Unlanded(Exception):
|
|
267
|
-
"""The full gate is red on the commit that would land, and the next fix round of the ticket has started."""
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
def red_landing(run: Run, number: str, slot: str, commit: str, record: str) -> None:
|
|
271
|
-
"""The full gate is red on `commit`, the commit that would land: the PR branch does not move. At round 2 that
|
|
272
|
-
blocks. Before it, the record is a critical `gate` finding for the next round, which starts in the same write of
|
|
273
|
-
state.json that leaves the landing, so a resumed run starts that round's fixer and never gates `commit` again.
|
|
274
|
-
Call it with the ticket branch checked out in the slot: the fixer works there."""
|
|
275
|
-
entry = run.state.read()["tickets"][number]
|
|
276
|
-
if entry["round"] == ROUNDS:
|
|
277
|
-
raise Blocked(f"the full gate is red on {commit[:7]}, record {record}")
|
|
278
|
-
path = os.path.relpath(record, slot)
|
|
279
|
-
finding = {"severity": "critical", "file": path, "line": 0, "title": f"the full gate is red on {commit[:7]}",
|
|
280
|
-
"evidence": f"the output of the gate in {path}", "kind": "code", "source": "gate"}
|
|
281
|
-
# The fixer reads the findings of the last review: its minor findings stay there for the final review.
|
|
282
|
-
file = OUT / number / f"findings-{entry['round']}.json"
|
|
283
|
-
found = json.loads(file.read_text()) if file.exists() else []
|
|
284
|
-
if finding["title"] not in [old["title"] for old in found]: # a run stopped before the round gated it again
|
|
285
|
-
file.write_text(json.dumps(found + [finding], indent=1) + "\n")
|
|
286
|
-
_log_findings(number, [finding])
|
|
287
|
-
run.state.ticket(number, phase="fix", round=entry["round"] + 1, landing=commit)
|
|
288
|
-
ledger(f"Ticket {number}: the full gate is red on {commit[:7]} at the landing, so {run.pr} does not move and fix "
|
|
289
|
-
f"round {entry['round'] + 1} starts.")
|
|
290
|
-
raise Unlanded()
|
|
291
|
-
|
|
292
|
-
|
|
293
266
|
def _gate(job: Job) -> list[dict]:
|
|
294
267
|
"""Fast-gate the candidate tip. A red gate before round 2 is a finding for the next round;
|
|
295
268
|
a red gate after round 2 or on a test-writer correction blocks. Returns the findings: the red gate,
|
|
@@ -103,7 +103,7 @@ def _unchanged_errors(role: str, report: dict, context: dict) -> list[str]:
|
|
|
103
103
|
uncommitted, the gate of the start is green, and a concern says why no change is needed: for a fixer, one
|
|
104
104
|
concern names each finding."""
|
|
105
105
|
done = report["status"] in ("DONE", "DONE_WITH_CONCERNS")
|
|
106
|
-
if role not in ("implementer", "fixer") or report["commits"] or not done:
|
|
106
|
+
if role not in ("implementer", "fixer", "final-gate-fixer") or report["commits"] or not done:
|
|
107
107
|
return []
|
|
108
108
|
titles = context.get("fix", [])
|
|
109
109
|
errors = _moved_errors(context) + [
|
|
@@ -143,7 +143,7 @@ class Run:
|
|
|
143
143
|
def change(state: dict) -> None:
|
|
144
144
|
held = record_of(state, number)
|
|
145
145
|
if ask:
|
|
146
|
-
held.update(ask.resume.
|
|
146
|
+
held.update(ask.resume.checkpoint())
|
|
147
147
|
evidence = [ask.report, f"{OUT / 'ledger.md'}:{line}"]
|
|
148
148
|
driver_decisions.stop(state["run"], ask.kind, number, ask.subjects, evidence, ask.resume)
|
|
149
149
|
held["phase"] = "blocked"
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
landing, disputes, corrected, settled}}}
|
|
7
7
|
|
|
8
8
|
green_gates is {"fast": [commit], "full": [commit]}, in a ticket and in run.final: a fast green never stands in for a
|
|
9
|
-
full one. landing is
|
|
9
|
+
full one. landing is a legacy commit whose full gate was red at the landing while the fixer of the round it started has
|
|
10
10
|
not reported, else None. disputes is {<locked file>::<test>: {test, requirement, ruling, reason}}, the reviewer's
|
|
11
11
|
ruling on the test; corrected is {<locked file>::<test>: {test, requirement, reason}}, the reading of its one
|
|
12
12
|
correction. A locked test has at most one of each per ticket. settled counts the arbitrations and review corrections
|
|
@@ -43,7 +43,7 @@ def _final() -> dict:
|
|
|
43
43
|
"""The end-of-run record before it starts. Every key is here, so a reader uses [] and a wrong name fails."""
|
|
44
44
|
return {"skipped": "", "phase": "pending", "recovery": None, "tidied": None, "onto": None, "base": None,
|
|
45
45
|
"commits": {}, "reviewed": None, "round": 0, "open": [], "must_fix": [], "lenses": {}, "batch": None,
|
|
46
|
-
"green_gates": tiers(), "pushed": None, "body": None, "pr": None}
|
|
46
|
+
"gate_repairs": 0, "gate_allowance": 1, "gate_failure": None, "green_gates": tiers(), "pushed": None, "body": None, "pr": None}
|
|
47
47
|
|
|
48
48
|
|
|
49
49
|
class State:
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Fixer of the full integration gate
|
|
2
|
+
|
|
3
|
+
Spec: {spec}
|
|
4
|
+
Tickets: {tickets}
|
|
5
|
+
PR branch: {pr_branch}, at commit {start_sha}
|
|
6
|
+
Locked files: {locked}
|
|
7
|
+
Failure findings: {findings}
|
|
8
|
+
{findings_list}
|
|
9
|
+
|
|
10
|
+
Read the exact gate log and repair the failure as one batch. Each commit belongs to one ticket; list its SHA and ticket number in `commits`. The driver names it `fix(NN): <subject>`.
|
|
11
|
+
If no code change is needed, leave the branch and tracked files unchanged, report no commits, and give a concern naming "{gate_title}" with the evidence explaining why. This still consumes the repair attempt. The driver reruns the full gate on the unchanged commit; another failure stops for the operator.
|
|
12
|
+
Never edit a locked file: each one stays as it is at {start_sha}. Report a needed test correction in your concerns and stop BLOCKED for the operator.
|
|
13
|
+
Use targeted tests while you work. Before you report DONE or DONE_WITH_CONCERNS, make the fast gate green on your final commit: run `{gate}` with IMPLEMENT_SPEC_BASE={pr_branch} and IMPLEMENT_SPEC_LOCKED='{locked}' in the environment. Give its summary lines in `green`.
|
|
14
|
+
Commit on the checked-out PR branch, changing no existing commit. Do not dispatch subagents. The full gate and final review follow this batch.
|
|
15
|
+
|
|
16
|
+
Write one JSON report at {report} that matches this schema:
|
|
17
|
+
|
|
18
|
+
```json
|
|
19
|
+
{
|
|
20
|
+
"type": "object",
|
|
21
|
+
"required": ["status", "commits", "files", "concerns", "green"],
|
|
22
|
+
"properties": {
|
|
23
|
+
"status": {"enum": ["DONE", "DONE_WITH_CONCERNS", "NEEDS_CONTEXT", "BLOCKED"]},
|
|
24
|
+
"commits": {"type": "array", "items": {"type": "object", "required": ["sha", "ticket"], "properties": {"sha": {"type": "string", "pattern": "^[0-9a-f]{7,40}$"}, "ticket": {"type": "string", "pattern": "^[0-9]+$"}}}},
|
|
25
|
+
"files": {"type": "array", "items": {"type": "string"}},
|
|
26
|
+
"concerns": {"type": "array", "items": {"type": "string"}},
|
|
27
|
+
"green": {"type": "array", "items": {"type": "string"}}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Stop only processes you started and their child processes, by PID (for example the PID of a job you put in the background, or its process group). Never kill a process you did not start, and never use `pkill`, `killall` or a `kill` by name or pattern: other slots and sessions share the machine. If a process you did not start blocks you, report it in your concerns and do not kill it.
|
|
33
|
+
Never run `git stash`, never reset, and never check out another branch: worktrees share one stash and one ref store.
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
|
|
2
|
+
An earlier driver version passed review and then ran the full gate on {landing_sha}, the commit that would land on {pr_branch}, and it is red: read the output in {landing_record}. The finding from the `gate` in the findings file is that record. Make it green with a commit on {branch}; the driver runs the fast gate on your commit, a re-review, and the full gate after every ticket has merged.
|
|
@@ -4,7 +4,7 @@ One commit per ticket, in merge order:
|
|
|
4
4
|
|
|
5
5
|
{map}
|
|
6
6
|
|
|
7
|
-
## Fix commits of the
|
|
7
|
+
## Fix commits of the integrated branch
|
|
8
8
|
|
|
9
9
|
{fixes}
|
|
10
10
|
|
|
@@ -15,6 +15,6 @@ One commit per ticket, in merge order:
|
|
|
15
15
|
## Review coverage
|
|
16
16
|
|
|
17
17
|
- Branch tip and reviewed tip: {tip}
|
|
18
|
-
- Full review: {
|
|
18
|
+
- Full review: {full_review}
|
|
19
19
|
- Scoped review after the fix batch: {scoped}
|
|
20
20
|
{providers}
|