Skip to content

fix(cloud): retry RPC posts once on webview transport failures#488

Merged
Harry19081 merged 2 commits into
developfrom
fix/cloud-rpc-transport-retry
Jul 22, 2026
Merged

fix(cloud): retry RPC posts once on webview transport failures#488
Harry19081 merged 2 commits into
developfrom
fix/cloud-rpc-transport-retry

Conversation

@Neonforge98

Copy link
Copy Markdown
Collaborator

Summary

  • First invite / role-change after idle on macOS WKWebView failed with a raw Load failed because CFNetwork reuses a silently closed keep-alive socket and never auto-retries POSTs.
  • Add a one-shot fetchWithTransportRetry helper and wire it through all org2 cloud RPC clients (management, sync, comments, shares, projects, reads) plus GoTrue token refresh.
  • Map residual transport failures to a translated cloud.orgManagement.errors.network message instead of surfacing WebKit's raw error.

Test plan

  • Open Manage ORG → Members, wait idle ~30–60s, create an invite — should succeed on first click (no red Load failed)
  • Same idle wait, change a member's role — should succeed on first confirm
  • With network offline, mutation still fails but shows the translated connection message, not Load failed
  • Unit: org2CloudFetchRetry, management client retry cases, and Org2Cloud suite already green locally (591 tests)

WKWebView reuses pooled keep-alive sockets that the server may have
silently closed, and CFNetwork never auto-retries a POST on a fresh
connection — so the first cloud mutation after idle (create invite,
change role, set floor) deterministically failed with a raw WebKit
"Load failed". Retry such transport-level TypeErrors exactly once
across all org2 cloud RPC clients and the GoTrue token refresh, and
translate the residual failure instead of surfacing the raw message.

Pre-commit hook ran. Total eslint: 0, total circular: 1
Carry the turn source from every frontend dispatch boundary through the
Rust agent wire so Send Now remains a fresh turn even when the cancelled
provider turn is still draining. Only ordinary user submissions may enter
mid-turn steering.

Require and validate the source at the Tauri boundary, reject unknown
persisted values instead of silently coercing them to user_submit, and add
wire, steering, queue, and persistence regression coverage.

Verification:
- pnpm exec tsc --noEmit --pretty false
- pnpm exec vitest run src/store/ui/__tests__/messageQueueAtom.test.ts src/engines/SessionCore/hooks/session/__tests__/useQueueDispatch.classify.test.ts src/engines/SessionCore/hooks/session/__tests__/useQueueDispatch.intervention.test.ts src/engines/SessionCore/sync/adapters/__tests__/rustAgentSendPayload.test.ts src/engines/ChatPanel/hooks/useWorkspaceChat/useUserIntentSubmit.intervention.test.ts
- cargo check -p agent_core
- cargo check -p session_persistence
- cargo test -p agent_core force_send_never_enters_mid_turn_steering --lib
- cargo test -p session_persistence --lib -- --test-threads=1

Pre-commit hook ran. Total eslint: 0, total circular: 1
@Harry19081
Harry19081 merged commit 38abf19 into develop Jul 22, 2026
2 checks passed
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