Skip to content

fix(cli,web,mobile): repair tier display, opencode v2 startup and v2 health checks - #130

Merged
snhsish merged 1 commit into
mainfrom
fix/cli-tier-v2-unreachable
Oct 1, 2026
Merged

snhsish merged 1 commit into
mainfrom
fix/cli-tier-v2-unreachable

Conversation

@snhsish

@snhsish snhsish commented Oct 1, 2026

Copy link
Copy Markdown
Owner

Fixes #128 and #129.

#129 — CLI showed free tier while dashboard showed starter
Root cause: the Dodo webhook stored the event-name suffix (e.g. subscription.updated → status updated) as subscription_status. effectiveTier() only accepted active, so the CLI (and tunnel server) computed free while the dashboard displayed the raw tier column (starter). Cancelling with cancel_at_period_end made this certain to hit.

  • Webhook reads the real status from the payload, ignores non-subscription events, and keeps the paid tier through the cancel-at-period-end grace window.
  • effectiveTier() now accepts active/trialing/past_due, honors the grace window, and self-heals rows corrupted by the old webhook (unknown status + future renewal → paid).
  • Dashboard subscription endpoint, API-key validation, and tunnel-server validation all use the same grace-aware logic.

#128 — 'Failed to start opencode serve' then a dead QR; app says unreachable (opencode v2)
Root causes: v2 rejects --log-level DEBUG (needs lowercase), so the server died at startup; proc 'error' only printed a message while execution continued to a scannable-but-dead QR; and the mobile app probed only /global/health, which on v2 serves the web UI instead of JSON health.

  • CLI detects the server major via opencode --version and uses matching serve flags, log patterns, health paths (/api/info on v2) and /api/* proxy routes.
  • Spawn failures reject immediately (no dead QR) and port detection only returns health-verified ports.
  • Custom binary via opencodeBin config / CROSSCODE_OPENCODE_BIN (documented in docs/cli.md).
  • Mobile probes /api/info before /global/health in both the connect screen and the home health check, and caches the detected version per connection.

Verified: tsc --noEmit clean on crosscode, @crosscode/shared, tunnel-server, mobile; web has only pre-existing stale .next cache errors for removed beta pages. effectiveTier edge cases tested (grace, corrupted status, expired). CLI tsup build succeeds.

…health checks

Fixes #129: the Dodo webhook stored the event name suffix
('updated', 'created', ...) as subscription_status, so effectiveTier()
saw a non-'active' status and the CLI reported 'free' while the dashboard
showed the raw paid tier. The webhook now reads the real status from the
payload, ignores non-subscription events, keeps the paid tier through the
cancel-at-period-end grace window, and effectiveTier() self-heals rows
corrupted by the old webhook. Dashboard, API-key validation and the
tunnel server all use the same grace-aware logic.

Fixes #128: 'opencode serve --log-level DEBUG' is rejected by the v2
binary, killing the server at startup, and the CLI still printed a QR
for the dead backend. The CLI now detects the server major via
'opencode --version', uses the matching flags, health paths and /api/*
proxy routes, fails fast on spawn errors, and only hands back
health-verified ports. The mobile app probes /api/info before
/global/health so v2 servers no longer show 'remote server unreachable'.
Custom binaries supported via opencodeBin config / CROSSCODE_OPENCODE_BIN.
@vercel

vercel Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
crosscode-web Ready Ready Preview Oct 1, 2026 3:53pm UTC

This branch was successfully deployed

1 active deployment
Preview — 7e131438 Deployed Oct 1, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CLI: says failed to start opencode serve at first, but later generate a QR that doesnt work

1 participant