feat: improve unavailable workspace recovery and cleanup#1183
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c131ca07ae
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| }} | ||
| onStop={() => void cancelAcp()} | ||
| disabled={acpLoading || acpCancelling || !cwd} | ||
| disabled={acpLoading || acpCancelling || !cwd || !workspaceContextAvailable} |
There was a problem hiding this comment.
Keep Stop enabled during workspace-unavailable runs
When an ACP prompt is already running (for example after restoring a live session, or if the workspace becomes unavailable while a run is active), adding !workspaceContextAvailable to the disabled prop disables the stop button too, because ChatInput derives canStop from sending && !inputDisabled. This leaves users unable to cancel the active run while the missing-workspace recovery state is shown; the unavailable workspace check should block new sends without disabling Stop.
Useful? React with 👍 / 👎.
| if (promptCwd !== cwd) { | ||
| const promptWorkspace = await hostApi.files.resolveWorkspaceContext({ | ||
| workspaceRoot: promptCwd, | ||
| executionCwd: promptCwd, | ||
| }).catch(() => ({ ok: false })); | ||
| if (!promptWorkspace.ok) return; |
There was a problem hiding this comment.
Report failed target-workspace validation
For @agent sends where the target agent's workspace differs from the current cwd, a missing target workspace now causes this return to silently drop the user's message after selectAcpSession(sessionKey) has already moved the UI to the target session. In that scenario there is no unavailable banner for the target workspace and no ACP load error, so the user sees a session switch but no explanation or sent prompt; surface the validation failure or defer switching until after validation succeeds.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c01c79577e
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| if (!result.ok || !result.workspaceRoot || !result.executionCwd) { | ||
| setResolvedWorkspaceContext(null); | ||
| setWorkspaceContextCheck({ key: workspaceContextKey, available: false }); | ||
| return; |
There was a problem hiding this comment.
Clear stale chat content for missing workspaces
When a user switches from a populated chat to an existing session whose workspacePath was moved or deleted, this failure path only clears resolvedWorkspaceContext; the later load effect returns while workspaceContextAvailable is false, so the ACP store still holds the previous session's timeline. The render path below then shows the unavailable-workspace banner above another chat's messages/actions. Clear or replace the ACP timeline here, or gate timeline rendering on acpTimeline.sessionId === currentSessionKey when workspace resolution fails.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ad9b5de760
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| const result = await hostApi.files.resolveWorkspaceContext({ | ||
| workspaceRoot: path, | ||
| executionCwd: path, | ||
| }).catch(() => ({ ok: false })); |
There was a problem hiding this comment.
Avoid exposing deletes on resolver transport errors
Because this catch converts any rejected resolveWorkspaceContext call into {ok:false}, the sidebar treats an IPC/host bridge failure during startup or reload the same as Main confirming that the directory is missing. In that scenario a valid non-default workspace gets the unavailable badge and destructive group-delete button until a later focus recheck, so users can delete all sessions for a workspace that was never actually validated as unavailable. Keep rejected checks as checking/unknown or retry, and only mark unavailable when Main returns an explicit negative result.
Useful? React with 👍 / 👎.
No description provided.