-
Notifications
You must be signed in to change notification settings - Fork 26
feat(gastown): skip review queue for mayor-dispatched PR fixup polecats #1982
Description
Problem
When the mayor dispatches a polecat to fix a PR (e.g., addressing PR comments or fixing CI checks), the polecat calls gt_done which submits the work to the review queue, creating a new MR bead and triggering a full refinery review cycle. This is unnecessary — the work is already associated with an existing PR and doesn't need a separate review.
Proposed Solution
Introduce a gt:pr-fixup label (mirroring the existing gt:rework skip pattern) and bake PR-comment-addressing instructions into the polecat prompt.
Implementation Plan
-
Add
gt:pr-fixuplabel skip inreview-queue.tsagentDone()— beads with this label close directly without submitting to the review queue, same asgt:reworkdoes today (line ~571). -
Add
labelsparameter togt_slingtool — thread it through the full chain:mayor-tools.ts→client.ts→mayor-tools.handler.ts(MayorSlingBody) →Town.do.ts(slingBead()) →beadOps.createBead()(which already acceptslabels). This lets the mayor tag beads asgt:pr-fixupat creation time. -
Add PR-fixup context injection in
agents.tsbuildPrimeContext— similar to howrework_contextis built forgt:reworkbeads, build apr_fixup_contextforgt:pr-fixupbeads containing the PR URL, branch, and relevant metadata. -
Bake PR-comment-addressing prompt into polecat system prompt — for
gt:pr-fixupbeads, inject instructions like:Take a look at all of the comments on the PR and address them. If they're not relevant comments, then reply on why they're not relevant and then resolve them. If they are relevant, then fix the issue, push up the change, and reply with how you fixed it and then resolve the thread. It's important to resolve the thread rather than just the base comment.
-
Update mayor system prompt — add instructions for when/how to use the
gt:pr-fixuplabel when dispatching polecats for PR comment or CI fix work.
Why Not Prompt-Only?
Considered instructing the polecat to call gt_bead_close instead of gt_done, but:
gt_donerecords branch name and summary (useful for audit)- LLMs don't reliably follow negative instructions
- The label-based skip pattern is already battle-tested with
gt:rework
Existing Pattern
The gt:rework label already implements this exact skip mechanism in review-queue.ts:
if (hookedBead?.labels.includes('gt:rework')) {
closeBead(sql, agent.current_hook_bead_id, agentId);
unhookBead(sql, agentId);
return; // Skip review queue
}The gt:pr-fixup implementation follows the same pattern.
Files to Change
cloudflare-gastown/src/dos/town/review-queue.ts— add label check inagentDone()cloudflare-gastown/container/plugin/mayor-tools.ts— addlabelsparam togt_slingcloudflare-gastown/container/plugin/client.ts— threadlabelsthrough sling clientcloudflare-gastown/src/handlers/mayor-tools.handler.ts— addlabelstoMayorSlingBodyschemacloudflare-gastown/src/dos/Town.do.ts— passlabelsthroughslingBead()cloudflare-gastown/src/dos/town/agents.ts— addpr_fixup_contextinbuildPrimeContextcloudflare-gastown/src/prompts/polecat-system.prompt.ts— add PR-fixup workflow sectioncloudflare-gastown/src/prompts/mayor-system.prompt.ts— add PR-fixup sling instructions