Skip to content

feat(interactions): show countdowns for known approval deadlines - #226

Merged
nixuuu merged 1 commit into
devfrom
feat/approval-countdown
Nov 5, 2026
Merged

nixuuu merged 1 commit into
devfrom
feat/approval-countdown

Conversation

@nixuuu

@nixuuu nixuuu commented Nov 5, 2026

Copy link
Copy Markdown
Member

Approval and question cards now show how much time is left when the deadline is known.

Deadlines (from the same place that enforces the timeout)

  • A thread's synchronous ask_user: 120 s.
  • Claude's in-process MCP tool call: the existing 330 s constant.
  • Unknown limits get no deadline and no countdown: Claude bots over HTTP MCP, and offline waits with no limit.
  • Deadlines are stored (migration 0085_interaction_deadlines) and survive replay; when two limits apply, the earlier one wins. Timeout values are unchanged.
  • Additive proto fields carry the deadline to the UI for threads and bots.

On the card (RequestCountdown.svelte)

  • "Expires in 1:45", turning amber in the last 25 s.
  • "Expiring…" at zero, until the gateway's expiry event marks the card Expired. The gateway decides expiry, never the countdown.
  • Updates locally once a second, with reserved space and tabular digits, so nothing moves. No animation.
  • Uses the client clock, since there is no server time offset yet.
  • The native mobile cards are deferred.

Tests: gateway integration in ask-user.test.ts and bots-harness.test.ts:

  • deadlines are set for the known paths and absent for unknown ones;
  • the deadline matches the actual expiry within tolerance;
  • the deadline survives replay.

43 related integration tests pass. check:tmp: 1442 passed, 0 failed.

Copy audit (§8):

  • "Expires in m:ss" shows a known deadline.
  • "Expiring…" avoids claiming an expiry before the gateway confirms it.

Checked through the ticking, warning, expiring and expired states, in light and dark, at desktop and phone width.

Persist enforced response deadlines across replay and expose them to cards.
Show a stable countdown that waits for gateway expiry at zero. Keep unknown
and unbounded waits without a deadline, including offline bot approvals.

Related: #225
@nixuuu
nixuuu merged commit 2430ba2 into dev Nov 5, 2026
9 checks passed
@nixuuu
nixuuu deleted the feat/approval-countdown branch November 5, 2026 21:39
nixuuu added a commit that referenced this pull request Nov 9, 2026
Moves known request deadlines into a shared card header: beside the
title on wider cards and right-aligned below it on narrow cards. The
question panel keeps the countdown before its collapse chevron,
truncates the title first, and preserves the header when the gateway
marks the request expired. Known deadlines keep their reserved space
after resolution.

Applies the same header pattern to thread permission cards, timeline
requests, bot questions and bot approvals. Mobile question and timeline
requests use the equivalent wrapping header; the changes are JS/TS only.
Amber at 25 seconds, tabular digits and non-live countdown behavior are
preserved. The existing intentional two-row question footer is
unchanged.

### Verification

- Browser: light/dark at 1280, 720 and 390 px; short, typical and very
long synthetic titles; question panel, timeline request, permission card
and both bot cards. Checked normal/amber/zero/expired countdown states,
collapse/expand before and after expiry, and advancing from 1 of 3 to 2
of 3. Header dimensions and title/chevron positions remain stable
relative to the header when the countdown clears. No overlapping
controls or seams observed. Temporary gallery fixtures were removed; no
screenshots are committed.
- Passed: `bun install`, `bun run gen:check`, `bun run typecheck`, `bun
run lint`, `bun run format:check`, and `bun run --filter @canopy/web
build`.
- Passed: full `bun run check:tmp`, 1854 passed / 161 skipped / 0 failed
across 329 files, with nothing left in its temporary directory. A
preceding full run hit three `ENOSPC` failures while copying supervisor
test binaries in the memory-backed temporary filesystem; the complete
rerun used a disk-backed temporary directory and passed, including those
three cases. No test or application code was changed for this
environment issue.
- Mobile: `bunx [email protected] fingerprint:generate --platform
<ios|android> --build-profile production --json --non-interactive`
passed before and after the changes. Unchanged fingerprints: iOS
`2a0ef03a2a0fda8e7fad2e3df8609803d2edbda3`; Android
`c5c880ae8d0f5d7bc867fcbaf8f756b2ca56a07d`. No native-device visual
check was performed.
- Copy audit: no new or changed UI text.

Related: #226
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