Skip to content

Notify when something waits on you; wait for an unlock (KV_UNLOCK_WAIT=30s) - #89

Merged
DFanso merged 6 commits into
mainfrom
feat/waiting-notifications
Nov 23, 2026
Merged

DFanso merged 6 commits into
mainfrom
feat/waiting-notifications

Conversation

@DFanso

@DFanso DFanso commented Nov 22, 2026 •

Copy link
Copy Markdown
Owner

kv now tells Leo when something is waiting on him, not only when a request first arrives. A call that finds the vault locked now waits for an unlock by default.

New default: KV_UNLOCK_WAIT=30s

An agent's call that finds the vault locked now waits up to 30 seconds for an unlock instead of failing at once.

  • The wait starts only after the "unlock needed" notice is posted (or queued for kv tray), so you always learn why a call is hanging.
  • Unlock in time and the call runs as if the vault had been unlocked, approval included.
  • Otherwise the call gets the same vault_locked error as before.
  • KV_UNLOCK_WAIT=0 or off turns it off. Any duration up to 10m is accepted. kv daemon --unlock-wait does the same.
  • Calls never wait with KV_NOTIFY=off.
  • At most 32 calls wait at once (MAX_UNLOCK_WAITERS, the same bound as requests waiting for approval); past that, calls fail at once. There was no connection limit on the agent socket to reuse, so this is a new one.
  • Caveat: an MCP client whose tool-call timeout is shorter than the wait gives up first. The README says so.

Notices

ask and all cover all of these, and off none. There are no new KV_NOTIFY values.

Notice Trigger Rate Sound (alarm setting)
kv: unlock needed: "claude-code is waiting (http_request): unlock kv." An agent call refused with vault_locked. Any tool except status, list_handles and request_handle. First call in a locked period at once, then at most every 10 min, with " N calls since the last notice."; resets on unlock alarm
kv: still waiting: " About 30 s left." A request still unanswered at half of approval_wait Once per request; counts against the approval cap (10/min) alarm
kv: requests timed out: "You missed 3 requests (claude-code: github, prod-db; cursor: openrouter). Open kv's Audit tab to see them." approval_timeout 10 s gather after the first, then at most every 5 min; later ones accumulate default
kv: handle requested / kv: shared secret received Unchanged Unchanged default

Routing (no doubling)

  • New control command notifying_status. It needs no credential and returns the status plus the notices the daemon holds for the client.
    • macOS kv tray (with kv.app) asks for it every second instead of the agent-socket status, locked or not.
    • While the tray asks (fresh within 5 s), the daemon queues these notices for it and posts none itself.
    • If the tray stops asking, the daemon posts what is left.
    • It is not audited and does not keep a locked daemon running.
    • The client still verifies that the peer is this kv's daemon before sending it, so an impostor at the socket can't feed the tray notices.
  • Approval notices keep the existing session-based notifying_overview check.
  • The reminder goes to whichever side is posting when it is due.
  • Windows and Linux trays have no button helper, so they never take the outbox; the daemon posts as before.
  • A new tray talking to an older daemon falls back to the agent-socket status.

Item 3: handle requests and shares on macOS

Neither was suppressed when the tray was the notifier. They were always posted by the daemon through notify-rust, and a non-bundled process posts as com.apple.Finder on macOS. So they showed under "Finder" and were silenced whenever Finder notifications were off.

With kv tray running they now come from kv.app ("kv"), with Open kv. Without the tray they still come from Finder; the README says to check System Settings → Notifications → Finder.

kv tray (macOS)

  • unlock needed: has an Unlock button. It and a click do what the menu's Unlock does: Touch ID, otherwise kv's window asks for the passphrase. The notice is withdrawn once the vault is unlocked anywhere.
  • missed requests / handle requested / share received: have Open kv, which opens the window on Audit / Handles / Shares.
  • still waiting: re-posts the request's own notification (new key, old one withdrawn), with its answers and the subtitle "Reminder: about N s left". If the tray has no session it opens Approvals instead.

Tests

  • tests/notices.rs (state): locked notice text and once-per-period throttle; status and list_handles excluded; KV_NOTIFY=off; unlock resets the period; notifying_status needs no credential, queues instead of posting, and is not audited; a stale outbox goes to the plain path exactly once; polling does not keep a locked daemon alive; reminder text and no reminder once answered; missed coalescing.
  • daemon/notices.rs unit tests: 10-minute cap, counts, 32-notice outbox cap, 10 s gather and 5 min cap with nothing lost, tray text vs plain text.
  • tests/unlock_wait.rs (live sockets): a call waits, its notice is queued first, and after unlocking it runs through approval to upstream; timeout → vault_locked after the wait; off or KV_NOTIFY=off → immediate; 32 waiters + the 33rd fails at once; a live reminder arrives at half the wait.
  • tests/tray_worker.rs: unlock notice → Unlock button → Touch ID session; notice withdrawn on an unlock elsewhere; handle request → Open kv → Handles; reminder re-post with answers, and answering it lets the call through.
  • tray/notices.rs unit tests; KV_UNLOCK_WAIT parsing.

The kv.app button categories (ui/notices.rs) are macOS-only and are checked by CI's macOS build and by hand.

Release notes (draft for 1.9.4)

Changed

  • An agent's call that finds the vault locked now waits up to 30 seconds for you to unlock it, after a notification saying so, instead of failing at once. Set KV_UNLOCK_WAIT=off (then kv stop) to keep the old behaviour, or any duration up to 10m. Your MCP client's own tool timeout may be shorter.

New

  • "Unlock needed" notification when an agent is refused because the vault is locked; on macOS with kv tray it has an Unlock button (Touch ID).
  • A reminder halfway through an unanswered request's wait.
  • "You missed N requests" after requests time out, opening kv's Audit tab.

Fixed

  • On macOS with kv tray running, handle-request and shared-secret notifications now come from kv (with Open kv) instead of Finder, where they could be silenced.

…nlock

- An agent call refused because the vault is locked is announced ("unlock
  needed"): the first in a locked period at once, then at most every 10
  minutes with a count.
- A request still unanswered halfway through its wait gets a reminder,
  under the approval notices' cap.
- Requests that time out are told of together: a 10 s gather, then at most
  one notice every 5 minutes.
- Handle requests and received shares go the same way.
- A new control command, notifying_status, needs no credential. It returns
  the status and the notices the daemon holds for kv tray to post under
  kv's own name, locked or not. While the tray asks, the daemon posts none
  of these itself; if it stops asking for 5 s, the daemon posts what is
  left. It does not keep a locked daemon running and is not audited.
- KV_UNLOCK_WAIT / --unlock-wait (default 30s, 0 or off to disable, at most
  10m): a call refused because the vault is locked waits for an unlock
  after its notice is posted or queued, then runs. On timeout it gets the
  same vault_locked as before. At most 32 calls wait at once. Never with
  KV_NOTIFY=off.
…en kv

- On macOS, where kv.app posts notifications, the tray asks the daemon for
  notifying_status every second instead of the agent socket's status. It
  posts the notices it gets under kv's name instead of the daemon posting
  them as Finder.
- "Unlock needed" has an Unlock button. It and a click do what the menu's
  Unlock does: Touch ID, or kv's window asking for the passphrase. The
  notification goes once the vault is unlocked anywhere.
- Missed requests, handle requests and shares have Open kv, which opens the
  window on Audit, Handles or Shares.
- A reminder brings the request's own notification back with its answers.
- An older daemon that does not know the command is asked the old way.
…tons

Documents the unlock-needed, still-waiting and requests-timed-out notices,
the new 30 s default for KV_UNLOCK_WAIT and the MCP client timeout caveat,
the buttons kv tray gives them on macOS, and that the daemon's own
notifications show under Finder there. Adds an upgrade note for the new
default.
@coderabbitai

coderabbitai Bot commented Nov 22, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 23 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 55e33d82-d58c-4b70-838e-38bfcd5a339b
Commits

Reviewing files that changed from the base of the PR and between 6ff960e and 96a8e43.

Files selected for processing: 19

  • README.md
  • crates/kv-core/src/proto.rs
  • crates/kv/src/cli.rs
  • crates/kv/src/daemon.rs
  • crates/kv/src/daemon/notices.rs
  • crates/kv/src/daemon/server.rs
  • crates/kv/src/daemon/state.rs
  • crates/kv/src/notify.rs
  • crates/kv/src/tray/notices.rs
  • crates/kv/src/tray/ui/notices.rs
  • crates/kv/src/tray/worker.rs
  • crates/kv/tests/common/mod.rs
  • crates/kv/tests/live/mod.rs
  • crates/kv/tests/notices.rs
  • crates/kv/tests/notify.rs
  • crates/kv/tests/request.rs
  • crates/kv/tests/share.rs
  • crates/kv/tests/tray_worker.rs
  • crates/kv/tests/unlock_wait.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@DFanso
DFanso merged commit e412363 into main Nov 23, 2026
12 checks passed
@DFanso
DFanso deleted the feat/waiting-notifications branch November 23, 2026 05:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant