fix(agent): allow no-repo cloud runs to clone repos#1955
Open
tatoalo wants to merge 3 commits intochore/cloud-agent/user-github-integrationsfrom
Open
fix(agent): allow no-repo cloud runs to clone repos#1955tatoalo wants to merge 3 commits intochore/cloud-agent/user-github-integrationsfrom
tatoalo wants to merge 3 commits intochore/cloud-agent/user-github-integrationsfrom
Conversation
Contributor
Prompt To Fix All With AIFix 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.