Skip to content

fix(agent): include posthog-code/ branch prefix in global instructions#1966

Merged
adboio merged 1 commit intomainfrom
posthog-code/branch-prefix-in-global-instructions
May 1, 2026
Merged

fix(agent): include posthog-code/ branch prefix in global instructions#1966
adboio merged 1 commit intomainfrom
posthog-code/branch-prefix-in-global-instructions

Conversation

@adboio
Copy link
Copy Markdown
Contributor

@adboio adboio commented Apr 30, 2026

Summary

  • The posthog-code/ branch prefix convention was only injected into the auto-create-PR cloud prompt (agent-server.ts:1621).
  • When a cloud session ran through the review-only !shouldAutoCreatePr branch and the user later asked the agent to create a branch, the agent had no convention loaded and fell back to its own default (<user>/<slug>).
  • Move the prefix instruction into the globally-appended BRANCH_NAMING block in packages/agent/src/adapters/claude/session/instructions.ts so it applies to every prompt branch — cloud auto-PR, cloud review-only, no-repo, and local.

Test plan

  • Start a cloud task in review-only mode, then ask the agent to create a branch — verify it uses the posthog-code/ prefix
  • Start a cloud task in auto-PR mode — verify the prefix still appears
  • Start a local task and ask for a branch — verify the prefix still appears

The branch prefix convention was only injected into the auto-create-PR
cloud prompt. When a cloud session ran in review-only mode and the user
later asked the agent to create a branch, the agent had no convention
loaded and fell back to its own default. Move the prefix instruction
into the globally-appended BRANCH_NAMING block so it applies to every
prompt branch.

Generated-By: PostHog Code
Task-Id: d218229f-4d24-49e8-b6cb-062ed96171f5
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Apr 30, 2026

Prompt To Fix All With AI
Fix the following 1 code review issue. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 1
packages/agent/src/adapters/claude/session/instructions.ts:6
**Instruction duplicated, not moved**

The PR description says this is a *move*, but the identical `posthog-code/` prefix instruction still exists in `agent-server.ts:1621` (the auto-PR branch). Now both prompts carry it, violating OnceAndOnlyOnce. The line in `agent-server.ts` that reads `1. Create a new branch prefixed with \`posthog-code/\` (e.g. \`posthog-code/fix-login-redirect\`) based on the work done` should be simplified to remove the redundant prefix hint and just say e.g. `1. Create a new branch based on the work done` (relying on the global instruction for the naming convention).

Reviews (1): Last reviewed commit: "fix(agent): include posthog-code/ branch..." | Re-trigger Greptile


When working in a detached HEAD state, create a descriptive branch name based on the work being done before committing. Do this automatically without asking the user.

When creating a new branch, prefix it with \`posthog-code/\` (e.g. \`posthog-code/fix-login-redirect\`).
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Instruction duplicated, not moved

The PR description says this is a move, but the identical posthog-code/ prefix instruction still exists in agent-server.ts:1621 (the auto-PR branch). Now both prompts carry it, violating OnceAndOnlyOnce. The line in agent-server.ts that reads 1. Create a new branch prefixed with \posthog-code/` (e.g. `posthog-code/fix-login-redirect`) based on the work doneshould be simplified to remove the redundant prefix hint and just say e.g.1. Create a new branch based on the work done` (relying on the global instruction for the naming convention).

Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/agent/src/adapters/claude/session/instructions.ts
Line: 6

Comment:
**Instruction duplicated, not moved**

The PR description says this is a *move*, but the identical `posthog-code/` prefix instruction still exists in `agent-server.ts:1621` (the auto-PR branch). Now both prompts carry it, violating OnceAndOnlyOnce. The line in `agent-server.ts` that reads `1. Create a new branch prefixed with \`posthog-code/\` (e.g. \`posthog-code/fix-login-redirect\`) based on the work done` should be simplified to remove the redundant prefix hint and just say e.g. `1. Create a new branch based on the work done` (relying on the global instruction for the naming convention).

How can I resolve this? If you propose a fix, please make it concise.

@adboio adboio merged commit e42338d into main May 1, 2026
15 checks passed
@adboio adboio deleted the posthog-code/branch-prefix-in-global-instructions branch May 1, 2026 15:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants