From 4420e355712172dc5f2d0633a9d3b8df56ccd242 Mon Sep 17 00:00:00 2001 From: John Fawcett Date: Fri, 3 Apr 2026 20:56:45 +0000 Subject: [PATCH 1/3] feat(gastown): add PR-fixup workflow to polecat and mayor system prompts Add instructions for the gt:pr-fixup workflow: - Polecat prompt: how to handle PR fixup beads (check out branch, address review comments, resolve threads, push to existing branch) - Mayor prompt: how to dispatch PR fixup beads using gt_sling with the gt:pr-fixup label and appropriate metadata --- .../src/prompts/mayor-system.prompt.ts | 20 +++++++++++++++++++ .../src/prompts/polecat-system.prompt.ts | 14 +++++++++++++ 2 files changed, 34 insertions(+) diff --git a/cloudflare-gastown/src/prompts/mayor-system.prompt.ts b/cloudflare-gastown/src/prompts/mayor-system.prompt.ts index 10ce483c4e..0bf1d7808a 100644 --- a/cloudflare-gastown/src/prompts/mayor-system.prompt.ts +++ b/cloudflare-gastown/src/prompts/mayor-system.prompt.ts @@ -284,6 +284,26 @@ For large convoys (>5 beads) where the decomposition is non-obvious, consider using staged=true by default to give the user a chance to review before agents start spending compute. +## PR Fixup Dispatch + +When you need to dispatch a polecat to fix PR review comments or CI failures on an existing PR: + +1. Use \`gt_sling\` with the \`labels\` parameter set to \`["gt:pr-fixup"]\` +2. Include the PR URL, branch name, and target branch in the bead metadata: + \`\`\` + metadata: JSON.stringify({ + pr_url: "https://github.com/org/repo/pull/123", + branch: "gt/toast/abc123", + target_branch: "main" + }) + \`\`\` +3. In the bead body, include: + - The PR URL + - What needs fixing (specific review comments, CI failures, etc.) + - The branch to work on + +The \`gt:pr-fixup\` label causes the bead to skip the review queue when the polecat calls gt_done — the work goes directly to the existing PR branch without creating a separate review cycle. + ## Bug Reporting If a user reports a bug or you encounter a repeating error, you can file a bug report diff --git a/cloudflare-gastown/src/prompts/polecat-system.prompt.ts b/cloudflare-gastown/src/prompts/polecat-system.prompt.ts index ea57e1077b..63638b7172 100644 --- a/cloudflare-gastown/src/prompts/polecat-system.prompt.ts +++ b/cloudflare-gastown/src/prompts/polecat-system.prompt.ts @@ -58,6 +58,20 @@ You have these tools available. Use them to coordinate with the Gastown orchestr 4. **Checkpoint**: After significant milestones, call gt_checkpoint with a summary of progress. 5. **Done**: When the bead is complete, push your branch and call gt_done with the branch name. The bead transitions to \`in_review\` and the refinery picks it up for merge. If the review fails (rework), you will be re-dispatched with the bead back in \`in_progress\`. ${gatesSection} +## PR Fixup Workflow + +When your hooked bead has the \`gt:pr-fixup\` label, you are fixing an existing PR rather than creating new work: + +1. Check out the PR branch specified in your bead metadata. +2. Look at ALL comments on the PR using \`gh pr view --comments\` and the GitHub API. +3. For each review comment thread: + - If the comment is actionable: fix the issue, push the fix, reply explaining how you fixed it, and resolve the thread. + - If the comment is not relevant or is incorrect: reply explaining why, and resolve the thread. +4. **Important**: Resolve the entire thread, not just the individual comment. Use \`gh api\` to resolve review threads. +5. After addressing all comments, push your changes and call gt_done. + +Do NOT create a new PR. Push to the existing branch. + ## Commit & Push Hygiene - Commit after every meaningful unit of work (new function, passing test, config change). From e3e0b1e2eeacce87f2669123d6728653b4aadfa8 Mon Sep 17 00:00:00 2001 From: John Fawcett Date: Fri, 3 Apr 2026 21:02:45 +0000 Subject: [PATCH 2/3] WIP: container eviction save From 261f601495c683b371d06e45ccecbf544b54fdee Mon Sep 17 00:00:00 2001 From: John Fawcett Date: Fri, 3 Apr 2026 21:40:52 +0000 Subject: [PATCH 3/3] =?UTF-8?q?fix:=20address=20PR=20#1989=20review=20comm?= =?UTF-8?q?ents=20=E2=80=94=20metadata=20type=20and=20branch=20conflict?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Remove JSON.stringify wrapper from metadata example in mayor prompt so it passes gt_sling's z.record(z.string(), z.unknown()) validation as a plain object. - Clarify polecat PR fixup workflow as the explicit exception to the 'do not switch branches' rule, and add exception note in Commit & Push Hygiene section. --- cloudflare-gastown/src/prompts/mayor-system.prompt.ts | 4 ++-- cloudflare-gastown/src/prompts/polecat-system.prompt.ts | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/cloudflare-gastown/src/prompts/mayor-system.prompt.ts b/cloudflare-gastown/src/prompts/mayor-system.prompt.ts index 0bf1d7808a..78c3b6d347 100644 --- a/cloudflare-gastown/src/prompts/mayor-system.prompt.ts +++ b/cloudflare-gastown/src/prompts/mayor-system.prompt.ts @@ -291,11 +291,11 @@ When you need to dispatch a polecat to fix PR review comments or CI failures on 1. Use \`gt_sling\` with the \`labels\` parameter set to \`["gt:pr-fixup"]\` 2. Include the PR URL, branch name, and target branch in the bead metadata: \`\`\` - metadata: JSON.stringify({ + metadata: { pr_url: "https://github.com/org/repo/pull/123", branch: "gt/toast/abc123", target_branch: "main" - }) + } \`\`\` 3. In the bead body, include: - The PR URL diff --git a/cloudflare-gastown/src/prompts/polecat-system.prompt.ts b/cloudflare-gastown/src/prompts/polecat-system.prompt.ts index 63638b7172..dc45e8f45c 100644 --- a/cloudflare-gastown/src/prompts/polecat-system.prompt.ts +++ b/cloudflare-gastown/src/prompts/polecat-system.prompt.ts @@ -60,9 +60,9 @@ You have these tools available. Use them to coordinate with the Gastown orchestr ${gatesSection} ## PR Fixup Workflow -When your hooked bead has the \`gt:pr-fixup\` label, you are fixing an existing PR rather than creating new work: +When your hooked bead has the \`gt:pr-fixup\` label, you are fixing an existing PR rather than creating new work. **This is the ONE exception to the "do not switch branches" rule.** You MUST check out the PR branch from your bead metadata instead of using the default worktree branch. -1. Check out the PR branch specified in your bead metadata. +1. Check out the PR branch specified in your bead metadata (e.g. \`git fetch origin && git checkout \`). This overrides the default worktree branch for this bead. 2. Look at ALL comments on the PR using \`gh pr view --comments\` and the GitHub API. 3. For each review comment thread: - If the comment is actionable: fix the issue, push the fix, reply explaining how you fixed it, and resolve the thread. @@ -77,7 +77,7 @@ Do NOT create a new PR. Push to the existing branch. - Commit after every meaningful unit of work (new function, passing test, config change). - Push after every commit. Do not batch pushes. - Use descriptive commit messages referencing the bead if applicable. -- Branch naming: your branch is pre-configured in your worktree. Do not switch branches. +- Branch naming: your branch is pre-configured in your worktree. Do not switch branches — **unless** your bead has the \`gt:pr-fixup\` label (see PR Fixup Workflow above). ## Escalation