Skip to content

fix: restore Go signup prompts and stop free-tier retries - #46994

Open
opencode-agent[bot] wants to merge 5 commits into
v2from
free-limit-go
Open

fix: restore Go signup prompts and stop free-tier retries#46994
opencode-agent[bot] wants to merge 5 commits into
v2from
free-limit-go

Conversation

@opencode-agent

@opencode-agent opencode-agent Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Treat FreeUsageLimitError as exhausted free-tier quota, not a transient 429. Stop after the first failed attempt, including when retry headers are present; ordinary rate-limit retries are unchanged.
  • Preserve a dedicated provider.free-tier-limit session error with the Go signup URL.
  • Restore the App's Go signup dialog using V2's server-wide session.execution.failed event, retaining localization and the Go connection flow.
  • Restore the TUI's original animated Go modal: expanding rings, shimmering logo, Subscribe, keyboard/pointer navigation, the 24-hour cooldown, and persistent “Don't show again.” Use V2's semantic theme colors and respect animations: false with static art.
  • Keep background-session errors and existing dialogs from interrupting the current UI. Escape starts a cooldown without opting out; Subscribe opens https://opencode.ai/go.

Comparison with dev

packages/opencode/src/session/retry.ts recognized FreeUsageLimitError and attached a Go upsell action to retry status. Both the App and V1 TUI consumed that legacy session.status action; the TUI displayed DialogRetryAction with BgPulse. V2 lost that path and classified the error as retryable.

This restores both signup modals without restoring the retries. Execution failures are process-global, so the listeners accept server-wide events without a location envelope. The animation's original drawing math and logo come from dev at 79d503150ca22f151afe4ea543fac8a8eb8aef53.

Animation performance

Reviewed OpenTUI's FrameBufferRenderable, OptimizedBuffer, render-command reuse, renderer scheduling, and native framebuffer-copy paths before adapting the animation:

  • One persistent opaque native framebuffer; no per-cell Solid/text work or extra buffered layer.
  • Geometry and glyph templates change only with geometry/color capability. Lazily cache the original 138 animation phases instead of painting an unused warm-up frame plus the displayed frame.
  • Cached phases use typed-array color copies; unchanged phases skip writes.
  • A component-owned 30 Hz OpenTUI SystemClock timer requests frames with live: false. It does not change the application's FPS or force a permanently live render tree. Hidden art requests no frames; disabled/unmounted art clears its timer.

Five-sample native-buffer microbenchmark, Bun 1.3.14 / OpenTUI 0.5.10 on Linux:

  • 60×16 RGB: cold paint 94.66 → 54.91 µs/frame (42% lower); cached paint 0.39 µs/frame.
  • 116×20 RGB: cold paint 160.04 → 92.67 µs/frame (42% lower); cached paint 0.93 µs/frame.
  • All 138 phases matched the original uncached V1 painter across both sizes and RGB modes, comparing characters, attributes, foreground and background channels—including cache revisits.

These are painter-only timings, not an end-to-end terminal CPU claim.

Validation

  • AI error/executor/schema tests: 72 passed.
  • Core session-runner/error/AI SDK tests: 233 passed across scoped runs; the 194 session/error tests were also rerun after the modal follow-up.
  • App usage-exceeded unit tests: 2 passed. Four browser tests passed across three repetitions (12/12, no retries).
  • TUI animation and Go-modal suites: 21 passed; including adjacent dialog suites: 47 passed, 1,267 assertions. Covers palette/geometry invalidation, exact phase boundaries, hidden/disabled/unmount behavior, unchanged renderer FPS, 40/100-column layout, Tab/Shift+Tab, browser opening, and dismissal persistence.
  • AI/Core/App/TUI typechecks, App E2E typecheck, formatting, scoped lint, and diff checks passed.
  • Recorded the actual V2 TUI with Terminal Control and an isolated local HTTP 429 fixture. Earlier App desktop/mobile and TUI light/dark coverage is retained.
  • Production-build App session-entry benchmark: all 3 post-change scenarios passed. The initial baseline had one navigation timeout, so no App performance improvement is claimed.

Requested by: @thdxr (dax via Slack); animation requested by @kitlangton (Kit via Slack)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants