Skip to content

TD-5302: the computer is told when a timed phone permission runs out - #128

Merged
captcrock merged 1 commit into
mainfrom
td/5302-grant-lapse
Nov 24, 2026
Merged

captcrock merged 1 commit into
mainfrom
td/5302-grant-lapse

Conversation

@captcrock

Copy link
Copy Markdown
Contributor

Owner decision #6: a time-limited phone grant whose expiry the daemon enforces, and the computer sees it lapse.

What was already on main (TD-5279), checked: Settings already offers "Turn on for 1 hour", and the protocol accepts expires_in_seconds up to seven days. The expiry is saved in phone-permissions.yaml, and the policy reads the clock on every message, so a grant stops working at its expiry even with no window open.

What was missing: the computer was never told when a grant ran out. The Settings row just read "Off" again.

Change

  • The expiry timer now snapshots the grants when it is armed. When it fires, it sends phone_permission_lapsed (capability, label, expired_at) for each timed grant that was on and is no longer live.
  • It goes to the computer's own windows only, never to a phone. A grant switched off by hand is never reported, because switching it off re-arms the timer first.
  • The window shows a banner naming the permission and where to turn it on again.
  • Also updated: protocol (Python and TS), fixtures, the client event list, the architecture row, the DECISIONS entry and the backlog story.

Tests

  • test_phone_grant_lapse.py runs a 3-second grant over the wire: allowed, then the lapse event, then phone_permission_off, and the phone is not sent the event. Turning a grant off by hand sends no event.
  • UI: the banner, deduplication, and an unreadable time.
  • Full suites: core 9015 passed before the timing fix, then the lapse test passed 8 runs in a row. tsc, svelte-check, vitest (2882) and the build pass. Release scan: 0 hits.

🤖 Generated with Claude Code

"Turn on for 1 hour" and a daemon-enforced expiry were already there
(TD-5279): the policy reads the clock on every message. The computer
was never told when a grant ran out; its Settings row just read "Off"
again. The expiry timer now snapshots the grants when armed and, when
it fires, sends phone_permission_lapsed (loopback windows only) for
each timed grant that was on and is not live now. The window shows a
banner naming the permission and where to turn it on again. A grant
switched off by hand re-arms the timer first, so it is never reported.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@captcrock
captcrock merged commit b147b01 into main Nov 24, 2026
4 checks passed
@captcrock
captcrock deleted the td/5302-grant-lapse branch November 24, 2026 16:35
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