Skip to content

Commit f9f8096

Browse files
committed
feat(backend): notify satellite of token reset during instance token regeneration
1 parent b1750ac commit f9f8096

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

services/backend/src/routes/mcp/installations/resetToken.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { requireAuthenticationAny } from '../../../middleware/oauthMiddleware';
33
import { requireTeamPermission } from '../../../middleware/roleMiddleware';
44
import { getDb } from '../../../db';
55
import { McpInstanceService } from '../../../services/mcpInstanceService';
6+
import { SatelliteCommandService } from '../../../services/satelliteCommandService';
67
import {
78
TEAM_AND_INSTALLATION_PARAMS_SCHEMA,
89
RESET_TOKEN_SUCCESS_RESPONSE_SCHEMA,
@@ -38,7 +39,7 @@ export default async function resetTokenRoute(server: FastifyInstance) {
3839
}
3940
}
4041
}, async (request, reply) => {
41-
const { installationId } = request.params as TeamAndInstallationParams;
42+
const { teamId, installationId } = request.params as TeamAndInstallationParams;
4243
const userId = request.user!.id;
4344

4445
request.log.info({
@@ -62,6 +63,19 @@ export default async function resetTokenRoute(server: FastifyInstance) {
6263
return reply.status(404).type('application/json').send(jsonString);
6364
}
6465

66+
// Notify satellite to refresh config and pick up new token hash
67+
try {
68+
const satelliteCommandService = new SatelliteCommandService(db, request.log);
69+
await satelliteCommandService.notifyMcpUpdate(installationId, teamId, userId);
70+
} catch (commandError) {
71+
request.log.warn({
72+
operation: 'reset_instance_token_satellite_notify',
73+
installationId,
74+
error: commandError instanceof Error ? commandError.message : 'Unknown error'
75+
}, 'Failed to notify satellite of token reset');
76+
// Non-fatal: token is already reset in DB, satellite will pick it up on next config refresh
77+
}
78+
6579
const successResponse: ResetTokenSuccessResponse = {
6680
success: true,
6781
data: {

0 commit comments

Comments
 (0)