Skip to content

fix(agent): allow no-repo cloud runs to clone repos#1955

Open
tatoalo wants to merge 3 commits intochore/cloud-agent/user-github-integrationsfrom
chore/cloud-agent/no-repo-clone-pr-prompt
Open

fix(agent): allow no-repo cloud runs to clone repos#1955
tatoalo wants to merge 3 commits intochore/cloud-agent/user-github-integrationsfrom
chore/cloud-agent/no-repo-clone-pr-prompt

Conversation

@tatoalo
Copy link
Copy Markdown
Contributor

@tatoalo tatoalo commented Apr 30, 2026

Problem

Slack-origin cloud runs can start without a repository, but still have GitHub credentials injected for the linked user. In that state, users can ask the agent to clone a repo, but the no-repository prompt currently forbids branch, commit, and PR operations even after the repo is cloned.

We do need a proper repo injection but this will do for now.

@tatoalo tatoalo self-assigned this Apr 30, 2026
@tatoalo tatoalo marked this pull request as ready for review April 30, 2026 14:05
@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/server/agent-server.test.ts:613-644
**Prefer parameterised tests**

The two new tests cover the same feature (no-repository mode prompt content) across two `createPr` values. The team's coding standard prefers `it.each` for cases like this, keeping expectations DRY and making it easy to add a third case later (e.g. explicit `createPr: true`).

```ts
it.each([
  {
    label: "createPr unset (permissive)",
    config: { repositoryPath: undefined },
    shouldContain: [
      "Cloud Task Execution — No Repository Mode",
      "Clone the repository into /tmp/workspace/repos/<owner>/<repo>",
      "gh repo clone <owner>/<repo> /tmp/workspace/repos/<owner>/<repo>",
      "If the user explicitly asks you to open or update a pull request",
      "open a draft pull request",
      "unless the user explicitly asks",
      "Generated-By: PostHog Code",
      "Task-Id: test-task-id",
    ],
    shouldNotContain: [],
  },
  {
    label: "createPr false (restricted)",
    config: { repositoryPath: undefined, createPr: false },
    shouldContain: [
      "Cloud Task Execution — No Repository Mode",
      "You may clone a repository and make local edits in that clone",
      "Do NOT create branches, commits, push changes, or open pull requests in this run",
    ],
    shouldNotContain: ["open a draft pull request", "gh pr create --draft"],
  },
])(
  "no-repository mode: $label",
  ({ config, shouldContain, shouldNotContain }) => {
    const s = createServer(config);
    const prompt = (s as unknown as TestableServer).buildCloudSystemPrompt();
    for (const text of shouldContain) expect(prompt).toContain(text);
    for (const text of shouldNotContain) expect(prompt).not.toContain(text);
  },
);
```

Reviews (1): Last reviewed commit: "fix(agent): allow no-repo cloud runs to ..." | Re-trigger Greptile

Comment thread packages/agent/src/server/agent-server.test.ts Outdated
@tatoalo tatoalo requested a review from a team April 30, 2026 16:42
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.

1 participant