Summary
This issue captures fixes for workspace lifecycle and API robustness in CodexMonitor.
Scope
- Fix workspace restore hook so a failed connect/list cycle does not permanently mark workspace as restored.
- Make local workspace connect idempotent and safe under repeated calls.
- Make optional RPC parsing strict for
u32 and string-array inputs.
- Centralize Tauri invoke fallback/err handling in service wrappers (not just
listWorkspaces).
Acceptance
- A failed restore attempt is retried instead of being skipped.
- Repeated local connect calls do not spawn multiple sessions.
- Invalid optional inputs for optional RPC numeric/array fields return explicit errors.
- Non-Tauri environments use safe fallbacks/errors consistently across service methods.
- Added regression tests for each behavior.
Work items
useWorkspaceRestore marker lifecycle
- move restored marker to after successful restore flow
connect_workspace_core
- make connect operation idempotent + race-safe
rpc parser helpers
parse_optional_u32 and parse_optional_string_array currently return None on malformed values
- change to
Result<Option<_>, String> and propagate parse errors from callers
- Tauri service wrappers
- add shared invoke wrappers in
src/services/tauri.ts
- keep
listWorkspaces returning [] when bridge is missing
- return actionable errors for other commands when bridge is missing
- Tests
- add/extend frontend hook tests + daemon parse/connect tests
- run targeted test suites and typecheck