Skip to content

ship/fix native resolve all resume - #7321

Merged
matthewevans merged 8 commits into
mainfrom
ship/fix-native-resolve-all-resume
Aug 13, 2026
Merged

ship/fix native resolve all resume#7321
matthewevans merged 8 commits into
mainfrom
ship/fix-native-resolve-all-resume

Conversation

@matthewevans

@matthewevans matthewevans commented Aug 13, 2026

Copy link
Copy Markdown
Member
  • fix(native): settle resolve all and reconnect identity
  • fix(native): validate reconnect transition frames

Summary by CodeRabbit

  • Bug Fixes
    • Improved native reconnect handling by validating game, player, token, and session credentials before restoring a connection.
    • Prevented invalid or incomplete reconnect attempts from changing session state or generating duplicate errors.
    • Ensured reconnect credentials are preserved during direct initialization and game startup.
    • Fixed Resolve All updates to include AI follow-up logs, final session state, revisions, and metadata consistently.
    • Ensured final Resolve All results are saved and broadcast before confirmation is returned.

@matthewevans
matthewevans enabled auto-merge August 13, 2026 01:52
@coderabbitai

coderabbitai Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@matthewevans, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 7 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 822b7416-db84-4d8c-a3db-2ec8ae008812

📥 Commits

Reviewing files that changed from the base of the PR and between ea426b2 and 3c869d2.

📒 Files selected for processing (1)
  • crates/phase-server/src/main.rs

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 85782ff9-0f2f-4f38-a29f-585d80949720

📥 Commits

Reviewing files that changed from the base of the PR and between 2e9f24e and ea426b2.

📒 Files selected for processing (3)
  • client/src/adapter/__tests__/ws-adapter.test.ts
  • client/src/adapter/ws-adapter.ts
  • crates/phase-server/src/main.rs
🚧 Files skipped from review as they are similar to previous changes (2)
  • crates/phase-server/src/main.rs
  • client/src/adapter/tests/ws-adapter.test.ts

📝 Walkthrough

Walkthrough

The WebSocket adapter now validates native reconnect credentials before state updates. Resolve All now preserves ordered bounded logs and broadcasts persisted post-AI session state before acknowledgement.

Changes

Native reconnect validation

Layer / File(s) Summary
Seed and validate reconnect identity
client/src/adapter/ws-adapter.ts
Native reconnect initialization seeds persisted credentials. GameCreated, SessionAttached, and GameStarted validate game, player, token, and Full-session identity before updating state.
Reconnect validation coverage
client/src/adapter/__tests__/ws-adapter.test.ts
Tests cover valid initialization, mismatched or missing credentials, state preservation, and single-error behavior.

Resolve All post-AI state

Layer / File(s) Summary
Capture and broadcast final Resolve All state
crates/phase-server/src/main.rs
Resolve All combines bounded batch and AI logs, captures post-AI state, persists it, and broadcasts final updates before acknowledgement.
Resolve All state and ordering tests
crates/phase-server/src/main.rs
Tests verify log ordering, post-AI revisions, waiting state, snapshot broadcasts, recipient updates, and acknowledgement ordering.

Estimated code review effort: 4 (Complex) | ~60 minutes

Mergeability Score: 🟡 Moderate · up to ea426

The reconnect identity rejection can leave the socket attached, allowing subsequent state updates from a refused peer to reach cached state and potentially emit repeated errors. This concrete correctness and peer-isolation risk should be resolved or explicitly accepted before merge.

Sequence Diagram(s)

sequenceDiagram
  participant NativeSocket
  participant WebSocketAdapter
  participant AdapterState
  NativeSocket->>WebSocketAdapter: Receive reconnect message
  WebSocketAdapter->>AdapterState: Validate persisted identity
  AdapterState-->>WebSocketAdapter: Return validation result
  WebSocketAdapter->>AdapterState: Store valid reconnect state
Loading
sequenceDiagram
  participant ResolveAllHandler
  participant Session
  participant AIFollowUp
  participant GameClients
  ResolveAllHandler->>Session: Run Resolve All under lock
  Session->>AIFollowUp: Execute continuation actions
  AIFollowUp-->>Session: Return post-AI state and logs
  ResolveAllHandler->>Session: Persist final state
  ResolveAllHandler->>GameClients: Broadcast final update
  ResolveAllHandler-->>ResolveAllHandler: Acknowledge requester
Loading

Possibly related PRs

Suggested labels: bug

Suggested reviewers: lgray, claytonlin1110, parthmishra

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title identifies the native Resolve All resume fix, which is a primary part of the changes, but it omits reconnect identity handling.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ship/fix-native-resolve-all-resume

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@client/src/adapter/ws-adapter.ts`:
- Around line 1791-1822: Make rejected native reconnect identities terminal in
acceptNativeReconnectIdentity: latch the rejection, clear the ping interval,
close the socket, and ensure handleMessage returns immediately while latched so
later frames cannot update state or emit duplicate errors. Route
acceptFullSessionKey through the same rejection latch. In
client/src/adapter/__tests__/ws-adapter.test.ts lines 741-771, dispatch a
StateUpdate after the rejected GameCreated and assert getSnapshot() still throws
"No game state available" and the listener count remains 1.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 5b718420-feba-403c-9de3-fbf7dc58258e

📥 Commits

Reviewing files that changed from the base of the PR and between 552cf8f and 2e9f24e.

📒 Files selected for processing (3)
  • client/src/adapter/__tests__/ws-adapter.test.ts
  • client/src/adapter/ws-adapter.ts
  • crates/phase-server/src/main.rs

Comment thread client/src/adapter/ws-adapter.ts
@matthewevans
matthewevans force-pushed the ship/fix-native-resolve-all-resume branch from ea426b2 to e328235 Compare August 13, 2026 03:02
@matthewevans
matthewevans added this pull request to the merge queue Aug 13, 2026
Merged via the queue into main with commit 1c9343a Aug 13, 2026
15 checks passed
@matthewevans
matthewevans deleted the ship/fix-native-resolve-all-resume branch August 13, 2026 04:27
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