Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLI: fix --context-repo #5511

Conversation

olafurpg
Copy link
Member

@olafurpg olafurpg commented Sep 9, 2024

Fixes CODY-3687

Previously, cody chat --context-repo REPO didn't use the provided repo as context due to a regresion in the PR #5379 This bug was limited to version 5.5.14 of the CLI, it was not part of 5.5.13.

This PR fixes the bug by adding repo context to the 'submit' contextItem property where we previously only sent files.

Test plan

Manually tested with this command

❯ pnpm agent chat --show-context --context-file agent/README.md --context-repo github.com/sourcegraph/cody -m 'what is the agent?'
 ...
> Context items:

> 1. /Users/olafurpg/dev/sourcegraph/cody/agent/agent/README.md

> 2. https://sourcegraph.sourcegraph.com/github.com/sourcegraph/cody/-/blob/agent/src/__tests__/graph-test/README.md

> 3. https://sourcegraph.sourcegraph.com/github.com/sourcegraph/cody/-/blob/cli/README.md

> 4. https://sourcegraph.sourcegraph.com/github.com/sourcegraph/cody/-/blob/agent/src/local-e2e/README.md
...

We have an integration test for --context-repo but it got disabled a couple months ago due to it being flaky.

Changelog

Fixes CODY-3687

Previously, `cody chat --context-repo REPO` didn't use the provided repo
as context due to a regresion in the PR #5379
This bug was limited to version 5.5.14 of the CLI, it was not part of
5.5.13.

This PR fixes the bug by adding repo context to the `'submit'`
`contextItem` property where we previously only sent files.
@olafurpg olafurpg requested a review from a team September 9, 2024 19:47
@@ -225,11 +225,22 @@ export async function chatAction(options: ChatOptions): Promise<number> {
)
return 1
}
for (const repo of repos) {
const repoUri = vscode.Uri.parse(`https://${endpoint}/${repo.name}`)
console.log('repoUri', repoUri.toString())
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
console.log('repoUri', repoUri.toString())

Copy link
Member Author

Choose a reason for hiding this comment

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

Nice, thank yoU!

@olafurpg olafurpg enabled auto-merge (squash) September 9, 2024 19:53
@olafurpg olafurpg merged commit 4e5dff2 into main Sep 9, 2024
19 checks passed
@olafurpg olafurpg deleted the olafurpg-cody-3687-repo-context-context-repo-is-not-working-in-5514 branch September 9, 2024 19:58
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