豆豆友情提示:这是一个非官方 GitHub 代理镜像,主要用于网络测试或访问加速。请勿在此进行登录、注册或处理任何敏感信息。进行这些操作请务必访问官方网站 github.com。 Raw 内容也通过此代理提供。
Skip to content

Commit ef5da0f

Browse files
authored
Merge branch 'main' into Dileepy/prompt_update
2 parents 7490e80 + 9e668cb commit ef5da0f

File tree

13 files changed

+68
-15
lines changed

13 files changed

+68
-15
lines changed

package.nls.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@
2828
"github.copilot.command.openUserPreferences": "Open User Preferences",
2929
"github.copilot.command.openMemoryFolder": "Open Memory Folder",
3030
"github.copilot.command.sendChatFeedback": "Send Chat Feedback",
31-
"github.copilot.command.buildRemoteWorkspaceIndex": "Build Workspace Index",
32-
"github.copilot.command.deleteExternalIngestWorkspaceIndex": "Delete External Ingest Workspace Index",
31+
"github.copilot.command.buildRemoteWorkspaceIndex": "Build Codebase Semantic Index",
32+
"github.copilot.command.deleteExternalIngestWorkspaceIndex": "Delete External Ingest Codebase Index",
3333
"github.copilot.viewsWelcome.individual.expired": "Your Copilot subscription has expired.\n\n[Review Copilot Settings](https://github.com/settings/copilot?editor=vscode)",
3434
"github.copilot.viewsWelcome.enterprise": "Contact your GitHub organization administrator to enable Copilot.",
3535
"github.copilot.viewsWelcome.offline": {

src/extension/chatSessions/copilotcli/node/copilotCli.ts

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,11 @@ export class CopilotCLIAgents extends Disposable implements ICopilotCLIAgents {
289289
});
290290
}
291291
for (const promptFile of this.chatPromptFileService.customAgentPromptFiles) {
292+
// Skip legacy .chatmode.md files — they are a deprecated format
293+
// and should not appear in the Copilot CLI agent list.
294+
if (promptFile.uri.path.toLowerCase().endsWith('.chatmode.md')) {
295+
continue;
296+
}
292297
const info = this.toCustomAgent(promptFile);
293298
if (!info) {
294299
continue;
@@ -346,9 +351,16 @@ export class CopilotCLIAgents extends Disposable implements ICopilotCLIAgents {
346351

347352
export function getAgentFileNameFromFilePath(filePath: URI): string {
348353
const nameFromFile = basename(filePath);
349-
const indexOfAgentMd = nameFromFile.toLowerCase().indexOf('.agent.md');
350-
const agentName = indexOfAgentMd > 0 ? nameFromFile.substring(0, indexOfAgentMd) : nameFromFile;
351-
return agentName;
354+
const lowerName = nameFromFile.toLowerCase();
355+
const indexOfAgentMd = lowerName.indexOf('.agent.md');
356+
if (indexOfAgentMd > 0) {
357+
return nameFromFile.substring(0, indexOfAgentMd);
358+
}
359+
const indexOfChatmodeMd = lowerName.indexOf('.chatmode.md');
360+
if (indexOfChatmodeMd > 0) {
361+
return nameFromFile.substring(0, indexOfChatmodeMd);
362+
}
363+
return nameFromFile;
352364
}
353365

354366

src/extension/chatSessions/copilotcli/node/test/copilotCliAgents.spec.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,4 +202,28 @@ Second body`)]);
202202
expect(second.map(a => a.agent.name)).toEqual(['Second']);
203203
expect(sdk.getPackage).toHaveBeenCalled();
204204
});
205+
206+
it('filters out legacy .chatmode.md files', async () => {
207+
const chatmodeFile = new PromptFileParser().parse(
208+
URI.file('/workspace/.github/chatmodes/test.chatmode.md'),
209+
`---
210+
name: TestMode
211+
description: A legacy chatmode
212+
---
213+
Body`
214+
);
215+
const agentFile = parsePromptFile('real.agent.md', `---
216+
name: RealAgent
217+
description: A real agent
218+
---
219+
Body`);
220+
const { agents } = createAgents({
221+
sdkAgentsByCall: [[]],
222+
promptAgents: [chatmodeFile, agentFile]
223+
});
224+
225+
const result = await agents.getAgents();
226+
expect(result).toHaveLength(1);
227+
expect(result[0].agent.name).toBe('RealAgent');
228+
});
205229
});

src/extension/chatSessions/vscode-node/copilotCLICustomizationProvider.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export class CopilotCLICustomizationProvider extends Disposable implements vscod
2828
static get metadata(): vscode.ChatSessionCustomizationProviderMetadata {
2929
return {
3030
label: 'Copilot CLI',
31-
iconId: 'worktree',
31+
iconId: 'copilot',
3232
supportedTypes: [
3333
vscode.ChatSessionCustomizationType.Agent,
3434
vscode.ChatSessionCustomizationType.Skill,

src/extension/chatSessions/vscode-node/test/copilotCLICustomizationProvider.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ describe('CopilotCLICustomizationProvider', () => {
173173
describe('metadata', () => {
174174
it('has correct label and icon', () => {
175175
expect(CopilotCLICustomizationProvider.metadata.label).toBe('Copilot CLI');
176-
expect(CopilotCLICustomizationProvider.metadata.iconId).toBe('worktree');
176+
expect(CopilotCLICustomizationProvider.metadata.iconId).toBe('copilot');
177177
});
178178

179179
it('supports Agent, Skill, Instructions, Hook, and Plugins types', () => {

src/extension/prompt/node/chatMLFetcher.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ export class ChatMLFetcherImpl extends AbstractChatMLFetcher {
175175

176176
const baseTelemetry = TelemetryData.createAndMarkAsIssued({
177177
...telemetryProperties,
178+
headerRequestId: ourRequestId,
178179
baseModel: chatEndpoint.model,
179180
uiKind: ChatLocation.toString(location)
180181
});
@@ -1086,6 +1087,8 @@ export class ChatMLFetcherImpl extends AbstractChatMLFetcher {
10861087
});
10871088

10881089
const modelRequestId = getRequestId(connection.responseHeaders);
1090+
// Preserve ourRequestId as headerRequestId if the server didn't echo x-request-id
1091+
modelRequestId.headerRequestId = modelRequestId.headerRequestId || ourRequestId;
10891092
telemetryData.extendWithRequestId(modelRequestId);
10901093

10911094
for (const [key, value] of Object.entries(request)) {
@@ -1094,8 +1097,6 @@ export class ChatMLFetcherImpl extends AbstractChatMLFetcher {
10941097
} // Skip messages (PII)
10951098
telemetryData.properties[`request.option.${key}`] = JSON.stringify(value) ?? 'undefined';
10961099
}
1097-
1098-
telemetryData.properties['headerRequestId'] = ourRequestId;
10991100
this._telemetryService.sendGHTelemetryEvent('request.sent', telemetryData.properties, telemetryData.measurements);
11001101

11011102
const requestStart = Date.now();
@@ -1396,6 +1397,8 @@ export class ChatMLFetcherImpl extends AbstractChatMLFetcher {
13961397
// This ID is hopefully the one the same as ourRequestId, but it is not guaranteed.
13971398
// If they are different then we will override the original one we set in telemetryData above.
13981399
const modelRequestId = getRequestId(response.headers);
1400+
// Preserve ourRequestId as headerRequestId if the server didn't echo x-request-id
1401+
modelRequestId.headerRequestId = modelRequestId.headerRequestId || ourRequestId;
13991402
telemetryData.extendWithRequestId(modelRequestId);
14001403

14011404
// TODO: Add response length (requires parsing)

src/extension/prompt/node/executionSubagentToolCallingLoop.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ export interface IExecutionSubagentToolCallingLoopOptions extends IToolCallingLo
3434
promptText: string;
3535
/** Optional pre-generated subagent invocation ID. If not provided, a new UUID will be generated. */
3636
subAgentInvocationId?: string;
37+
/** The tool_call_id from the parent agent's LLM response that triggered this subagent invocation. */
38+
parentToolCallId?: string;
3739
}
3840

3941
export class ExecutionSubagentToolCallingLoop extends ToolCallingLoop<IExecutionSubagentToolCallingLoopOptions> {
@@ -139,10 +141,12 @@ export class ExecutionSubagentToolCallingLoop extends ToolCallingLoop<IExecution
139141
// This loop is inside a tool called from another request, so never user initiated
140142
userInitiatedRequest: false,
141143
telemetryProperties: {
144+
requestId: this.options.subAgentInvocationId,
142145
messageId: randomUUID(),
143146
messageSource: 'chat.editAgent',
144147
subType: 'subagent/execution',
145-
conversationId: this.options.conversation.sessionId
148+
conversationId: this.options.conversation.sessionId,
149+
parentToolCallId: this.options.parentToolCallId,
146150
},
147151
}, token);
148152
}

src/extension/prompt/node/searchSubagentToolCallingLoop.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ export interface ISearchSubagentToolCallingLoopOptions extends IToolCallingLoopO
3535
promptText: string;
3636
/** Optional pre-generated subagent invocation ID. If not provided, a new UUID will be generated. */
3737
subAgentInvocationId?: string;
38+
/** The tool_call_id from the parent agent's LLM response that triggered this subagent invocation. */
39+
parentToolCallId?: string;
3840
}
3941

4042
export class SearchSubagentToolCallingLoop extends ToolCallingLoop<ISearchSubagentToolCallingLoopOptions> {
@@ -153,10 +155,12 @@ export class SearchSubagentToolCallingLoop extends ToolCallingLoop<ISearchSubage
153155
// This loop is inside a tool called from another request, so never user initiated
154156
userInitiatedRequest: false,
155157
telemetryProperties: {
158+
requestId: this.options.subAgentInvocationId,
156159
messageId: randomUUID(),
157160
messageSource: 'chat.editAgent',
158161
subType: 'subagent/search',
159-
conversationId: this.options.conversation.sessionId
162+
conversationId: this.options.conversation.sessionId,
163+
parentToolCallId: this.options.parentToolCallId,
160164
},
161165
requestKindOptions: { kind: 'subagent' }
162166
}, token);

src/extension/tools/node/executionSubagentTool.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ class ExecutionSubagentTool implements ICopilotTool<IExecutionSubagentParams> {
6767
location: request.location,
6868
promptText: options.input.query,
6969
subAgentInvocationId: subAgentInvocationId,
70+
parentToolCallId: options.chatStreamToolCallId,
7071
});
7172

7273
const stream = this._inputContext?.stream && ChatResponseStreamImpl.filter(

src/extension/tools/node/searchSubagentTool.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ class SearchSubagentTool implements ICopilotTool<ISearchSubagentParams> {
7777
location: request.location,
7878
promptText: options.input.query,
7979
subAgentInvocationId: subAgentInvocationId,
80+
parentToolCallId: options.chatStreamToolCallId,
8081
});
8182

8283
const stream = this._inputContext?.stream && ChatResponseStreamImpl.filter(

0 commit comments

Comments
 (0)