Skip to content

fix(cli): history list never prints 60m ago or 24h ago - #5818

Open
rudycelekli wants to merge 2 commits into
heygen-com:mainfrom
rudycelekli:fix/cli-history-ago-unit-rollover
Open

rudycelekli wants to merge 2 commits into
heygen-com:mainfrom
rudycelekli:fix/cli-history-ago-unit-rollover

Conversation

@rudycelekli

@rudycelekli rudycelekli commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

What

hyperframes history prints relative ages that read as the next unit's size: 60m ago and 24h ago.

Why

ago() rounds each unit. An entry 3,570 s old (59.5 minutes) prints 60m ago instead of 59m ago, and one 86,000 s old prints 24h ago instead of 23h ago.

Related work

No overlapping PR found. Related in spirit to #5817 (rounding rollover in ui/format.ts), but touches a different file.

How

Floor minutes, hours and days; seconds stay rounded. The function moves unchanged in shape into utils/historyAgo.ts and takes now as an argument, so it can be tested without the history command's workspace dependencies.

Test plan

  • Unit tests added in utils/historyAgo.test.ts. The boundary case fails with the old rounding and passes with the fix (vitest run src/utils/historyAgo.test.ts).
  • oxfmt --check and oxlint clean on changed files.
  • Manual testing performed (not applicable)
  • Documentation updated (not applicable)
  • Comments follow CONTRIBUTING.md "Comments".

Not run locally: history.test.ts and workspace typecheck (workspace packages were not installed), comment citation/ratchet scripts.

@miguel-heygen miguel-heygen left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this, and for splitting it out from the formatting fix. The bug is real and your fix is the right one: on main an entry 3,570 seconds old prints 60m ago and one 86,000 seconds old prints 24h ago, and with flooring they print 59m and 23h. I also checked the boundary just below a minute, where rounding seconds to 60 now falls into the minutes branch and prints 1m ago rather than 60s ago, so no unit can show at the size of the next one. Passing now in as an argument is a nice touch and makes the test honest.

The one thing blocking a stamp is the branch state rather than the code. The PR conflicts with main, history.ts has moved since you branched, and because of the conflict none of the real checks ran at this head: only the mergeability check and the WIP marker. Your new test file has therefore never been executed by CI, and you mention the workspace typecheck did not run locally either. Could you rebase on main and push, so the CLI suites, typecheck and lint actually run? If they come back green I am happy to approve as is.

One thing worth knowing while you are in here, not a change request. The Studio UI has its own relative age helper in the render queue item, with different thresholds and no day unit. It already floors so it is not affected by this bug, but it means this extraction does not yet become the single owner of how an age is printed.

@jrusso1020 jrusso1020 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed at f09ff82c32. Adding to Miguel's review rather than repeating it: I agree with him that the code is right and the only blocker is the conflict.

I checked current main independently. ago() in commands/history.ts (now around line 160) still rounds minutes, hours and days, so 3,570 seconds still prints 60m ago and 86,000 seconds still prints 24h ago. Flooring the larger units while keeping seconds rounded is correct: 59.5 seconds rounds to 60 and drops into the minutes branch as 1m ago, so no unit can print at the size of the next one. The new test covers both boundary cases and the future-timestamp clamp.

When you rebase, the call site in line() has moved but is otherwise the same shape, so it should be a mechanical resolution: delete the local ago, import the new one, and pass historyDeps.now().

Need: yes, the off-by-one-unit output is still on main · Size: ok · Reuse: nothing shared yet (Studio's render-queue age helper is separate, as Miguel noted) · Simpler: already minimal

— Rames

@github-actions

github-actions Bot commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

This PR has had no activity for 14 days, so it is marked stale and will close in 7 days. Push a commit or leave a comment to keep it open. A maintainer can add keep-open to exempt it.

@github-actions github-actions Bot added the stale label Nov 7, 2026
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@rudycelekli
rudycelekli force-pushed the fix/cli-history-ago-unit-rollover branch from f09ff82 to a2b03a6 Compare November 9, 2026 15:08
@rudycelekli

Copy link
Copy Markdown
Contributor Author

Rebased onto current main. New head: a2b03a691f8cfba680fe7693d19367b81c0dae0d.

Conflict in packages/cli/src/commands/history.ts: removed the inline ago, imported ago from ../utils/historyAgo.js, and line() now calls ago(entry.endedAt, historyDeps.now()).

The boundary is already asserted by the unit test. The file comment put a new source file over the package's comment share.

Co-authored-by: Cursor <cursoragent@cursor.com>
@github-actions github-actions Bot removed the stale label Nov 10, 2026

This branch has not been deployed

No deployments
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.

3 participants