-
-
Notifications
You must be signed in to change notification settings - Fork 39.8k
Closed
Description
Problem
When resuming a Claude session with --resume <session_id>, Claude may return a different session ID in its JSON output than the one requested. Currently, warelay doesn't track this, so subsequent messages may fail to continue the conversation properly.
Proposed solution
- Extract
session_idfrom Claude's JSON output incommand-reply.ts - Compare returned session ID with the requested one
- If different, update the session store with the new ID
Affected files
src/auto-reply/command-reply.ts- addextractClaudeSessionId()and includesessionIdinCommandReplyMetasrc/auto-reply/reply.ts- update session store when Claude returns a different session ID
Implementation
// command-reply.ts
export function extractClaudeSessionId(payload: unknown): string | undefined {
if (!payload || typeof payload !== "object") return undefined;
const obj = payload as Record<string, unknown>;
return typeof obj.session_id === "string" ? obj.session_id : undefined;
}// reply.ts - after getting response
if (meta.sessionId && sessionStore && sessionKey && meta.sessionId !== sessionId) {
sessionStore[sessionKey] = {
sessionId: meta.sessionId,
updatedAt: Date.now(),
systemSent,
};
await saveSessionStore(storePath, sessionStore);
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels