Skip to content

Improve session banner, unroll status, and on-chain timeout claims - #405

Merged
bramcohen merged 9 commits into
mainfrom
improve-notifications
Aug 18, 2026
Merged

Improve session banner, unroll status, and on-chain timeout claims#405
bramcohen merged 9 commits into
mainfrom
improve-notifications

Conversation

@bramcohen

@bramcohen bramcohen commented Aug 13, 2026

Copy link
Copy Markdown
Member

Summary

  • Classify unroll and terminal-game timeout situations in WASM (semanticPhase + unrollInitiator) and render them with exhaustive JS copy maps, including the potato after the channel state number.
  • Show session mode on a banner rail and pipe health as tab link marks; warn before leaving a live session and drop this tab's lease on close.
  • Submit timeout claims only after an authoritative coin snapshot, and treat unsigned or mismatched channel-coin spends as parse errors instead of timeouts.

Test plan

  • ./ct.sh
  • Start a session, confirm the banner rail, potato/state number, and tab pipe marks.
  • Force an unroll (self and opponent) and check wait vs spend / preempt copy.
  • Reload and close a live tab: leave warning and lease drop.

Note

Medium Risk
Changes span on-chain unroll classification, timeout-claim registration, and session persistence (v13); UI is mostly display but incorrect spend handling could affect channel resolution.

Overview
Connectivity UX moves session mode off the tabs: Wallet/Hub/Game show link vs broken-chain emojis for pipe health only; degraded peer pings show on the game dashboard banner (yellow rail + “Peer pings look stuck”), not on tab colors. The session dashboard adds a left banner rail (idle / playing / pings-bad / on-chain / ended).

WASM → UI contract expands ChannelStatus with state_number, unroll state numbers, and renamed semantic phases (unrolling, finding_state, finishing_waiting_timeout, finishing_spending, etc.). Dashboard copy maps those phases plus unroll_initiator to labels like “Finishing opponent unroll” and preempt detail strings. Terminal finished games get distinct on-chain statuses (finishing-waiting-timeout / finishing-spending) and GameFinishTimeout timeout-claim semantics.

On-chain safety: channel_coin_spent no longer branches on “who spent”; unsigned or conditions-mismatch spends error at parse time instead of falling back to timeout. classify_unroll no longer widens parse failures to “wait for timeout.”

Persistence bumps envelope schema to v13 (v12 deleted per alpha policy). Shared integersToBigInt normalizes WASM/RPC integer boundaries.

Tab lifecycle: beforeunload warns on live off-chain/on-chain sessions; hub disconnect and lease release run on pagehide so staying on the page after a warning does not drop the hub. releaseLeaseIfOwner clears the active-tab lease when the owning tab actually closes.

Reviewed by Cursor Bugbot for commit 96964b4. Bugbot is set up for automated code reviews on this repo. Configure here.

…target.

The UI was inferring unroll type from initiator and leftover numbers, and it
showed the current potato state even when the spendable unroll was one behind.
A finished on-chain move still needs its timeout claim, but the UI only said
Finishing. WASM now emits wait vs spend so the hand bar can say Finalizing
waiting for timeout or Finalizing spending.
Stay on the native prompt no longer disconnects the hub. Closing the owner tab clears its lease so the next visit is not treated as a takeover.
Classify the landed unroll from the spend conditions in WASM. A hash we never signed or a conditions mismatch stays unrecoverable instead of falling back to timeout because some historical record exists.
Keep constructor initiator except on preempt, and fold duplicated shutdown/unroll watch helpers so the spend phase does not carry a second race flag or an always-true preempting bit.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using high effort and found 3 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 611b872. Configure here.

Comment thread src/session_phases/spend_channel_coin_phase.rs
Comment thread front-end/src/types/ChiaGaming.ts
Comment thread src/session_phases/spend_channel_coin_phase.rs
Old mid-unroll v12 records cannot decode the new semantic_phase names; discard them under the alpha no-migration policy instead of adding aliases.
@seeden
seeden requested review from seeden and removed request for seeden August 18, 2026 16:56
@bramcohen
bramcohen merged commit 3c01888 into main Aug 18, 2026
12 checks passed
@bramcohen
bramcohen deleted the improve-notifications branch August 18, 2026 17:50
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.

2 participants