Skip to content

Commit dd1eb81

Browse files
DonJayamanneCopilot
andauthored
Load deferred repo hooks after session creation (#312036)
* feat: load deferred repo hooks after session creation in CopilotCLISessionService Co-authored-by: Copilot <copilot@github.com> * Fix tests --------- Co-authored-by: Copilot <copilot@github.com>
1 parent d90a8a7 commit dd1eb81

2 files changed

Lines changed: 13 additions & 6 deletions

File tree

extensions/copilot/src/extension/chatSessions/copilotcli/node/copilotcliSessionService.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -759,13 +759,17 @@ export class CopilotCLISessionService extends Disposable implements ICopilotCLIS
759759
// to the debug panel.
760760
this._installBridgeIfNeeded();
761761

762-
762+
const promises: Promise<unknown>[] = [];
763763
if (wasNewSession) {
764-
const stagedTitle = await this.customSessionTitleService.getCustomSessionTitle(sdkSession.sessionId);
765-
if (stagedTitle) {
766-
await sdkSession.updateSessionSummary(stagedTitle);
767-
}
764+
promises.push(this.customSessionTitleService.getCustomSessionTitle(sdkSession.sessionId).then(stagedTitle => {
765+
if (stagedTitle) {
766+
sdkSession.updateSessionSummary(stagedTitle);
767+
}
768+
}));
768769
}
770+
promises.push(sessionManager.loadDeferredRepoHooks(sdkSession));
771+
await Promise.all(promises);
772+
769773
if (sessionOptions.copilotUrl) {
770774
sdkSession.setAuthInfo({
771775
type: 'hmac',
@@ -972,7 +976,7 @@ export class CopilotCLISessionService extends Disposable implements ICopilotCLIS
972976
this.logService.error(`[CopilotCLISession] CopilotCLI failed to get session ${options.sessionId}.`);
973977
return undefined;
974978
}
975-
979+
await sessionManager.loadDeferredRepoHooks(sdkSession);
976980
const session = this.createCopilotSession(sdkSession, options.workspace, options.agent?.name, sessionManager);
977981
session.object.add(mcpGateway);
978982
return session;

extensions/copilot/src/extension/chatSessions/copilotcli/node/test/testHelpers.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,9 @@ export class MockCliSdkSessionManager {
9292
this.sessions.set(newId, s);
9393
return Promise.resolve({ sessionId: newId });
9494
}
95+
async loadDeferredRepoHooks(session: unknown) {
96+
//
97+
}
9598
}
9699

97100
export class NullCopilotCLIAgents implements ICopilotCLIAgents {

0 commit comments

Comments
 (0)