Instruct agents to open unfinished PRs as drafts #68

Closed
opened 2026-10-26 13:29:50 +01:00 by omp-deck · 0 comments
Collaborator

Problem

Add explicit instructions to forgejo_create_pr that an unfinished PR should be created as draft/WIP and later updated when all expected changes are pushed and it's ready for review.

Drafts are already supported: forgejo_create_pr takes draft: true, which (via draftTitle in apps/server/src/forgejo/tools/prs.ts) prefixes the title with WIP: ; Forgejo treats WIP:/[WIP]-prefixed titles as drafts. What is missing is guidance telling agents when to use it and how to mark the PR ready afterwards. Marking ready stays documentation-only: forgejo_update_pr with the title minus the WIP prefix (no new parameter).

Plan

Approach

All edits are tool-description / system-context strings; no behavior change.

  1. forgejo_create_pr description (apps/server/src/forgejo/tools/prs.ts, createPr.description, ~line 327): replace the last sentence Set \draft` to open it as a work-in-progress draft.with:If the work is not finished yet (more commits are expected, or it is not ready for review), you MUST set `draft: true`. Once all expected changes are pushed and the PR is ready for review, mark it ready with forgejo_update_pr by setting `title` to the title without its `WIP:`/`[WIP]` prefix.Also change thedraftparam.describe(...)(~line 338) to:"Open as a draft (work in progress); required while the PR is unfinished. Prefixes the title with `WIP: ` unless it already has a WIP prefix"`.
  2. forgejo_update_pr description (same file, updatePr.description, ~line 408): append the sentence
    To mark a draft PR ready for review, set \title` to its title without the `WIP:`/`[WIP]` prefix; to turn it back into a draft, add `WIP: ` in front.`
  3. System context (apps/server/src/forgejo/tools/context.ts, buildForgejoSystemContext, "### Pull request lifecycle" list, ~line 31): add as the first bullet:
    - Open an unfinished pull request as a draft (\forgejo_create_pr` with `draft: true`). When all expected changes are pushed and it is ready for review, remove the `WIP:` prefix from its title with `forgejo_update_pr`.`

The unattended implementer prompt in apps/server/src/bridge/session-policy.ts (~line 344) is left unchanged: it opens the PR once the work is done.

Verification

  • cd apps/server && bun test src/forgejo/tools passes (no test pins these strings; prs.test.ts draftTitle tests untouched).
  • bun run typecheck (repo root) passes.
  • Manual: start a deck session in this repo and confirm the system prompt's "Pull request lifecycle" section contains the new draft bullet and xd://forgejo_create_pr docs show the new sentence.
## Problem Add explicit instructions to `forgejo_create_pr` that an unfinished PR should be created as draft/WIP and later updated when all expected changes are pushed and it's ready for review. Drafts are already supported: `forgejo_create_pr` takes `draft: true`, which (via `draftTitle` in `apps/server/src/forgejo/tools/prs.ts`) prefixes the title with `WIP: `; Forgejo treats `WIP:`/`[WIP]`-prefixed titles as drafts. What is missing is guidance telling agents *when* to use it and *how* to mark the PR ready afterwards. Marking ready stays documentation-only: `forgejo_update_pr` with the title minus the WIP prefix (no new parameter). ## Plan ### Approach All edits are tool-description / system-context strings; no behavior change. 1. **`forgejo_create_pr` description** (`apps/server/src/forgejo/tools/prs.ts`, `createPr.description`, ~line 327): replace the last sentence `Set \`draft\` to open it as a work-in-progress draft.` with: `If the work is not finished yet (more commits are expected, or it is not ready for review), you MUST set \`draft: true\`. Once all expected changes are pushed and the PR is ready for review, mark it ready with forgejo_update_pr by setting \`title\` to the title without its \`WIP:\`/\`[WIP]\` prefix.` Also change the `draft` param `.describe(...)` (~line 338) to: `"Open as a draft (work in progress); required while the PR is unfinished. Prefixes the title with \`WIP: \` unless it already has a WIP prefix"`. 2. **`forgejo_update_pr` description** (same file, `updatePr.description`, ~line 408): append the sentence `To mark a draft PR ready for review, set \`title\` to its title without the \`WIP:\`/\`[WIP]\` prefix; to turn it back into a draft, add \`WIP: \` in front.` 3. **System context** (`apps/server/src/forgejo/tools/context.ts`, `buildForgejoSystemContext`, "### Pull request lifecycle" list, ~line 31): add as the first bullet: `- Open an unfinished pull request as a draft (\`forgejo_create_pr\` with \`draft: true\`). When all expected changes are pushed and it is ready for review, remove the \`WIP:\` prefix from its title with \`forgejo_update_pr\`.` The unattended implementer prompt in `apps/server/src/bridge/session-policy.ts` (~line 344) is left unchanged: it opens the PR once the work is done. ### Verification - `cd apps/server && bun test src/forgejo/tools` passes (no test pins these strings; `prs.test.ts` `draftTitle` tests untouched). - `bun run typecheck` (repo root) passes. - Manual: start a deck session in this repo and confirm the system prompt's "Pull request lifecycle" section contains the new draft bullet and `xd://forgejo_create_pr` docs show the new sentence.
lucas closed this issue 2026-10-26 13:32:19 +01:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
lucas/omp-deck#68
No description provided.