Files
PaperClipAI/ui/src/pages
Devin FoleyandPaperclip e4b119440e Show live provider reset countdowns in the viewer's timezone (#22225)
## Thinking Path

> - Paperclip manages agents and their assigned work.
> - Provider usage limits can hold that work until a reset deadline.
> - Saved wait messages expose raw timestamps, and the usage popover
shows a short weekday clock.
> - People need the remaining wait and the exact deadline in their
current timezone.
> - This pull request formats both views in the browser and updates the
countdown live.
> - The browser uses its timezone while stored messages and retry
deadlines stay unchanged.

## Linked Issues or Issue Description

**What existing behavior does this improve?**
Provider usage limit messages and the agent usage-limit property and
popover.

**Subsystem affected**
UI presentation of provider usage limits, task notices, run details, log
events, and recovery actions.

**Current behavior**
Wait messages print `2026-11-18T20:17:34.353Z`. The usage popover shows
a short clock such as `Thu 23:00`. Neither gives a live relative
countdown. If the provider did not report a reset, the scheduler uses
the recorded failure time plus one hour.

**Proposed behavior**
A Pacific-time viewer sees `in 44 minutes (Nov 18, 2026, 12:17 PM PST)`.
The relative part counts down while the tab is visible. The usage
property and popover show the same local deadline. Expired usage windows
clear through the existing summary rules.

**Reason and benefit**
People can see how long remains without converting a timestamp or
refreshing the page. The date conversion handles daylight saving time
and local date changes.

**Breaking changes**
Displayed text and popover layout change. Stored messages, API payloads,
error codes, provider checks, and retry deadlines keep their contracts.

## What Changed

- Add an optional timezone label to the existing `formatDateTime`
helper. Existing callers keep their output.
- Share relative and exact local time formatting between provider-limit
messages and the usage popover. Unrelated text and invalid timestamps
stay intact.
- Reuse the existing shared one-second ticker. Countdown updates pause
in hidden tabs, catch up when shown, and stop at the deadline or on
unmount. No API polling is added.
- Keep timer-driven message rendering separate from large parent pages.
Hidden task-marker details do not subscribe until opened.
- Update task notices, agent run errors in both UI shells, log events,
and provider-limit next actions.
- Update the usage-limit trigger and every window in its popover. Reset
details wrap below the percentage row. The reported timestamp includes
its timezone. Explicit clocks remain fixed for stories.

## Verification

Tested source: `ef79ce40b170db89a6b831162c72d6446cd9492d`. Local checks
ran with the same file contents on macOS arm64, Node 25.6.1, and pnpm
9.15.4.

- From `ui/`: `pnpm exec vitest run
src/lib/provider-limit-message.test.ts src/lib/utils.date-time.test.ts
src/components/ProviderLimitMessage.test.tsx
src/hooks/useSecondTick.test.tsx
src/components/AgentRateLimitGauge.test.tsx
src/components/task-chat/TaskChatMarker.test.tsx
src/components/task-chat/TaskChatSystemNotice.test.tsx
src/components/IssueRunLedger.test.tsx
src/components/IssueRecoveryActionCard.test.tsx
src/components/StalledDependencyNotice.test.tsx
src/pages/AgentDetail.log-visibility.test.tsx
src/pages/AgentDetail.log-resilience.test.tsx` — 176 tests passed across
12 files.
- From `ui/`: `pnpm run typecheck` — passed, including Storybook catalog
generation.
- From the repository root: `pnpm check:token-gates` and `git diff
--check` — passed.
- Regression proof: four live-message cases failed against static
rendering. Four usage-popover cases failed against the old clock. Both
suites passed after the changes.
- Fake-clock tests prove `44 minutes` becomes `43 minutes` without a
page refresh or parent render. Other cases cover seconds near the
deadline, one shared timer, hidden-tab pause and catch-up, expiry, and
cleanup.
- Timezone cases cover Pacific, India, and New Zealand timezones, a
local date rollover, and daylight saving time. Task notice cases cover
both presentations. Usage-popover cases cover Claude and Codex.
- Local setup required a non-frozen install because the base lockfile
lacked two AWS SDK dependencies from the server manifest. No dependency
or lockfile change is included.
- Final CI: [workflow attempt
4](https://github.com/paperclipai/paperclip/actions/runs/44384225521/attempts/4)
succeeded on `ef79ce40b170db89a6b831162c72d6446cd9492d`. All 54
successful checks are green, including the applicable typecheck, build,
server tests, Runner checks, and all eight end-to-end shards. Optional
jobs skipped by the CI plan remain skipped.
- Recovery record: [Canary attempt
1](https://github.com/paperclipai/paperclip/actions/runs/44384225521/job/135085343566),
[attempt
2](https://github.com/paperclipai/paperclip/actions/runs/44384225521/job/135097010510),
and [attempt
3](https://github.com/paperclipai/paperclip/actions/runs/44384225521/job/135100921795)
ended with runner shutdown signals at 19:56:15, 20:12:55, and 20:19:18
UTC. The aggregate verification failures reflected that canary result.
No source changed between attempts. The [fourth Canary Dry
Run](https://github.com/paperclipai/paperclip/actions/runs/44384225521/job/135105826026)
and [aggregate
verification](https://github.com/paperclipai/paperclip/actions/runs/44384225521/job/135110708013)
passed.
- Greptile reviewed the final commit at 5/5 with no actionable findings
and no unresolved review threads. GitHub reports the branch mergeable
with a clean merge state.
- Full local repository checks and manual browser acceptance were not
run. CI supplied broad coverage on the final revision. The local popover
tests exercise its content and clock with mocked popover primitives.

## Risks

- Low risk. This changes UI presentation only. No migration or scheduler
change is required.
- The ticker updates visible future countdowns once per second. It makes
no provider request and does not certify that provider capacity has
returned.
- Message recognition uses the existing provider-limit wording and ISO
timestamps. Unrecognized messages retain their text.
- Local timezone abbreviations can differ by browser locale data. Time
conversion uses the browser's timezone rules.

## Model Used

- OpenAI Codex, `gpt-6.1-sol`, with xhigh reasoning effort, repository
inspection, code edits, and test execution.

## Checklist

- [x] I have included a thinking path that traces from project context
to this change
- [x] I have specified the model used (with version and capability
details)
- [x] I have checked ROADMAP.md and confirmed this PR does not duplicate
planned core work
- [x] I have searched GitHub for duplicate or related PRs
- [x] I have described the issue in-PR with the enhancement template
fields
- [x] I have not referenced internal or instance-local Paperclip issues
or links
- [x] My branch name describes the change and contains no internal
ticket id
- [x] I have run the focused tests locally and they pass
- [x] I have added or updated tests where applicable
- [x] The code, tests, and this description document the changed output
- [x] I have considered and documented the risks
- [x] All Paperclip CI gates are green
- [x] Greptile is 5/5 with no open P2s, recommendations, or follow-ups
- [x] I will address all Greptile and reviewer comments before
requesting merge

---------

Co-authored-by: Paperclip <noreply@paperclip.ing>
2026-11-18 14:19:17 -08:00
..