Repository navigation
fix(shared): durations read 1m rather than 60s - #627
Merged
Merged
Conversation
formatDuration chose its unit before rounding, so 59.6s read "60s" and 999.6ms read "1000ms". Both now choose the unit from the rounded value.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
formatDurationpicked its unit before rounding, so durations just under a boundary rounded up within the smaller unit: 59.6s read "60s" instead of "1m", and 999.6ms read "1000ms" instead of "1.0s". It formats the work and step durations in the chat timeline, the composer tasks badge, worktree setup and diagnostics.Both branches now choose the unit from the rounded value, as the minute-to-hour step already did. This is the same kind of fix as the snooze countdowns (#45) and token counts (#626). Upstream fixed the same thing in pingdotgg#13412, which was closed because it combined two fixes.
Validation: new cases in
orchestrationTiming.test.tscover 999.6ms →1.0s, 59,499ms →59sand 59,600ms →1m, alongside the existing table (32 tests pass). I didn't check this in a running client: the change is limited to this pure formatter, and the tests call it directly.Written by an agent (Claude Code, claude-opus-5-5).