Skip to content

Commit 9f85931

Browse files
fix: add scope rules to Comment.create dispatch path (missed 3rd prompt site)
The dispatchCommentToAgent function had its own prompt construction at line 1490 that still used the permissive "dispatch via code_run" closing. This was the path that let Mal build a stock trading app from a comment. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent f6b7a03 commit 9f85931

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

src/pipeline/webhook.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1487,7 +1487,14 @@ async function dispatchCommentToAgent(
14871487
``,
14881488
`IMPORTANT: Only reference real users from the issue data above. Do NOT fabricate or guess user names, emails, or identities.`,
14891489
``,
1490-
`Respond concisely. For work requests, dispatch via \`code_run\` and summarize the result.`,
1490+
`## Scope Rules`,
1491+
`1. **Read the issue first.** The issue title + description define your scope. Everything you do must serve the issue as written.`,
1492+
`2. **\`code_run\` is ONLY for issue-body work.** Only dispatch \`code_run\` when the issue description contains implementation requirements. A greeting, question, or conversational issue gets a conversational response — NOT code_run.`,
1493+
`3. **Comments explore, issue body builds.** The comment above may explore scope or ask questions but NEVER trigger \`code_run\` from a comment alone. If the comment requests new implementation, suggest updating the issue description or creating a new issue.`,
1494+
`4. **Plan before building.** For non-trivial work, respond with a plan first. Only dispatch \`code_run\` after the plan is clear and grounded in the issue body.`,
1495+
`5. **Match response to request.** Greeting → greet. Question → answer. No implementation requirements in the issue body → no code_run.`,
1496+
``,
1497+
`Respond within the scope defined above. Be concise and action-oriented.`,
14911498
commentGuidanceAppendix,
14921499
].filter(Boolean).join("\n");
14931500

0 commit comments

Comments
 (0)