fix(copilot): make Copilot aware of native Slack and query selected channels (#627)

When Slack is connected natively (desktop/cURL auth, not Composio), the Copilot now routes Slack requests to the native slack skill instead of composio-integration, surfaces the user's selected channels in the system prompt, and steers catch-up queries to 'agent-slack message list --oldest' rather than unreads/search (which return empty under desktop-imported auth). Instruction cache is invalidated on slack:setConfig and knowledgeSources:upsert so changes take effect.
This commit is contained in:
gagan 2026-06-18 11:53:56 -07:00 committed by GitHub
parent c38ddef93f
commit 2f926f8dc0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 88 additions and 10 deletions

View file

@ -1054,6 +1054,9 @@ export function setupIpcHandlers() {
'slack:setConfig': async (_event, args) => {
const repo = container.resolve<ISlackConfigRepo>('slackConfigRepo');
await repo.setConfig({ enabled: args.enabled, workspaces: args.workspaces });
// Connecting/disconnecting Slack changes the Copilot's routing (native
// `slack` skill vs. Composio), so rebuild its cached instructions.
invalidateCopilotInstructionsCache();
return { success: true };
},
'slack:cliStatus': async () => {
@ -1227,6 +1230,9 @@ export function setupIpcHandlers() {
'knowledgeSources:upsert': async (_event, args) => {
const config = knowledgeSourcesRepo.upsertSource(args);
if (args.provider === 'slack') {
// The Copilot prompt lists the selected Slack channels, so refresh it
// whenever the channel selection changes.
invalidateCopilotInstructionsCache();
triggerSlackKnowledgeSync();
void syncSlackKnowledgeSources().catch(error => {
console.error('[SlackKnowledge] Immediate sync after settings update failed:', error);