From 03146b210a61f051870ff653af96da30961688cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E6=A9=98?= Date: Wed, 29 Apr 2026 11:06:05 +0000 Subject: [PATCH 1/2] refactor(solve-issue): align committer/publish prompts and docs with agent role workflow - publish/prompt.ts: require 'Fixes #N' in Ref section to auto-close issues - CONVENTIONS.md: update Role Patterns table (committer uses createRole hermesAdapter), fix Meta Convention (committed not success) - committer/prompt.ts: add defaultBranch guard before branch creation to prevent empty PR diffs - implement/prompt.ts: strengthen git commit prohibition Refs #9 --- CONVENTIONS.md | 6 ++++-- workflows/solve-issue/roles/committer/prompt.ts | 13 +++++++------ workflows/solve-issue/roles/implement/prompt.ts | 2 +- workflows/solve-issue/roles/publish/prompt.ts | 2 +- 4 files changed, 13 insertions(+), 10 deletions(-) diff --git a/CONVENTIONS.md b/CONVENTIONS.md index 8c78465..41a8a34 100644 --- a/CONVENTIONS.md +++ b/CONVENTIONS.md @@ -78,7 +78,8 @@ workflows// | `createCursorRole` | Needs file system access (code generation, planning) | planner, coder | | `createHermesRole` | Needs shell + tools (testing, reviewing) | tester, reviewer | | `createLlmRole` | Pure LLM reasoning, no tools | analysis roles | -| Direct `Role` | No LLM needed, scripted logic | committer | +| `createRole(hermesAdapter, …)` | Agent role with LLM + shell (branch/commit/push from thread context) | solve-issue committer, publish | +| Direct `Role` | No LLM needed, scripted logic | thin wrappers only | ### Meta Convention @@ -87,7 +88,8 @@ Meta is a **routing signal only** — one boolean per role: - `{ done: boolean }` — coder - `{ approved: boolean }` — reviewer - `{ passed: boolean }` — tester -- `{ success: boolean }` — committer +- `{ committed: boolean }` — committer (solve-issue: branch created, pushed) +- `{ success: boolean }` — publish (PR opened) ### Standard Flow diff --git a/workflows/solve-issue/roles/committer/prompt.ts b/workflows/solve-issue/roles/committer/prompt.ts index dd703ee..f07a9a3 100644 --- a/workflows/solve-issue/roles/committer/prompt.ts +++ b/workflows/solve-issue/roles/committer/prompt.ts @@ -22,16 +22,17 @@ In the thread, locate \`---SOLVE_ISSUE_PARSE---\` and \`---SOLVE_ISSUE_REPO---\` ## Steps (in order) 1. \`cd\` to the repo **path** from SOLVE_ISSUE_REPO. -2. Run \`git status\`. There should be **uncommitted** changes from implement. If the tree is clean with nothing to commit, set **committed** to false and explain. -3. Create a feature branch (do not work on the default branch directly): +2. Run \`git rev-parse --abbrev-ref HEAD\` and compare with **defaultBranch** from SOLVE_ISSUE_REPO. Implement leaves changes **uncommitted** on the default branch — you should be on that branch with a dirty working tree. If you are not on the default branch, or the tree is clean with nothing to commit when you expected changes, set **committed** to false and explain (avoids empty PRs from wrong state). +3. Run \`git status\`. There should be **uncommitted** changes from implement. If the tree is clean with nothing to commit, set **committed** to false and explain. +4. Create a feature branch (do not work on the default branch directly): - Name: \`fix/-\` for fixes, or \`feat/-\` if the issue is clearly a feature. - **number** from SOLVE_ISSUE_PARSE. - **slug**: lowercase, hyphens only, short (from issue title words). - Example: \`git checkout -b fix/42-auth-timeout\` -4. \`git add -A\` -5. Write a **conventional commit** message (e.g. \`fix(scope): summary\` or \`feat(scope): summary\`) describing **what** changed and **why**, using the thread (plan + implement context). -6. \`git commit -m ""\` — use a single \`-m\` for a one-line message, or multiple \`-m\` for body paragraphs if needed. -7. \`git push -u origin \` +5. \`git add -A\` +6. Write a **conventional commit** message (e.g. \`fix(scope): summary\` or \`feat(scope): summary\`) describing **what** changed and **why**, using the thread (plan + implement context). +7. \`git commit -m ""\` — use a single \`-m\` for a one-line message, or multiple \`-m\` for body paragraphs if needed. +8. \`git push -u origin \` **committed=true** only if you created the branch, committed successfully, and **push** succeeded. diff --git a/workflows/solve-issue/roles/implement/prompt.ts b/workflows/solve-issue/roles/implement/prompt.ts index 8fee642..4260a12 100644 --- a/workflows/solve-issue/roles/implement/prompt.ts +++ b/workflows/solve-issue/roles/implement/prompt.ts @@ -13,7 +13,7 @@ Your cwd is the target repository. 2. Run the project **build** (\`pnpm build\`, \`npm run build\`, etc.) and fix issues until build passes. 3. Multi-step: if you cannot finish this round, explain why and set **done** to false. -Do **not** run \`git checkout -b\`, \`git add\`, \`git commit\`, or \`git push\`. Branching and commits are handled by the **committer** step after you finish. +Do **not** run \`git checkout -b\`, \`git add\`, \`git commit\`, or \`git push\`. **Never** create commits on any branch — branching and commits are handled by the **committer** step after you finish. Then close with JSON: \`\`\`json diff --git a/workflows/solve-issue/roles/publish/prompt.ts b/workflows/solve-issue/roles/publish/prompt.ts index df353f2..a610e8c 100644 --- a/workflows/solve-issue/roles/publish/prompt.ts +++ b/workflows/solve-issue/roles/publish/prompt.ts @@ -23,7 +23,7 @@ Find \`---SOLVE_ISSUE_PARSE---\` and \`---SOLVE_ISSUE_REPO---\` in prior message - **## What** — one short paragraph: what this PR does - **## Why** — one short paragraph: motivation / issue - **## Changes** — bullet list of notable changes - - **## Ref** — the issue link above + - **## Ref** — include one line \`Fixes #\` (same \`number\` from SOLVE_ISSUE_PARSE; closes/links the issue where supported) **and** the issue URL \`https://///issues/\` 4. Create the PR with **tea** (not curl/fetch to Gitea): - \`tea pr create --repo / --base --head --title "" --body \` - You may use a heredoc or a temp file for \`--body\` if the shell requires it; keep the four sections in the body. From 16bea3b8a73e486621430351da814e0211fe25b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E6=A9=98?= Date: Wed, 29 Apr 2026 11:09:01 +0000 Subject: [PATCH 2/2] fix(committer): forbid --author flag, use repo git config identity --- workflows/solve-issue/roles/committer/prompt.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/workflows/solve-issue/roles/committer/prompt.ts b/workflows/solve-issue/roles/committer/prompt.ts index f07a9a3..18e2a40 100644 --- a/workflows/solve-issue/roles/committer/prompt.ts +++ b/workflows/solve-issue/roles/committer/prompt.ts @@ -31,7 +31,7 @@ In the thread, locate \`---SOLVE_ISSUE_PARSE---\` and \`---SOLVE_ISSUE_REPO---\` - Example: \`git checkout -b fix/42-auth-timeout\` 5. \`git add -A\` 6. Write a **conventional commit** message (e.g. \`fix(scope): summary\` or \`feat(scope): summary\`) describing **what** changed and **why**, using the thread (plan + implement context). -7. \`git commit -m ""\` — use a single \`-m\` for a one-line message, or multiple \`-m\` for body paragraphs if needed. +7. \`git commit -m ""\` — use a single \`-m\` for a one-line message, or multiple \`-m\` for body paragraphs if needed. Do **not** pass \`--author\` — always use the repo's local git config identity. 8. \`git push -u origin \` **committed=true** only if you created the branch, committed successfully, and **push** succeeded.