fix: ignore invalid claude hook starts
This commit is contained in:
@@ -124,7 +124,18 @@ function emitError(sessionKey: string | undefined, runId: string | undefined, sp
|
||||
}
|
||||
|
||||
async function handleSessionStart(input: Dict) {
|
||||
const sessionKey = getSessionKey(input) || randomUUID();
|
||||
const sessionKey = getSessionKey(input);
|
||||
if (!sessionKey) {
|
||||
console.error('[agentmon] ignoring claude-code session.start without session_id');
|
||||
return;
|
||||
}
|
||||
|
||||
const hookEventName = pickString(input.hook_event_name);
|
||||
if (hookEventName && hookEventName !== 'SessionStart') {
|
||||
console.error(`[agentmon] ignoring claude-code session.start with hook_event_name=${hookEventName}`);
|
||||
return;
|
||||
}
|
||||
|
||||
const runId = randomUUID();
|
||||
activeRuns.set(sessionKey, runId);
|
||||
saveState(sessionKey, { runId, spans: {} });
|
||||
|
||||
Reference in New Issue
Block a user