The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.
review: apply sanitizeSessionId to UUID shortId, fix test comment
Taro Kawakami01d816781e98
diff --git a/scripts/hooks/session-end.js b/scripts/hooks/session-end.jsindex bfd9a2e8c..4ad08a4f4 100644--- a/scripts/hooks/session-end.js+++ b/scripts/hooks/session-end.js@@ -16,6 +16,7 @@ const {getDateString,getTimeString,getSessionIdShort,+ sanitizeSessionId,getProjectName,ensureDir,readFile,@@ -202,7 +203,11 @@ async function main() {let shortId = null;if (transcriptPath) {const m = path.basename(transcriptPath).match(/([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\.jsonl$/i);- if (m) { shortId = m[1].slice(-8).toLowerCase(); }+ if (m) {+ // Run through sanitizeSessionId() for byte-for-byte parity with+ // getSessionIdShort(sessionId.slice(-8)).+ shortId = sanitizeSessionId(m[1].slice(-8).toLowerCase());+ }}if (!shortId) { shortId = getSessionIdShort(); }const sessionFile = path.join(sessionsDir, `${today}-${shortId}-session.tmp`);diff --git a/tests/hooks/hooks.test.js b/tests/hooks/hooks.test.jsindex 0cd981e2e..5de6bd52b 100644--- a/tests/hooks/hooks.test.js+++ b/tests/hooks/hooks.test.js@@ -651,8 +651,10 @@ async function runTests() {await runScript(path.join(scriptsDir, 'session-end.js'), stdinJson, {HOME: isoHome,USERPROFILE: isoHome,- // Explicitly clear CLAUDE_SESSION_ID so parent env does not leak in and- // force the getSessionIdShort() fallback instead of the transcript path.+ // Clear CLAUDE_SESSION_ID so parent-process env does not leak into the+ // child and the test deterministically exercises the transcript_path+ // branch (getSessionIdShort() is the alternative path that is not+ // exercised here).CLAUDE_SESSION_ID: ''});