Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions packages/agent/src/server/agent-server.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,16 @@ describe("AgentServer HTTP Mode", () => {
delete process.env.POSTHOG_CODE_INTERACTION_ORIGIN;
});

it("returns auto-PR prompt for signal_report-origin runs", () => {
process.env.POSTHOG_CODE_INTERACTION_ORIGIN = "signal_report";
const s = createServer();
const prompt = (s as unknown as TestableServer).buildCloudSystemPrompt();
expect(prompt).toContain("posthog-code/");
expect(prompt).toContain("Create a draft pull request");
expect(prompt).toContain("gh pr create --draft");
delete process.env.POSTHOG_CODE_INTERACTION_ORIGIN;
});

it("returns PR-update prompt for existing PRs on Slack-origin runs", () => {
process.env.POSTHOG_CODE_INTERACTION_ORIGIN = "slack";
const s = createServer();
Expand Down
5 changes: 3 additions & 2 deletions packages/agent/src/server/agent-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1265,13 +1265,14 @@ export class AgentServer {
}

/**
* Slack-origin cloud runs auto-publish by default. Every other origin is
* Automated-origin cloud runs auto-publish by default. Every other origin is
* review-first unless the user explicitly asks, and createPr=false always
* disables publishing.
*/
private shouldAutoPublishCloudChanges(): boolean {
const origin = this.getCloudInteractionOrigin();
return (
this.getCloudInteractionOrigin() === "slack" &&
(origin === "slack" || origin === "signal_report") &&
this.config.createPr !== false
);
}
Expand Down
Loading