Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

ui-react: run durations read "1m 60s" and "60.0s" because rounded seconds never carry

Open Beginner friendly
#2,605 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
76/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
bun, typescript
Domain
frontend

Research direction

Start with packages/ui-react/src/lib/duration.ts and the existing formatDuration tests in packages/ui-react/tests/tool-views.test.ts. Round to the displayed precision before splitting seconds and minutes, then add the listed edge cases and sweep; done means no output has a seconds part of 60 or more and the existing expectations still pass. Run bun run test packages/ui-react/tests/tool-views.test.ts to verify.

Written by the indexing model from the issue text.

Description

agent-ready area: ui-react priority: p2 type: fix

Context

formatDuration (packages/ui-react/src/lib/duration.ts:2-10) rounds the seconds part on its own, after it has already taken the minutes, so the seconds can round up to 60 without carrying. It also rounds sub-minute values to one decimal without carrying into minutes. Run against the current tree:

Input (ms) Output Expected
59_950 60.0s 1m 0s
59_999 60.0s 1m 0s
119_500 1m 60s 2m 0s
3_599_500 59m 60s 60m 0s

It labels every run duration, approval wait and timeline row in Activity. Callers include activity-run-list.tsx:42, :71; activity-run-detail.tsx:189, :267, :299, :353; run-lanes.tsx:43, :64; turn-timing.tsx:6-17; and tool-call-timeline.tsx:168, :426. There are 20 call sites in all. Its tests (packages/ui-react/tests/tool-views.test.ts:162-173) cover only exact boundaries.

Guide: js/format-human-readable-durations (the fix needs no Intl; consolidation is #2606).

Scope

  • Round the whole value to the precision that will be displayed before splitting it into units: tenths of a second below one minute, whole seconds from one minute up. A value that rounds to 60.0s renders as 1m 0s.
  • Add the four rows above, plus 999.9 → "1.0s" and 60_000 → "1m 0s", to the formatDuration tests.

Out of scope

  • An hours unit. 3_600_000 stays 60m 0s here, and #2606 owns the format.
  • Intl.DurationFormat, and any other formatter.
  • Callers.

Acceptance criteria

  • formatDuration(119_500) === "2m 0s", formatDuration(59_950) === "1m 0s" and formatDuration(3_599_500) === "60m 0s".
  • No output of formatDuration contains 60s or 60.0s. A test sweeps 0–7_200_000 ms in 50 ms steps and asserts that the seconds part is below 60 everywhere.
  • The new tests fail on the tree before the change and pass after. Record both runs in the PR.
  • Existing expectations (0.5s, 2.5s, 1m 0s, 1m 30s) are unchanged.

Verification

bun run test packages/ui-react/tests/tool-views.test.ts
bun run test
bun run typecheck
bun run lint

Contract impact

  • This touches the integration contract, so it needs the contract label, a CONTRACT: commit prefix, and the doc updated in the same commit.
  • This changes a published package's behaviour, so it needs a changeset.

@schlessera/brain-ui-react: patch.

Dominant language
TypeScript
Stars
1
Forks
0
Avg merge
5h 38m
Merged PRs (30d)
960

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from schlessera/brain-kit

All issues in schlessera/brain-kit

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.