fix(plugin): scope synthetic-idle dedup bypass to matching marker

Only clear recentAnyIdles when the stored marker matches the synthetic idle timestamp for the same session, preventing accidental clobbering of newer idle markers. Add a regression test to verify other sessions keep their dedup state during this bypass path.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
YeonGyu-Kim
2026-05-11 08:45:34 +09:00
parent a196d84c2e
commit 2168040ac6
2 changed files with 70 additions and 1 deletions
+4 -1
View File
@@ -417,7 +417,10 @@ export function createEventHandler(args: {
recentSyntheticIdles.delete(sessionID);
// Let real idle events through even when a synthetic idle fired moments earlier.
// OpenCode diagnostics expect a concrete session.idle event signal.
recentAnyIdles.delete(sessionID);
const lastAnyIdleAt = recentAnyIdles.get(sessionID);
if (lastAnyIdleAt === emittedAt) {
recentAnyIdles.delete(sessionID);
}
}
recentRealIdles.set(sessionID, now);
if (!shouldDispatchIdleEvent(sessionID, now)) {