Skip to content

fix(android): resolve session loading failure on Android#524

Open
magiclaw wants to merge 2 commits into
getpaseo:mainfrom
magiclaw:fix/android-session-loading
Open

fix(android): resolve session loading failure on Android#524
magiclaw wants to merge 2 commits into
getpaseo:mainfrom
magiclaw:fix/android-session-loading

Conversation

@magiclaw
Copy link
Copy Markdown

Problem

Android clients fail to load sessions after connecting to the server. The WebSocket connection succeeds and hello handshake completes, but workspaces/sessions never appear.

Root Cause

The Zod schema on the client strictly requires workspaceDirectory: z.string() in WorkspaceDescriptorPayloadSchema. Older server versions may return workspace entries where workspaceDirectory is undefined (when cwd is missing from the workspace record).

When server returns fetch_workspaces_response or workspace_update messages with missing workspaceDirectory, Zod validation fails and the entire message is silently discarded. This means workspaces are never populated, and the agent directory bootstrap produces empty results.

Fix

1. Relax schema validation

packages/server/src/shared/messages.ts

  • Changed projectRootPath: z.string()projectRootPath: z.string().nullable().optional()
  • Changed workspaceDirectory: z.string()workspaceDirectory: z.string().nullable().optional()

2. Add fallback in normalization

packages/app/src/stores/session-store.ts

  • workspaceDirectory: payload.workspaceDirectory ?? payload.projectRootPath ?? ""

3. Additional changes included in this PR

  • White screen fix: Added loading state with ActivityIndicator and timeout fallback in agent route
  • Diagnostic logging: Comprehensive [PD] prefixed logs across E2EE handshake, hello handshake, connection state machine, workspace hydration, and crypto polyfill
  • In-app log export: LogCollector utility + Export Logs button in Settings → Diagnostics
  • Crypto polyfill enhancements: Installation verification logging

- Make workspaceDirectory and projectRootPath optional in schema to prevent
  Zod validation failure when old servers omit these fields
- Add fallback in normalizeWorkspaceDescriptor
  (workspaceDirectory ?? projectRootPath ?? "")
- Add comprehensive [PD] diagnostic logging across E2EE handshake,
  hello handshake, connection state machine, workspace hydration,
  and crypto polyfill paths
- Fix white screen on agent route by adding loading state with
  ActivityIndicator and timeout fallback
- Add LogCollector utility and Export Logs button in Settings
  / Diagnostics for in-app diagnostics

Fixes: sessions fail to load on Android due to strict Zod schema
requiring workspaceDirectory as mandatory string
@boudra boudra force-pushed the main branch 2 times, most recently from 7ec394c to 5c90449 Compare May 8, 2026 11:48
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