Skip to content

fix(cli): stabilize session identity and tunnel URLs for reliable reconnect - #70

Merged
snhsish merged 5 commits into
mainfrom
fix/stable-session-reconnect
Aug 27, 2026
Merged

fix(cli): stabilize session identity and tunnel URLs for reliable reconnect#70
snhsish merged 5 commits into
mainfrom
fix/stable-session-reconnect

Conversation

@snhsish

@snhsish snhsish commented Aug 26, 2026

Copy link
Copy Markdown
Owner

Summary

Fixes the bad-UX bug where the CLI regenerated a new QR/URL on every restart or network blip, stranding a returning mobile client.

  • Persist sessionToken and projectId in ~/.crosscode/config.json so the QR token and managed tunnel URL (connect.crosscode.site/t/<projectId>) stay constant across CLI restarts.
  • For free, unauthenticated users, use a persistent named cloudflared tunnel (crosscode-<projectId>) with a stable *.cfargotunnel.com hostname instead of the ephemeral quick tunnel that rotates its URL. Falls back to the quick tunnel when cloudflared tunnel login hasn't been run (with a log hint).
  • Print the QR only once per identity; tunnel reconnects no longer regenerate it.
  • Auto-restart a dropped named cloudflared tunnel without changing its URL.

Verification

  • pnpm build passes; no new type errors (pre-existing tsc errors in unrelated code unchanged).
  • Smoke test with stubbed opencode/cloudflared: sessionToken identical across two runs, QR printed exactly once.
  • Managed path: projectId persistent and identical across runs → stable connect.crosscode.site/t/<id> URL.

Caveat

The named-tunnel live path requires a one-time free cloudflared tunnel login and wasn't exercised in CI here (no Cloudflare account in the test env); the quick-tunnel fallback and all persistence logic are verified.

🤖 Generated with opencode

snhsish and others added 5 commits August 26, 2026 00:39
…usage

Introduces Small/Medium/Large widgets via react-native-android-widget that show connection status, active session, per-project usage, and a 7-day output-token bar chart. Adds daily usage history to opencode-stats.store and persists the questions store so pending approvals surface in the widget.
Add a dedicated About page with app branding, support/GitHub source
links, social links, and an end credit. The home screen branding
icon now navigates to this screen.

Co-Authored-By: opencode <opencode@users.noreply.github.com>
Anchor the working indicator to the first assistant message of the current
turn so the timer reflects the entire response instead of resetting per
message part, and show a final "Worked for" duration once streaming ends.
Include macOS/Linux/Windows (incl. WSL2) install steps for OpenCode and the
CrossCode CLI, a step-by-step zero-to-connected walkthrough, and the
`crosscode login` step for the dedicated connect.crosscode.site tunnel.
…onnect

Persist sessionToken and projectId in config so the QR token and the
managed tunnel URL (connect.crosscode.site/t/<projectId>) stay constant
across CLI restarts.

For free, unauthenticated users use a persistent named cloudflared tunnel
(stable *.cfargotunnel.com hostname) instead of the ephemeral quick
tunnel that rotates its URL on every (re)start. Falls back to the quick
tunnel when cloudflared is not logged in.

Also print the QR only once per identity and auto-restart a dropped named
tunnel without changing its URL, so a returning mobile client can always
reconnect.
@snhsish
snhsish merged commit 1ab7502 into main Aug 27, 2026
4 checks passed
snhsish added a commit that referenced this pull request Aug 27, 2026
…onnect (#70)

* feat(mobile): add Android home screen widgets for session status and usage

Introduces Small/Medium/Large widgets via react-native-android-widget that show connection status, active session, per-project usage, and a 7-day output-token bar chart. Adds daily usage history to opencode-stats.store and persists the questions store so pending approvals surface in the widget.

* feat(mobile): add about screen accessible from branding icon

Add a dedicated About page with app branding, support/GitHub source
links, social links, and an end credit. The home screen branding
icon now navigates to this screen.

Co-authored-by: muse-spark-1.2 <muse-spark@users.noreply.github.com>

* fix(mobile): track elapsed time for the full response turn

Anchor the working indicator to the first assistant message of the current
turn so the timer reflects the entire response instead of resetting per
message part, and show a final "Worked for" duration once streaming ends.

* docs: add per-OS setup guides and full login workflow

Include macOS/Linux/Windows (incl. WSL2) install steps for OpenCode and the
CrossCode CLI, a step-by-step zero-to-connected walkthrough, and the
`crosscode login` step for the dedicated connect.crosscode.site tunnel.

* fix(cli): stabilize session identity and tunnel URLs for reliable reconnect

Persist sessionToken and projectId in config so the QR token and the
managed tunnel URL (connect.crosscode.site/t/<projectId>) stay constant
across CLI restarts.

For free, unauthenticated users use a persistent named cloudflared tunnel
(stable *.cfargotunnel.com hostname) instead of the ephemeral quick
tunnel that rotates its URL on every (re)start. Falls back to the quick
tunnel when cloudflared is not logged in.

Also print the QR only once per identity and auto-restart a dropped named
tunnel without changing its URL, so a returning mobile client can always
reconnect.

---------

Co-authored-by: muse-spark-1.2 <muse-spark@users.noreply.github.com>
snhsish added a commit that referenced this pull request Aug 27, 2026
…onnect (#70)

* feat(mobile): add Android home screen widgets for session status and usage

Introduces Small/Medium/Large widgets via react-native-android-widget that show connection status, active session, per-project usage, and a 7-day output-token bar chart. Adds daily usage history to opencode-stats.store and persists the questions store so pending approvals surface in the widget.

* feat(mobile): add about screen accessible from branding icon

Add a dedicated About page with app branding, support/GitHub source
links, social links, and an end credit. The home screen branding
icon now navigates to this screen.

Co-authored-by: muse-spark-1.2 <muse-spark@users.noreply.github.com>

* fix(mobile): track elapsed time for the full response turn

Anchor the working indicator to the first assistant message of the current
turn so the timer reflects the entire response instead of resetting per
message part, and show a final "Worked for" duration once streaming ends.

* docs: add per-OS setup guides and full login workflow

Include macOS/Linux/Windows (incl. WSL2) install steps for OpenCode and the
CrossCode CLI, a step-by-step zero-to-connected walkthrough, and the
`crosscode login` step for the dedicated connect.crosscode.site tunnel.

* fix(cli): stabilize session identity and tunnel URLs for reliable reconnect

Persist sessionToken and projectId in config so the QR token and the
managed tunnel URL (connect.crosscode.site/t/<projectId>) stay constant
across CLI restarts.

For free, unauthenticated users use a persistent named cloudflared tunnel
(stable *.cfargotunnel.com hostname) instead of the ephemeral quick
tunnel that rotates its URL on every (re)start. Falls back to the quick
tunnel when cloudflared is not logged in.

Also print the QR only once per identity and auto-restart a dropped named
tunnel without changing its URL, so a returning mobile client can always
reconnect.

---------
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.

1 participant