Fix workspace restore idempotency and strict RPC parsing#470
Fix workspace restore idempotency and strict RPC parsing#470jmcte wants to merge 2 commits intoDimillian:mainfrom
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0eb580be10
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| await listThreadsForWorkspace(workspace); | ||
| restoredWorkspaces.current.add(workspace.id); |
There was a problem hiding this comment.
Guard workspace restore while the first attempt is running
restoredWorkspaces is now updated only after connectWorkspace and listThreadsForWorkspace resolve, so any re-render before that completion will schedule another restore for the same workspace. Because this effect re-runs on changing dependencies (workspaces and callback identities), startup renders can fan out parallel restore calls, which duplicates thread-list RPCs and can race thread state updates; keep retry behavior but add an in-flight guard (or mark before await and clear on failure).
Useful? React with 👍 / 👎.
| }), | ||
| _ => None, | ||
| }, | ||
| _ => Err(format!("invalid `{key}`")), |
There was a problem hiding this comment.
Treat null RPC params as absent for optional u32 parsing
The transport layer uses Value::Null when a JSON-RPC request omits params (src-tauri/src/bin/codex_monitor_daemon/transport.rs), but this parser now returns Err for any non-object, so methods with only optional numeric inputs (like local_usage_snapshot) fail with invalid \days`when callers send no params. This is a backward-incompatible regression from the previous behavior where omitted optional values were accepted asNone`.
Useful? React with 👍 / 👎.
# Conflicts: # src/services/tauri.ts
|
Completely break sidebar loading state, make those changed one by one and test the app |
Summary
restoreWorkspaceattempts are not treated as permanently restored.u32and string-array inputs to reject malformed values.listWorkspacesreturns[], other wrappers return explicit bridge errors).Related issue
Validation
npm run test -- src/features/workspaces/hooks/useWorkspaceRestore.test.tsx src/services/tauri.test.tscd src-tauri && cargo checkcd src-tauri && cargo test parse_optionalnpm run typecheck(currently fails in this environment due missing optional external typings:@tauri-apps/plugin-notification,vscode-material-icons).