fix(gsd): handle session_switch event so /resume restores GSD state (#2587)

The GSD extension only listened for session_start, not session_switch.
When /resume switched to a previous session, GSD's write-gate, loop guard,
discussion flow, service tier, and tool API keys were never re-initialized,
leaving GSD in stale state from the prior session.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Lex Christopherson 2026-03-25 22:20:43 -06:00
parent 7cf4084a1e
commit e1f51592b1
2 changed files with 9 additions and 1 deletions

View file

@ -69,6 +69,14 @@ export function registerHooks(pi: ExtensionAPI): void {
}
});
pi.on("session_switch", async (_event, ctx) => {
resetWriteGateState();
resetToolCallLoopGuard();
clearDiscussionFlowState();
await syncServiceTierStatus(ctx);
loadToolApiKeys();
});
pi.on("before_agent_start", async (event, ctx: ExtensionContext) => {
return buildBeforeAgentStartResult(event, ctx);
});

View file

@ -12,7 +12,7 @@
"gsd_requirement_update", "gsd_milestone_generate_id"
],
"commands": ["gsd", "kill", "worktree", "exit"],
"hooks": ["session_start"],
"hooks": ["session_start", "session_switch"],
"shortcuts": ["Ctrl+Alt+G"]
}
}