Repository navigation
Conversation
|
Good catch: the watchdog and the floor both read "Permission required, waiting for your input" as idle today, and trusting
|
- Share notification classification across WorkerWake and renderer paths. - Prefer known structured notification types and fall back to HITL-first message heuristics. - Pass notification types into WorkerWake and guard malformed runtime field values.
- Drive real Notification payloads through HookServer.handle and assert each field reaches onEvent in its own slot. - Wire a real WorkerWakeWatchdog the way index.ts does so permission_prompt arms the HITL hold and idle_prompt does not. - Catches a notificationType or tool slot slip that typecheck cannot, since the trailing parameters are loosely typed.
- Replace the dead notification_type === 'idle' check: Claude Code sends idle_prompt, so the toast only ever fired through the message wording. - Add isIdleWaitNotification to hookClassify so the toast shares the watchdog's type rules: idle_prompt notifies, blocking types never do. - Without a known type, toast only on idle wording that is not a HITL prompt, so auth_success, empty, and mixed permission messages stay quiet. - Cover the toast through HookServer.handle with a real notifier.
ada1303 to
cd3a3e1
Compare
@gpinkham Thanks! Rebased onto main and fixed all four:
Typecheck and build pass, and |
|
/copilot-review claude-opus-5.5 medium |
Copilot reviewAsked by @HsienW. Model: claude-opus-5.5. Effort: medium. Head: Checking whether the renderer event actually carries 1. The PR moves Notification classification into return !!m && ASKS_PERSON.test(m) && !QUIET.test(m);This copy also never sees Concrete cases where
So the watchdog stops its own nudge, but any other send through Fix: have 2. The toast test for non-Notification events is weak ( The test sends a An exact check such as Everything else looks right:
|
- HookProofRecord.note now takes notification_type and opens the ask when classifyHook says needsHuman, replacing its own ASKS_PERSON/QUIET copy - HookServer.handle passes notification_type to the proof record - Add 'approval' to the shared HITL message markers so no old match is lost - Cover the mixed permission/idle message and a permission_prompt with idle wording in test/hook-proof.test.cjs and through HookServer.handle - Assert isIdleWaitNotification is false for non-Notification events directly instead of inspecting toast bodies
|
/copilot-review claude-opus-5.5 medium |
Copilot reviewAsked by @HsienW. Model: claude-opus-5.5. Effort: medium. Head: No blocking bugs found. Two lower-severity issues:
|
…toast - Match the HITL message markers as whole words, so an idle report such as "Changes approved — waiting for your input" no longer opens a ptySubmit ask that nothing closes on an idle agent - Keep "permissions" and "confirmation" as HITL wording - Toast on the legacy notification_type 'idle' again, as main did; the Grok hook shim passes its type through unchanged - Cover both cases in the classifier, HookProofRecord and HookServer toast tests
|
/copilot-review claude-opus-5.5 medium |
Copilot reviewAsked by @HsienW. Model: claude-opus-5.5. Effort: medium. Head: No blocking problems found. The shared classifier, the |
What & why
WorkerWake and the renderer currently classify Notification hooks independently, which allows mixed HITL and idle wording to fall through as idle when no authoritative notification type is available.
This change moves notification classification into a shared helper (
src/shared/hookClassify.ts), treats known structured notification types as authoritative, and uses HITL first message heuristics only when the type is missing or unknown. It also passesnotification_typethrough to WorkerWake and safely handles non string runtime values without changing the existing NDJSON framing or provider behavior.notification_typeis appended as the last argument ofHookServer.onEvent(aftertoolandsource) and ofWorkerWakeWatchdog.noteHook(aftertool). The existingindex.tscallback is kept and only passes it through.Terminal send guard (
ptySubmit)When
ptySubmitcannot read the screen, it asksHookProofRecord.askOpenwhether a permission or question prompt is open before typing into the terminal. That record had its own copy of the old rule and never sawnotification_type, so it missed both the mixed message from #676 and apermission_promptwith idle wording. Mail delivery and remote sends could still type into an open prompt even though WorkerWake held.HookProofRecord.notenow receivesnotification_typefromHookServer.handleand opens the ask whenclassifyHookreturnsneedsHuman. Its private rule is removed, andapproval, which only that copy matched, is added to the shared HITL markers. Quiet notifications still leave an open ask alone, and the same events close it as before.Nothing closes an ask on an idle agent, so a false open would hold every send until someone types into the terminal. The HITL markers therefore match whole words only: "Changes approved — waiting for your input" stays idle, while "permissions" and "confirmation" still count.
Desktop toast
The toast checked
notification_type === 'idle', but Claude sendsidle_prompt, so it only ever fired on the message wording. It now uses the same rules throughisIdleWaitNotification:idle_promptidletype (passed through by the Grok hook shim)mainpermission_prompt,elicitation_dialog, ...)auth_success, empty message, ...)Visible changes:
idle_promptalways toasts, whatever the wording.ptySubmitholds instead of typing while such a prompt is open and the screen cannot be read.Closes #676
Type of change
Evidence
Before
The same mixed Notification is classified as
idleonmain:After
The same Notification is classified as
needsHumanafter the fix:The WorkerWake suite, the
HookServer.handlewiring and toast tests, and the newHookProofRecordtests all pass:How I tested it
idleonmainandneedsHumanon this branch.test/worker-wake.test.cjs,test/hook-server-notification.test.cjsandtest/hook-proof.test.cjs, 40 tests, all pass.hook-server-notification.test.cjsdrives real payloads throughHookServer.handle. Movingnotification_typeinto the 4thonEventslot still typechecks but fails these tests.hook-proof.test.cjscovers theptySubmitask guard. The Worker wake can misclassify mixed HITL and idle notification wording #676 message with no type andpermission_promptwith idle wording fail without theHookProofRecordchange.idletoast type each have a test that fails without the change.npm run typecheck,npm run buildandgit diff --checkpass.npm run test:focused: 945 tests, 835 passed, 99 failed, 11 skipped. The failures are existing ones onmain(Windows symlink, Electron only, i18n, config path and concurrency) in files this PR does not touch. The 23 extra tests overmainare the ones this PR adds.idletype.Checklist
npm run typecheckpasses.npm run test:focusedpasses.npm run buildsucceeds.commented-out code, or unrelated formatting churn in it.
DESIGN.md/tokens.ts— no ad-hoc colors,spacing, or fonts.
ATTRIBUTION.md.