Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
This repository was archived by the owner on Jun 5, 2025. It is now read-only.

Strip attachments from copilot messages when handling the CLI commands#1202

Merged
jhrozek merged 1 commit into
mainstacklok/codegate:mainfrom
copilot_versionstacklok/codegate:copilot_versionCopy head branch name to clipboard
Mar 4, 2025
Merged

Strip attachments from copilot messages when handling the CLI commands#1202
jhrozek merged 1 commit into
mainstacklok/codegate:mainfrom
copilot_versionstacklok/codegate:copilot_versionCopy head branch name to clipboard

Conversation

@jhrozek

@jhrozek jhrozek commented Mar 4, 2025

Copy link
Copy Markdown
Contributor

Copilot sends files in the context in the following format:

<attachment>
file
<attachment>
user query

Fixes: #1061

JAORMX
JAORMX previously approved these changes Mar 4, 2025
Comment thread src/codegate/pipeline/cli/cli.py Outdated
Returns:
Optional[re.Match[str]]: A regex match object if command is found, None otherwise
"""
cleaned_text = re.sub(r'<attachment>.*</attachment>', '', last_user_message_str, flags=re.DOTALL)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

optimization: pre-declare and pre-compile each regular expression in the constructor or even globally so this function would only need to evaluate the regex as opposed to compile+evaluate.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

let's do it separately for all the regexes here. We should also move the client helpers to the client interface.

Copilot sends files in the context in the following format:
```
<attachment>
file
<attachment>
user query
```

Fixes: #1061
@jhrozek jhrozek merged commit 08c0111 into main Mar 4, 2025
@jhrozek jhrozek deleted the copilot_version branch March 4, 2025 20:02
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

codegate cli doesn't work in copilot if context is selected

2 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.