Keep the label extra on scope fix-up cores

This commit is contained in:
aiongg committed 2026-11-06 21:14:32 +00:00
1 parent af6221505b
commit d1beb6625f
3 files changed
+7 -9

No files matched your search

+1 -1
View File
@@ -383,7 +383,7 @@ The Queue page API (`GET /api/queue/page?tab=all|review|fix|verify|merge&repos=p
A resolution card's `fixup` step with `merge` set is an operator's Merge answer given ahead of a fix-up. A `fixup` step without it only queues the fix-up, and a `review` step marks the head's review stale so Opus reviews it again.
On a scope question the fix-up cores name the keep answer they record: "Small extra: fix up, then merge" (`fixup-merge:small-extra`) and "Wanted in core: fix up, then merge" (`fixup-merge:take`), and for the fix-up alone `x:fixup:small-extra` and `x:fixup:take`. Their resolution card settles with that answer instead of as handled, and a label extra for the label the answer sets is left out. Validation allows a `fixup` step together with an answer settle in exactly this case (a scope decision, answer `take` or `small-extra`). The card records the answer after its other steps and before the fix-up is queued, so the fix-up's plan check and the later review see the PR in core and a merge can follow. If the fix-up cannot be queued, the step error says the question is answered. Choices stored under the plain `fixup-merge` or `x:fixup` key on a scope decision read as the small-extra core when they tick the "small extra" label and as the take core otherwise.
On a scope question the fix-up cores name the keep answer they record: "Small extra: fix up, then merge" (`fixup-merge:small-extra`) and "Wanted in core: fix up, then merge" (`fixup-merge:take`), and for the fix-up alone `x:fixup:small-extra` and `x:fixup:take`. Their resolution card settles with that answer instead of as handled. Validation allows a `fixup` step together with an answer settle in exactly this case (a scope decision, answer `take` or `small-extra`). The card records the answer after its other steps and before the fix-up is queued, so the fix-up's plan check and the later review see the PR in core and a merge can follow. If the fix-up cannot be queued, the step error says the question is answered. Choices stored under the plain `fixup-merge` or `x:fixup` key on a scope decision read as the small-extra core when they tick the "small extra" label and as the take core otherwise.
- **Fix-up.** The operator's instructions (1 to 1500 characters, never posted) are queued per head (`operator_fixups`). The Fix-up step works them with source `operator` in its `fixups` rows: the model gets the instructions as a trusted `operator` block in place of the fix list, may edit any existing file of the repository except what every fix-up refuses (CI workflows, cargo configuration, build scripts, files that instruct coding agents) and the build and trust files (`Cargo.toml`, `Cargo.lock`, `rust-toolchain*`, `.gitmodules`, `.gitattributes`, `CODEOWNERS`, `.claude/`), and the patch goes through the same checks, lint and push approval as any fix-up. The PR's tries (2) apply to operator fix-ups as to the review's. After a push the comment on the PR reads "Fixes included:" and a numbered list of what the fix-up changed, taken from the model's own `CHANGES:` list after its diff (the files when it gave none), each item cleaned to one plain line, left out when it repeats a run of 12 words of the instructions, and checked by the reference lint; the instructions are never quoted. The review's own fix-up and the merge queue leave the PR alone while the pre-approval is before its Merge answer.
- **States** (`preapprovals`, shown as `Item.preapproval`): `fixup` (queued or running), `review` (the push's head waits for its Opus review), `ci` (the review says take, is sure and not stale; waiting for CI, then for a clean pre-merge review of the head), `queued`, `merged`, `asked`, `cancelled`, `failed`. Each change is evaluated on the runner's tick from rows other steps write (fixups, reviews, checks, the mirrored head, merges), so it has no timer and no wait of its own (the one time comparison is made on the tick, as the next paragraphs say). Each one writes an audit row (`preapproval`) and a system line in the item's conversation.
+2 -6
View File
@@ -46,8 +46,6 @@ export const EXTRA_TAG: Record<ExtraKind, ActionTag> = {
const NON_ENDING: ExtraKind[] = ["comment", "label", "unlabel", "assign", "request_reviewers", "open_issue"];
/** Extra kinds always offered (with empty text) when the core takes them; the others only when Opus drafted them. */
const ALWAYS: ExtraKind[] = ["comment", "open_issue"];
/** The label a keep answer stands for; an extra that adds it is left out of the card, since the answer already sets it. */
export const keepLabel = (keep: KeepAnswer): string => (keep === "small-extra" ? "small extra" : "missing feature");
const KEEP_LABEL_NAME: Record<KeepAnswer, string> = { "small-extra": "Small extra", take: "Wanted in core" };
const KEEPS: KeepAnswer[] = ["small-extra", "take"];
const NO_ISSUE_OPTIONS = (key: string): boolean => key === "hold" || key === "need-info" || key.startsWith("keep");
@@ -207,8 +205,7 @@ export function applyDrafts(db: DatabaseSync, d: DecisionRow, cores: Core[], row
}
return all.map((core) => {
const draft: StoredDraft | undefined = row?.drafts[core.key];
const keep = "keep" in core.parsed ? core.parsed.keep : undefined;
const extras = (draft?.extras ?? []).filter((e) => core.allowed.includes(e.kind) && !(keep && e.kind === "label" && e.label === keepLabel(keep))).map((e) => viewExtra(e, core, d));
const extras = (draft?.extras ?? []).filter((e) => core.allowed.includes(e.kind)).map((e) => viewExtra(e, core, d));
for (const kind of ALWAYS) {
if (core.allowed.includes(kind) && !extras.some((e) => e.kind === kind)) {
extras.push(viewExtra({ id: kind, kind, on: false, ...(kind === "comment" ? { text: "" } : { title: "", body: "" }) }, core, d));
@@ -236,8 +233,7 @@ export function compose(core: Core, extras: ComposeExtra[], params: { reason?: s
const steps: Record<string, unknown>[] = [];
let text: string | undefined;
for (const e of of("comment")) { steps.push({ kind: "comment" }); text = e.text; }
const keep = "keep" in core.parsed ? core.parsed.keep : undefined;
for (const e of of("label")) if (!(keep && e.label === keepLabel(keep))) steps.push({ kind: "label", label: e.label });
for (const e of of("label")) steps.push({ kind: "label", label: e.label });
for (const e of of("unlabel")) steps.push({ kind: "unlabel", label: e.label });
for (const e of of("assign")) steps.push({ kind: "assign", login: e.login });
for (const e of of("request_reviewers")) steps.push({ kind: "request_reviewers", logins: e.logins });
+4 -2
View File
@@ -213,8 +213,10 @@ describe("decision choices", () => {
ask(db, [{ id: "app#5:scope", kind: "scope", repo: "app", number: 5, question: "Scope?", options: Object.values(SCOPE_OPTIONS).map((o) => ({ key: o.key, label: o.label })) }]);
const keys = coresFor(db, getDecision(db, "app#5:scope")!).map((c) => c.key);
assert.ok(keys.includes("fixup-merge:small-extra") && keys.includes("fixup-merge:take") && !keys.includes("fixup-merge"), keys.join());
// The "small extra" label is what the answer sets, so ticking it adds no step.
const { composed } = choose(db, "app#5:scope", "fixup-merge:small-extra", [{ id: "label:small extra", kind: "label", label: "small extra" }], { instructions: "Rename a to b." });
// The answer writes nothing to GitHub, so a ticked label stays a step.
const withLabel = choose(db, "app#5:scope", "fixup-merge:small-extra", [{ id: "label:small extra", kind: "label", label: "small extra" }], { instructions: "Rename a to b." }).composed;
assert.ok("card" in withLabel && (withLabel.card.steps as { kind: string }[]).map((x) => x.kind).join() === "label,fixup");
const { composed } = choose(db, "app#5:scope", "fixup-merge:small-extra", [], { instructions: "Rename a to b." });
assert.ok("card" in composed);
const v = validateCard(db, "app", 5, composed.card);
assert.ok("card" in v, "note" in v ? v.note : "");