Skip to content

Commit 678373c

Browse files
committed
fix: require meaningful branch names before PR creation
1 parent e9752c3 commit 678373c

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

packages/agents/shared.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ export function buildSystemPrompt(slack?: SlackContext): string {
2222
"- If GIT_AUTHOR_NAME and GIT_AUTHOR_EMAIL are set, use them explicitly in commit commands.",
2323
"- Prefer: git commit --author=\"$GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL>\" -m \"...\"",
2424
"- Use GH_TOKEN for gh commands when available; fall back to git commands when GH_TOKEN is not set.",
25+
"- Before creating any pull request, make sure the current branch name is meaningful.",
26+
"- If the branch looks like a thread/worktree ID (for example `ode_<threadId>`), rename it first.",
27+
"- Preferred branch format before PR: `feat/<short-slug>-<threadShortId>` (slug from the PR topic, short thread suffix for uniqueness).",
2528
"",
2629
];
2730

packages/agents/test/cli-command.test.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,17 @@ describe("agent cli command formatting", () => {
4747
expect(systemPrompt).not.toContain("CHANNEL SYSTEM MESSAGE:");
4848
});
4949

50+
it("includes branch rename guidance before creating pull requests", () => {
51+
const systemPrompt = buildSystemPrompt({
52+
channelId: "C123",
53+
threadId: "1770543888.045599",
54+
userId: "U789",
55+
});
56+
57+
expect(systemPrompt).toContain("Before creating any pull request, make sure the current branch name is meaningful.");
58+
expect(systemPrompt).toContain("Preferred branch format before PR: `feat/<short-slug>-<threadShortId>`");
59+
});
60+
5061
it("builds the OpenCode curl command", () => {
5162
const command = buildOpenCodeCommand("http://127.0.0.1:8080", "session-2", {
5263
directory: "/tmp/project",

0 commit comments

Comments
 (0)