Skip to content

Commit 5ba56f6

Browse files
scoping fix to copilot users only
1 parent 279b3ff commit 5ba56f6

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

lib/messages/inject.ts

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
extractParameterKey,
88
buildToolIdList,
99
createSyntheticAssistantMessageWithToolPart,
10+
createSyntheticUserMessage,
1011
} from "./utils"
1112
import { getFilePathFromParameters, isProtectedFilePath } from "../protected-file-patterns"
1213
import { getLastUserMessage } from "../shared-utils"
@@ -136,7 +137,17 @@ export const insertPruneToolContext = (
136137
if (!lastUserMessage) {
137138
return
138139
}
139-
messages.push(
140-
createSyntheticAssistantMessageWithToolPart(lastUserMessage, prunableToolsContent),
141-
)
140+
141+
const userInfo = lastUserMessage.info as UserMessage
142+
const providerID = userInfo.model.providerID
143+
const isGitHubCopilot =
144+
providerID === "github-copilot" || providerID === "github-copilot-enterprise"
145+
146+
if (isGitHubCopilot) {
147+
messages.push(
148+
createSyntheticAssistantMessageWithToolPart(lastUserMessage, prunableToolsContent),
149+
)
150+
} else {
151+
messages.push(createSyntheticUserMessage(lastUserMessage, prunableToolsContent))
152+
}
142153
}

0 commit comments

Comments
 (0)