Skip to content

fix(web): surface error when adding a workspace by path fails - #1236

Merged
wbxl2000 merged 4 commits into
mainfrom
fix/web-add-workspace-silent-failure
Jun 30, 2026
Merged

fix(web): surface error when adding a workspace by path fails#1236
wbxl2000 merged 4 commits into
mainfrom
fix/web-add-workspace-silent-failure

Conversation

@wbxl2000

Copy link
Copy Markdown
Collaborator

Related Issue

None.

Problem

In the web UI, adding a workspace by typing an absolute path could silently fail. When the daemon rejected the path (for example because it does not exist on the daemon's filesystem), the error was swallowed and a local-only workspace was fabricated instead. That workspace could not host sessions and disappeared after a reload, so the add looked like it succeeded but never took effect, with no feedback to the user.

What changed

  • Adding a workspace by path now reports daemon errors through the same notification path used by other operations, instead of silently creating a fake local workspace.
  • Removed the local-fallback fabrication and the misleading comments about falling back to a locally-derived workspace. Legitimate derived workspaces still come from existing sessions.
  • Added tests for both the success path (registers and selects the workspace) and the failure path (reports the error and adds nothing).

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked a related issue, or explained the problem above.
  • I have added tests that prove my feature works.
  • Ran gen-changesets skill, or this PR needs no changeset.
  • Ran gen-docs skill, or this PR needs no doc update.

Previously, addWorkspaceByPath swallowed any error from the daemon and created a local-only workspace that could not host sessions and vanished on reload, so an invalid absolute path appeared to succeed but never took effect. Now the error is reported to the user and no fake workspace is added.
@pkg-pr-new

pkg-pr-new Bot commented Jun 30, 2026

Copy link
Copy Markdown
pnpm dlx https://pkg.pr.new/@moonshot-ai/kimi-code@3c9c708
npx https://pkg.pr.new/@moonshot-ai/kimi-code@3c9c708

commit: 3c9c708

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 284f34ff38

ℹ️ 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".

Comment on lines +671 to +672
} catch (err) {
pushOperationFailure('addWorkspace', err);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve pending prompts when workspace add fails

When this is reached from App.vue's handleAddWorkspace after a user submits a prompt with no selected workspace, that handler has already closed the dialog, then clears pendingWorkspaceSubmit after await client.addWorkspaceByPath(root) and only sends if activeWorkspaceId was set. This new catch swallows daemon rejections and returns normally, so an invalid path now drops the user's pending prompt instead of letting the caller keep or retry it. Return a success signal or rethrow after surfacing the error so the pending submission is not cleared on failure.

Useful? React with 👍 / 👎.

addWorkspaceByPath now returns a boolean success signal. handleAddWorkspace only clears pendingWorkspaceSubmit and sends the prompt on success, so a daemon-rejected path no longer drops the user's pending submission; they can retry with a valid path.
@changeset-bot

changeset-bot Bot commented Jun 30, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 3c9c708

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@moonshot-ai/kimi-code Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@wbxl2000

Copy link
Copy Markdown
Collaborator Author

@codex

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 20bb624f70

ℹ️ 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".

Comment thread apps/kimi-web/src/App.vue Outdated
const added = await client.addWorkspaceByPath(root);
// Keep the pending submission when the daemon rejects the path so the user
// can retry with a valid one instead of losing their prompt.
if (!added) return;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep the workspace picker open after add failures

When addWorkspaceByPath returns false, the dialog has already been hidden and this early return leaves pendingWorkspaceSubmit populated. In the no-workspace submit flow the composer clears the user's text before emitting, so a rejected path closes the only retry UI; if the user later adds any workspace, the stale prompt is silently sent there. Keep the picker open on failure, or clear the pending submit when closing it.

Useful? React with 👍 / 👎.

Move closing the add-workspace dialog until after a successful add. On a daemon-rejected path the picker now stays open with the user's input intact, so they can correct the path and retry; the pending submission is consumed by a successful retry or dropped only when the user explicitly closes the picker.
@wbxl2000

Copy link
Copy Markdown
Collaborator Author

@codex

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4817c6d09b

ℹ️ 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".

Comment thread apps/kimi-web/src/App.vue Outdated
// Keep the picker open (and the pending submission intact) when the daemon
// rejects the path so the user can retry with a valid one. Closing via
// Escape goes through handleCloseAddWorkspace, which drops the pending prompt.
if (!added) return;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Show the add-workspace error above the dialog

When addWorkspaceByPath returns false for an invalid daemon path, this early return leaves AddWorkspaceDialog mounted. The only feedback is the global pushOperationFailure toast, but the dialog backdrop is z-index: 200 while WarningToasts is z-index: 60, so the error toast is rendered behind the modal/backdrop and may auto-dismiss before the user can see or interact with it. This makes the rejected-path case still look like a no-op unless the user closes the picker; surface an inline error or render the toast above/inside the dialog while keeping it open.

Useful? React with 👍 / 👎.

When the daemon rejects a path, the global warning toast rendered behind the picker's backdrop (z-index 60 vs 200) and could auto-dismiss unseen. Surface the failure as an inline error inside the dialog instead, so it is visible and persists until the user retries or closes. addWorkspaceByPath now returns a boolean and leaves surfacing to the caller; the picker shows a localized inline message.
@wbxl2000

Copy link
Copy Markdown
Collaborator Author

@codex

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 👍

Reviewed commit: 3c9c7085cc

ℹ️ 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".

@wbxl2000
wbxl2000 merged commit bfe8e6a into main Jun 30, 2026
9 checks passed
@wbxl2000
wbxl2000 deleted the fix/web-add-workspace-silent-failure branch June 30, 2026 14:40
@github-actions github-actions Bot mentioned this pull request Jun 30, 2026
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