refactor: drop legacy session store keys
This commit is contained in:
@@ -52,11 +52,6 @@ function resolveSessionEntryForKey(
|
||||
if (!store || !sessionKey) return {};
|
||||
const direct = store[sessionKey];
|
||||
if (direct) return { entry: direct, key: sessionKey };
|
||||
const parsed = parseAgentSessionKey(sessionKey);
|
||||
const legacyKey = parsed?.rest;
|
||||
if (legacyKey && store[legacyKey]) {
|
||||
return { entry: store[legacyKey], key: legacyKey };
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@ import { updateSessionStore } from "../../config/sessions.js";
|
||||
import { logVerbose } from "../../globals.js";
|
||||
import { createInternalHookEvent, triggerInternalHook } from "../../hooks/internal-hooks.js";
|
||||
import { scheduleGatewaySigusr1Restart, triggerClawdbotRestart } from "../../infra/restart.js";
|
||||
import { parseAgentSessionKey } from "../../routing/session-key.js";
|
||||
import { parseActivationCommand } from "../group-activation.js";
|
||||
import { parseSendPolicyCommand } from "../send-policy.js";
|
||||
import {
|
||||
@@ -23,11 +22,6 @@ function resolveSessionEntryForKey(
|
||||
if (!store || !sessionKey) return {};
|
||||
const direct = store[sessionKey];
|
||||
if (direct) return { entry: direct, key: sessionKey };
|
||||
const parsed = parseAgentSessionKey(sessionKey);
|
||||
const legacyKey = parsed?.rest;
|
||||
if (legacyKey && store[legacyKey]) {
|
||||
return { entry: store[legacyKey], key: legacyKey };
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { normalizeChatType } from "../../channels/chat-type.js";
|
||||
import { resolveConversationLabel } from "../../channels/conversation-label.js";
|
||||
import type { MsgContext } from "../templating.js";
|
||||
import { formatInboundBodyWithSenderMeta } from "./inbound-sender-meta.js";
|
||||
import { normalizeInboundTextNewlines } from "./inbound-text.js";
|
||||
|
||||
export type FinalizeInboundContextOptions = {
|
||||
@@ -55,5 +56,13 @@ export function finalizeInboundContext<T extends Record<string, unknown>>(
|
||||
normalized.ConversationLabel = explicitLabel;
|
||||
}
|
||||
|
||||
// Ensure group/channel messages retain a sender meta line even when the body is a
|
||||
// structured envelope (e.g. "[Signal ...] Alice: hi").
|
||||
normalized.Body = formatInboundBodyWithSenderMeta({ ctx: normalized, body: normalized.Body });
|
||||
normalized.BodyForAgent = formatInboundBodyWithSenderMeta({
|
||||
ctx: normalized,
|
||||
body: normalized.BodyForAgent,
|
||||
});
|
||||
|
||||
return normalized;
|
||||
}
|
||||
|
||||
@@ -170,13 +170,6 @@ export async function initSessionState(params: {
|
||||
}
|
||||
|
||||
sessionKey = resolveSessionKey(sessionScope, sessionCtxForState, mainKey);
|
||||
if (groupResolution?.legacyKey && groupResolution.legacyKey !== sessionKey) {
|
||||
const legacyEntry = sessionStore[groupResolution.legacyKey];
|
||||
if (legacyEntry && !sessionStore[sessionKey]) {
|
||||
sessionStore[sessionKey] = legacyEntry;
|
||||
delete sessionStore[groupResolution.legacyKey];
|
||||
}
|
||||
}
|
||||
const entry = sessionStore[sessionKey];
|
||||
const previousSessionEntry = resetTriggered && entry ? { ...entry } : undefined;
|
||||
const idleMs = idleMinutes * 60_000;
|
||||
@@ -309,12 +302,6 @@ export async function initSessionState(params: {
|
||||
// Preserve per-session overrides while resetting compaction state on /new.
|
||||
sessionStore[sessionKey] = { ...sessionStore[sessionKey], ...sessionEntry };
|
||||
await updateSessionStore(storePath, (store) => {
|
||||
if (groupResolution?.legacyKey && groupResolution.legacyKey !== sessionKey) {
|
||||
if (store[groupResolution.legacyKey] && !store[sessionKey]) {
|
||||
store[sessionKey] = store[groupResolution.legacyKey];
|
||||
}
|
||||
delete store[groupResolution.legacyKey];
|
||||
}
|
||||
// Preserve per-session overrides while resetting compaction state on /new.
|
||||
store[sessionKey] = { ...store[sessionKey], ...sessionEntry };
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user