opencode icon indicating copy to clipboard operation
opencode copied to clipboard

fix(tui): display human-readable duration for rate limit retry

Open dschenkelman opened this issue 2 weeks ago • 0 comments

Summary

  • Fix rate limit retry message to display human-readable durations (e.g., 45m 0s instead of 2700s)
  • Add decimalSeconds option to Locale.duration() to control whether seconds show decimals
  • Fix latent bug in days/hours calculation that would show 0d 25h instead of 1d 1h

Problem

When rate limits are hit, the retry message displays raw seconds which is hard to read for large values: image

Solution

  • Use Locale.duration() for rate limit retry display with { decimalSeconds: false }
  • Keep decimal seconds for message duration display (existing behavior)
  • Examples:
    • 2700s45m 0s
    • 7140s1h 59m

Changes

File Change
packages/opencode/src/util/locale.ts Add decimalSeconds option, fix days/hours bug
packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx Use Locale.duration() for retry message
packages/opencode/test/util/locale.test.ts Add tests for duration formatting

dschenkelman avatar Jan 03 '26 20:01 dschenkelman