fix: require explicit system event session keys

This commit is contained in:
Peter Steinberger
2026-01-09 21:58:55 +01:00
parent cb2a365594
commit 42a0089b3b
14 changed files with 123 additions and 53 deletions

View File

@@ -111,7 +111,7 @@ export async function buildStatusReply(params: {
cfg: ClawdbotConfig;
command: CommandContext;
sessionEntry?: SessionEntry;
sessionKey?: string;
sessionKey: string;
sessionScope?: SessionScope;
provider: string;
model: string;
@@ -390,7 +390,7 @@ export async function handleCommands(params: {
directives: InlineDirectives;
sessionEntry?: SessionEntry;
sessionStore?: Record<string, SessionEntry>;
sessionKey?: string;
sessionKey: string;
storePath?: string;
sessionScope?: SessionScope;
workspaceDir: string;
@@ -815,7 +815,7 @@ export async function handleCommands(params: {
const line = reason
? `${compactLabel}: ${reason}${contextSummary}`
: `${compactLabel}${contextSummary}`;
enqueueSystemEvent(line);
enqueueSystemEvent(line, { sessionKey });
return { shouldContinue: false, reply: { text: `⚙️ ${line}` } };
}

View File

@@ -447,7 +447,7 @@ export async function handleDirectiveOnly(params: {
directives: InlineDirectives;
sessionEntry?: SessionEntry;
sessionStore?: Record<string, SessionEntry>;
sessionKey?: string;
sessionKey: string;
storePath?: string;
elevatedEnabled: boolean;
elevatedAllowed: boolean;
@@ -836,6 +836,7 @@ export async function handleDirectiveOnly(params: {
enqueueSystemEvent(
formatModelSwitchEvent(nextLabel, modelSelection.alias),
{
sessionKey,
contextKey: `model:${nextLabel}`,
},
);
@@ -1103,6 +1104,7 @@ export async function persistInlineDirectives(params: {
enqueueSystemEvent(
formatModelSwitchEvent(nextLabel, resolved.alias),
{
sessionKey,
contextKey: `model:${nextLabel}`,
},
);