🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
✨ feat(scm): ask the agent to re-request Codex review after a pushed fix (#20033)
Arvin Xub556d71b9ec4
diff --git a/apps/server/src/services/scm/__tests__/wakePrompt.test.ts b/apps/server/src/services/scm/__tests__/wakePrompt.test.tsindex 24c1e946f26..2365f954f37 100644--- a/apps/server/src/services/scm/__tests__/wakePrompt.test.ts+++ b/apps/server/src/services/scm/__tests__/wakePrompt.test.ts@@ -109,4 +109,36 @@ describe('buildReviewPrompt', () => {expect(prompt).toContain('Reviewers left feedback on pull request o/r#7');expect(prompt).toContain('The review carried no text');});++ it('asks for a Codex re-review after a pushed fix, once per bot', () => {+ const codex = 'chatgpt-codex-connector[bot]';+ const prompt = buildReviewPrompt({+ feedback: [+ { association: 'none' as const, author: codex, body: 'Codex Review' },+ {+ association: 'none' as const,+ author: codex,+ body: 'Make it a button.',+ line: 3,+ path: 'a.tsx',+ },+ ],+ reason: 'review_commented',+ row,+ });+ expect(prompt).toContain(+ 'If you pushed a fix, then comment `@codex review` on the pull request so the reviewer checks it again',+ );+ expect(prompt.match(/@codex review/g)).toHaveLength(1);+ expect(hasBlankLine(prompt)).toBe(false);+ });++ it('asks for no re-review when the feedback is from a human', () => {+ const prompt = buildReviewPrompt({+ feedback: [{ association: 'member' as const, author: 'alice', body: 'Rename it.' }],+ reason: 'review_commented',+ row,+ });+ expect(prompt).not.toContain('@codex review');+ });});diff --git a/apps/server/src/services/scm/wakePrompt.ts b/apps/server/src/services/scm/wakePrompt.tsindex 39decdd03d7..5ef67280ff3 100644--- a/apps/server/src/services/scm/wakePrompt.ts+++ b/apps/server/src/services/scm/wakePrompt.ts@@ -89,6 +89,30 @@ export const buildCiFailurePrompt = (params: {return lines.join('\n');};+/**+ * Review bots that only look again when asked, keyed by their GitHub login.+ * Codex reviews a pull request once on open; a pushed fix goes unreviewed+ * unless someone comments the command.+ */+const REREVIEW_COMMANDS: Record<string, string> = {+ 'chatgpt-codex-connector[bot]': '@codex review',+};++/**+ * Asks the agent to re-request review from the bots that gave this feedback.+ * The comment is posted as the PR author, which the control half skips, so it+ * never wakes the agent itself; a clean re-review is a reaction, not a+ * review, so the loop ends there, and `SCM_MAX_WAKES` bounds it otherwise.+ */+const rereviewRequest = (feedback: GitHubReviewFeedback[]) => {+ const commands = [+ ...new Set(feedback.map((item) => REREVIEW_COMMANDS[item.author]).filter(Boolean)),+ ];+ if (commands.length === 0) return '';+ const list = commands.map((command) => `\`${command}\``).join(' and ');+ return ` If you pushed a fix, then comment ${list} on the pull request so the reviewer checks it again; do not comment it when you changed nothing.`;+};+/** The message an agent receives when reviewers request changes or comment. */export const buildReviewPrompt = (params: {feedback: GitHubReviewFeedback[];@@ -115,7 +139,7 @@ export const buildReviewPrompt = (params: {feedback.length === 0 ? ' The review carried no text; open the pull request to read it.' : '';lines.push(instruction(- `${lead}${missing} Address each point, or explain in your reply why it should stay as is. ${sameCheckout(row)}`,+ `${lead}${missing} Address each point, or explain in your reply why it should stay as is. ${sameCheckout(row)}${rereviewRequest(feedback)}`,),closeTag,);