-
Notifications
You must be signed in to change notification settings - Fork 251
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
clean up ContextItem<->ContextMessage conversion, remove duplicate wrapping & unused code #3307
Conversation
Note: most of the diff is the agent recordings. The rest is a major deletion:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome
a3c7cab
to
04c0526
Compare
for (const file of userContextFiles) { | ||
if (file.uri) { | ||
const content = await editor.getTextEditorContentForFile(file.uri, file.range) | ||
if (content) { | ||
const message = createContextMessageByFile(file, content) | ||
userProvidedContextMessages.push(...message) | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we'll need to use fillInContextItemContent
here like we do for chat, otherwise the user context files won't actually have any content
and will be ignored as context.
quick fix here: #3318
…apping & unused code (#3307)
} | ||
|
||
return extractContextItemsFromContextMessages([ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Based on this diff and behavior before this PR, my best guess is that we should preserve the contextMessage
to contextItem
conversion until we properly remove the duplication between these types. Fixing it here: #4432
- #3307 removed `extractContextItemsFromContextMessages` and replaced it with `isContextItem(value) ? value : value.file` which removes context items content from the final prompt.
I noticed in the conversion
ContextItem <-> ContextMessage
there are several possible places where we were wrapping context files with multiple layers of preamble, like:There was a
stripContextWrapper
to try to undo that in some places, but it's not applied everywhere it's needed. Examples (from the agent recordings):This PR cleans up code related to this to remove the multiple layers of preamble, and deletes other related unused code.
Cleanups:
Test plan
CI