GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — fix(opencode): show reset time on free usage limit by werlang · Pull Request #53254 · anomalyco/opencode Conversation
|
|
The following comment was made by an LLM, it may be inaccurate: |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Reset formatting accepts malformed values and can produce impossible durations such as “60 minutes.”
Review effort: Balanced
Findings: 2
Adds reset-time details to free-tier usage-limit messages while preserving the static fallback.
Changes:
| File | Description |
|---|---|
packages/opencode/src/session/retry.ts |
Formats reset times in free-limit messages. |
packages/opencode/test/session/retry.test.ts |
Tests reset and fallback behavior. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| const retryAfter = num(value) | ||
| if (retryAfter === undefined) return "" |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Done - resetText now requires the header to match /^\d+$/ so malformed or negative values fall back to the static message.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| const seconds = Math.max(0, Math.ceil(retryAfter)) | ||
| const days = Math.floor(seconds / 86_400) | ||
| const hours = Math.floor((seconds % 86_400) / 3_600) | ||
| const minutes = Math.ceil((seconds % 3_600) / 60) | ||
| const unit = (count: number, name: string) => `${count} ${name}${count === 1 ? "" : "s"}` | ||
| if (days > 0) return hours > 0 ? `${unit(days, "day")} ${unit(hours, "hour")}` : unit(days, "day") | ||
| if (hours > 0) return minutes > 0 ? `${unit(hours, "hour")} ${unit(minutes, "minute")}` : unit(hours, "hour") | ||
| return minutes > 0 ? unit(minutes, "minute") : "less than a minute" |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Done - rounds to total minutes first, so 3599s renders as 1 hour instead of 60 minutes. Covered by a new regression test.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
This branch has been upgraded to V2. We're no longer taking PRs for V1. If you think this is still relevant, please port it over and open it for V2. — from 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
[FEATURE]:Show exact free usage limit reset time
There was an error while loading. Please reload this page.