Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/routes/session-actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*/

import type { FastifyInstance, FastifyRequest, FastifyReply } from 'fastify';
import { SYSTEM_TENANT } from '../config.js';
import { sendMessageSchema, commandSchema, permissionRuleSchema, permissionProfileSchema, type PermissionProfile } from '../validation.js';
import type { PermissionPolicy } from '../validation.js';
import { registerPermissionRoutes } from '../permission-routes.js';
Expand Down Expand Up @@ -54,7 +55,7 @@ export function registerSessionActionRoutes(app: FastifyInstance, ctx: RouteCont
}
try {
const result = acpBackend && config.acpEnabled
? await acpBackend.sendPrompt(sessionId, text, { tenantId: (req as any).tenantId ?? 'system', ownerKeyId: (req as any).authKeyId ?? 'master' })
? await acpBackend.sendPrompt(sessionId, text, { tenantId: (req as any).tenantId ?? SYSTEM_TENANT, ownerKeyId: (req as any).authKeyId ?? 'master' })
: await sessions.sendMessage(sessionId, text);
// Issue #1809: Re-fetch stall info AFTER delivery to avoid false-positive.
// Previously we called getStallInfo BEFORE send, capturing a stale state
Expand Down Expand Up @@ -272,7 +273,7 @@ export function registerSessionActionRoutes(app: FastifyInstance, ctx: RouteCont
try {
const cmd = command.startsWith('/') ? command : `/${command}`;
const cmdResult = acpBackend && config.acpEnabled
? await acpBackend.sendPrompt(session.id, cmd, { tenantId: (req as any).tenantId ?? 'system', ownerKeyId: (req as any).authKeyId ?? 'master' })
? await acpBackend.sendPrompt(session.id, cmd, { tenantId: (req as any).tenantId ?? SYSTEM_TENANT, ownerKeyId: (req as any).authKeyId ?? 'master' })
: await sessions.sendMessage(session.id, cmd);
return { ok: true };
} catch (e: unknown) {
Expand Down
4 changes: 2 additions & 2 deletions src/routes/sessions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ export function registerSessionRoutes(app: FastifyInstance, ctx: RouteContext):
}
}
promptDelivery = acpBackend && ctx.config.acpEnabled
? await acpBackend.sendPrompt(existing.id, finalPrompt, { tenantId: req.tenantId ?? 'system', ownerKeyId: req.authKeyId ?? 'master' })
? await acpBackend.sendPrompt(existing.id, finalPrompt, { tenantId: req.tenantId ?? SYSTEM_TENANT, ownerKeyId: req.authKeyId ?? 'master' })
: await sessions.sendInitialPrompt(existing.id, finalPrompt);
metrics.promptSent(promptDelivery.delivered);
}
Expand Down Expand Up @@ -469,7 +469,7 @@ export function registerSessionRoutes(app: FastifyInstance, ctx: RouteContext):
}
}
promptDelivery = acpBackend && ctx.config.acpEnabled
? await acpBackend.sendPrompt(session.id, finalPrompt, { tenantId: req.tenantId ?? 'system', ownerKeyId: req.authKeyId ?? 'master' })
? await acpBackend.sendPrompt(session.id, finalPrompt, { tenantId: req.tenantId ?? SYSTEM_TENANT, ownerKeyId: req.authKeyId ?? 'master' })
: await sessions.sendInitialPrompt(session.id, finalPrompt);
metrics.promptSent(promptDelivery.delivered);
}
Expand Down
Loading