GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(opencode): show reset time on free usage limit by werlang · Pull Request #53254 · anomalyco/opencode

Conversation

@werlang

@werlang werlang commented Oct 5, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Issue for this PR

Fixes #52894

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Free 429s showed a static message with no reset time while Go limits render "It will reset in X" from retry-after. This reuses the same formatting for FreeUsageLimitError, falling back to the static message when the header is absent or malformed. Go output is unchanged for valid headers (same helper, same tests).

Follow-up fixes review findings: strict non-negative-integer validation and total-minutes rounding (3599s renders as 1 hour, not 60 minutes).

How did you verify your code works?

  • bun test test/session/retry.test.ts (64 pass, 0 fail, incl. 4 new tests)
  • bun run typecheck in packages/opencode (clean)
  • bun run lint on both touched files (0 errors, 2 pre-existing warnings)
  • git diff --check (clean)

Screenshots / recordings

N/A - non-UI change.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@werlang
fix(opencode): show reset time on free usage limit
c6dff6d
Copilot AI balanced review requested due to automatic review settings October 5, 2026 01:31
@github-actions

github-actions Bot commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Copilot started reviewing on behalf of werlang October 5, 2026 01:31
View session
Copilot AI reviewed Oct 5, 2026
View reviewed changes

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

Reset formatting accepts malformed values and can produce impossible durations such as “60 minutes.”

Review effort: Balanced
Findings: 2 Medium severity

Open (2)
  • Medium severity Validate Retry-After as a non-negative integer · New
  • Medium severity Round total duration before splitting into units · New
What changed in this PR

Adds reset-time details to free-tier usage-limit messages while preserving the static fallback.

Changes:

  • Reuses reset-time formatting for free and Go limits.
  • Adds free-limit reset and fallback tests.
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.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread packages/opencode/src/session/retry.ts Outdated
Comment on lines +153 to +154
const retryAfter = num(value)
if (retryAfter === undefined) return ""

@werlang werlang Oct 5, 2026

Copy link
Copy Markdown
Author

There was a problem hiding this comment.

Choose a reason for 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.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread packages/opencode/src/session/retry.ts Outdated
Comment on lines +155 to +162
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"

@werlang werlang Oct 5, 2026

Copy link
Copy Markdown
Author

There was a problem hiding this comment.

Choose a reason for 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.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@werlang
fix(opencode): validate retry-after and carry overflow minutes
1ae0001
@werlang werlang mentioned this pull request Oct 5, 2026
[FEATURE]: Show reset time on free usage limit like Go #53252
Closed
1 task done
@thdxr

thdxr commented Oct 10, 2026

Copy link
Copy Markdown
Member

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 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@thdxr thdxr closed this Oct 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

Copilot code review Copilot
Copilot review effort
Applies to this pull request for everyone.Learn more about Copilot code review.
Copilot left review comments

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

[FEATURE]:Show exact free usage limit reset time

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@werlang @thdxr
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.