Skip to content

Let cloud task users override the single-PR default#3639

Open
tatoalo wants to merge 2 commits into
mainfrom
posthog-code/allow-user-authorized-extra-prs
Open

Let cloud task users override the single-PR default#3639
tatoalo wants to merge 2 commits into
mainfrom
posthog-code/allow-user-authorized-extra-prs

Conversation

@tatoalo

@tatoalo tatoalo commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Problem

Cloud task runs with an existing open PR hard-blocked the agent from creating a new branch or PR ("You MUST NOT create a new branch, close the existing PR, or create a new PR"). Users who explicitly authorized additional PRs still got refused, since the instruction had no override.

Changes

Made the single-PR prohibition the default rather than absolute in the existing-PR cloud task prompts (packages/agent/src/server/agent-server.ts): continue on the existing PR unless the user explicitly asks for a new branch or separate PR. This matches the escape hatch already used in the non-auto-publish path, so the default (avoid spontaneous extra PRs) is preserved while explicit user authorization is honored.

How did you test this?

Text-only prompt-string change with no assertions against the edited lines. Typecheck and the surrounding test suite fail only on pre-existing environment limitations (unbuilt workspace deps and the sandbox's global git commit block used by test fixtures) — none related to this change.

Automatic notifications

  • Publish to changelog?
  • Alert Sales and Marketing teams?

Created with PostHog from a Slack thread

The existing-PR cloud task prompts hard-blocked creating a new branch or PR
("You MUST NOT create a new branch, close the existing PR, or create a new
PR"), so the agent refused even when the user explicitly authorized additional
PRs. Make those prohibitions the default rather than absolute: continue on the
existing PR unless the user explicitly asks otherwise, matching the escape
hatch already used in the non-auto-publish path.

Generated-By: PostHog Code
Task-Id: 228eca58-a141-4129-af28-560fab7a150a
@trunk-io

trunk-io Bot commented Jul 21, 2026

Copy link
Copy Markdown

Merging to main in this repository is managed by Trunk.

  • To merge this pull request, check the box to the left or comment /trunk merge below.

After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here

@github-actions

github-actions Bot commented Jul 21, 2026

Copy link
Copy Markdown

React Doctor found no issues in the changed files. 🎉

Reviewed by React Doctor for commit b665187.

@tatoalo
tatoalo marked this pull request as ready for review July 21, 2026 16:11
@tatoalo
tatoalo enabled auto-merge (squash) July 21, 2026 16:11
@greptile-apps

greptile-apps Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor
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/server/agent-server.ts:3299-3302
**Override Conflicts With Mandatory Checkout**

When the user explicitly requests a separate branch or PR, the preceding `MUST` steps still require checking out the existing PR and pushing to that branch. The agent can therefore update the existing PR before applying the new exception, so the explicit request is misapplied.

```suggestion
      `Unless the user explicitly asks for a new branch or separate PR, you MUST:\n` +
      `1. ${this.buildExistingPrCheckoutInstruction(prUrl)}\n` +
      `2. Make changes, commit, and push to that branch\n` +
      `By default, do not create a new branch, close the existing PR, or create a new PR — continue on the existing PR. If the user explicitly asks for a new branch or separate PR, follow their instruction instead.`
```

Reviews (1): Last reviewed commit: "Let cloud task users override the single..." | Re-trigger Greptile

Comment thread packages/agent/src/server/agent-server.ts Outdated
The auto-publish existing-PR prompt still opened with an unconditional "You
MUST" checkout-and-push-to-existing-branch block before the override sentence,
so an explicit request for a separate PR conflicted with the mandatory steps.
Gate those steps on "Unless the user explicitly asks for a new branch or
separate PR" so the exception is consistent. Addresses Greptile P1.

Generated-By: PostHog Code
Task-Id: 228eca58-a141-4129-af28-560fab7a150a
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