[codex] Enhance host service unavailable errors#4613
Conversation
📝 WalkthroughWalkthroughThis PR establishes a centralized host-service-unavailable messaging system by introducing helper functions and types in a new library, expanding ChangesHost service unavailability messaging
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Capy auto-review is paused for this organization because the monthly auto-review limit has been reached. Increase the limit or turn it off in billing settings to resume automatic reviews. |
|
Ready to review this PR? Stage has broken it down into 6 individual chapters for you: Chapters generated by Stage for commit 1dd188d on May 16, 2026 12:31am UTC. |
There was a problem hiding this comment.
Actionable comments posted: 3
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
apps/desktop/src/renderer/routes/_authenticated/settings/agents/components/V2AgentsSettings/V2AgentsSettings.tsx (1)
184-189:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winMake the inline error message selectable.
This error surface contains diagnostic text users may need to copy, but it is missing
select-text cursor-text.Suggested fix
- <div className="p-6 text-sm text-destructive"> + <div className="p-6 text-sm text-destructive select-text cursor-text">As per coding guidelines,
apps/desktop/**/*.{tsx,jsx}: Error text must be selectable by users with explicit select-text cursor-text classes; renderer sets user-select: none on body.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/desktop/src/renderer/routes/_authenticated/settings/agents/components/V2AgentsSettings/V2AgentsSettings.tsx` around lines 184 - 189, The error message in V2AgentsSettings is not selectable because the div's className lacks the required select-text and cursor-text classes; update the div that renders the fallback error (the element that uses configsQuery.error and hostServiceUnavailableMessage) to include "select-text cursor-text" in its className so users can copy diagnostic text.apps/desktop/src/renderer/routes/_authenticated/settings/v2-project/$projectId/components/V2ProjectSettings/components/DeleteProjectSection/DeleteProjectSection.tsx (1)
91-91:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winThe host-unavailable toast path is currently unreachable.
AlertDialogActionis disabled when!activeHostUrl, so users can’t triggerhandleDeleteand see the new contextual toast.Suggested fix
- disabled={isDeleting || !activeHostUrl} + disabled={isDeleting}🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/desktop/src/renderer/routes/_authenticated/settings/v2-project/`$projectId/components/V2ProjectSettings/components/DeleteProjectSection/DeleteProjectSection.tsx at line 91, AlertDialogAction is currently disabled when !activeHostUrl so handleDelete never runs and the "host-unavailable" toast can't be shown; remove the dependency on activeHostUrl from the disabled prop (use disabled={isDeleting} instead) and add an early check inside handleDelete (or its wrapper) that if !activeHostUrl calls the contextual toast and returns without attempting deletion; update references to AlertDialogAction and handleDelete to reflect this behavior so the toast path is reachable while still preventing duplicate deletes via isDeleting.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@apps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/components/TasksView/components/TasksTopBar/components/RunInWorkspacePopoverV2/RunInWorkspacePopoverV2.tsx`:
- Around line 217-223: handleRun currently returns early when submitBlocker is
set, so the new local-host unavailable toast path is never reached; change the
early-return logic so the local-host diagnostic toast is shown even when
submitBlocker is true: inside handleRun, before returning for submitBlocker,
check if hostId === machineId && !activeHostUrl and call
showHostServiceUnavailableToast(hostService, { action: "run tasks in workspaces"
}) then return; apply the same adjustment to the other handleRun-like block at
the second occurrence (around the 379-381 area) so the toast is reachable even
when submitBlocker disables the action.
In
`@apps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/components/TasksView/components/TasksTopBar/components/RunIssuesInWorkspacePopover/RunIssuesInWorkspacePopover.tsx`:
- Around line 214-223: The current flow in handleRun makes the submitBlocker
check prevent the local-host unavailable branch from ever running because the
button is disabled when submitBlocker is set; change the logic so the local-host
unavailable diagnostic toast can be shown even when submitBlocker is
truthy—either by moving the hostId/machineId && !activeHostUrl check to run
before the submitBlocker guard within handleRun (call
showHostServiceUnavailableToast(hostService, { action: "run issues in
workspaces" }) and return) or by adjusting the button disabled condition to
allow clicks when host service is unavailable; update references: handleRun,
submitBlocker, hostId, machineId, activeHostUrl,
showHostServiceUnavailableToast, and toast.error.
In
`@apps/desktop/src/renderer/routes/_authenticated/components/DashboardNewWorkspaceModal/components/DashboardNewWorkspaceForm/PromptGroup/hooks/useSubmitWorkspace/useSubmitWorkspace.ts`:
- Around line 142-144: In useSubmitWorkspace.ts, sanitize any backend error text
before passing it into toast.error (the occurrences where toast.error(...) is
called with result.error) to avoid leaking internal SQL/query details to users;
replace the raw result.error in the toast description with a user-friendly,
generic message (e.g. "Workspace creation failed. Please try again.") and send
the full result.error to an internal logger or attach it to a non-UI debug
context for developers; ensure both places that reference result.error for the
toast (the current toast.error calls) are updated to use the sanitized/generic
message while preserving the original error for internal logs.
---
Outside diff comments:
In
`@apps/desktop/src/renderer/routes/_authenticated/settings/agents/components/V2AgentsSettings/V2AgentsSettings.tsx`:
- Around line 184-189: The error message in V2AgentsSettings is not selectable
because the div's className lacks the required select-text and cursor-text
classes; update the div that renders the fallback error (the element that uses
configsQuery.error and hostServiceUnavailableMessage) to include "select-text
cursor-text" in its className so users can copy diagnostic text.
In
`@apps/desktop/src/renderer/routes/_authenticated/settings/v2-project/`$projectId/components/V2ProjectSettings/components/DeleteProjectSection/DeleteProjectSection.tsx:
- Line 91: AlertDialogAction is currently disabled when !activeHostUrl so
handleDelete never runs and the "host-unavailable" toast can't be shown; remove
the dependency on activeHostUrl from the disabled prop (use
disabled={isDeleting} instead) and add an early check inside handleDelete (or
its wrapper) that if !activeHostUrl calls the contextual toast and returns
without attempting deletion; update references to AlertDialogAction and
handleDelete to reflect this behavior so the toast path is reachable while still
preventing duplicate deletes via isDeleting.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: e812d024-44e6-4b42-8e3d-07b004e28832
📒 Files selected for processing (20)
apps/desktop/src/renderer/commandPalette/core/ContextProvider.tsxapps/desktop/src/renderer/commandPalette/core/types.tsapps/desktop/src/renderer/commandPalette/modules/openIn/commands.tsapps/desktop/src/renderer/hooks/useEnsureV2Project/useEnsureV2Project.tsapps/desktop/src/renderer/lib/host-service-unavailable.tsapps/desktop/src/renderer/routes/_authenticated/_dashboard/components/AddRepositoryModals/components/NewProjectModal/NewProjectModal.tsxapps/desktop/src/renderer/routes/_authenticated/_dashboard/components/AddRepositoryModals/hooks/useFolderFirstImport/useFolderFirstImport.tsapps/desktop/src/renderer/routes/_authenticated/_dashboard/components/DashboardSidebar/components/DashboardSidebarWorkspaceItem/hooks/useDashboardSidebarWorkspaceItemActions/useDashboardSidebarWorkspaceItemActions.tsapps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/$taskId/components/PropertiesSidebar/components/OpenInWorkspaceV2/OpenInWorkspaceV2.tsxapps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/components/TasksView/components/TasksTopBar/components/RunInWorkspacePopoverV2/RunInWorkspacePopoverV2.tsxapps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/components/TasksView/components/TasksTopBar/components/RunIssuesInWorkspacePopover/RunIssuesInWorkspacePopover.tsxapps/desktop/src/renderer/routes/_authenticated/components/DashboardNewWorkspaceModal/components/DashboardNewWorkspaceForm/PromptGroup/PromptGroup.tsxapps/desktop/src/renderer/routes/_authenticated/components/DashboardNewWorkspaceModal/components/DashboardNewWorkspaceForm/PromptGroup/hooks/useSubmitWorkspace/useSubmitWorkspace.tsapps/desktop/src/renderer/routes/_authenticated/providers/LocalHostServiceProvider/LocalHostServiceProvider.tsxapps/desktop/src/renderer/routes/_authenticated/settings/agents/components/V2AgentsSettings/V2AgentsSettings.tsxapps/desktop/src/renderer/routes/_authenticated/settings/agents/components/V2AgentsSettings/components/AgentDetail/AgentDetail.tsxapps/desktop/src/renderer/routes/_authenticated/settings/v2-project/$projectId/components/V2ProjectSettings/components/DeleteProjectSection/DeleteProjectSection.tsxapps/desktop/src/renderer/routes/_authenticated/settings/v2-project/$projectId/components/V2ProjectSettings/components/ProjectLocationSection/ProjectLocationSection.tsxapps/desktop/src/renderer/screens/main/components/WorkspaceSidebar/WorkspaceListItem/components/RenameBranchDialog/RenameBranchDialog.tsxapps/desktop/src/renderer/stores/workspace-creates/useWorkspaceCreates.ts
| const handleRun = () => { | ||
| if (!selectedProjectId || !hostId) return; | ||
| if (submitBlocker) { | ||
| toast.error(submitBlocker); | ||
| if (hostId === machineId && !activeHostUrl) { | ||
| showHostServiceUnavailableToast(hostService, { | ||
| action: "run tasks in workspaces", | ||
| }); |
There was a problem hiding this comment.
Blocked-action diagnostic toast is unreachable from the UI.
handleRun now includes a local-host unavailable toast path, but the button is disabled whenever submitBlocker is set, so users can’t trigger the new blocked-action diagnostic.
💡 Proposed fix
+ const isLocalHostServiceUnavailable =
+ !!selectedProjectId && !!hostId && hostId === machineId && !activeHostUrl;
+
const handleRun = () => {
if (!selectedProjectId || !hostId) return;
if (submitBlocker) {
- if (hostId === machineId && !activeHostUrl) {
+ if (isLocalHostServiceUnavailable) {
showHostServiceUnavailableToast(hostService, {
action: "run tasks in workspaces",
});
} else {
toast.error(submitBlocker);
}
return;
}
@@
<Button
size="sm"
className="w-full h-8"
- disabled={!!submitBlocker}
+ disabled={!!submitBlocker && !isLocalHostServiceUnavailable}
onClick={handleRun}
>Also applies to: 379-381
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In
`@apps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/components/TasksView/components/TasksTopBar/components/RunInWorkspacePopoverV2/RunInWorkspacePopoverV2.tsx`
around lines 217 - 223, handleRun currently returns early when submitBlocker is
set, so the new local-host unavailable toast path is never reached; change the
early-return logic so the local-host diagnostic toast is shown even when
submitBlocker is true: inside handleRun, before returning for submitBlocker,
check if hostId === machineId && !activeHostUrl and call
showHostServiceUnavailableToast(hostService, { action: "run tasks in workspaces"
}) then return; apply the same adjustment to the other handleRun-like block at
the second occurrence (around the 379-381 area) so the toast is reachable even
when submitBlocker disables the action.
| const handleRun = () => { | ||
| if (!selectedProjectId || !hostId) return; | ||
| if (submitBlocker) { | ||
| toast.error(submitBlocker); | ||
| if (hostId === machineId && !activeHostUrl) { | ||
| showHostServiceUnavailableToast(hostService, { | ||
| action: "run issues in workspaces", | ||
| }); | ||
| } else { | ||
| toast.error(submitBlocker); | ||
| } |
There was a problem hiding this comment.
Blocked-action diagnostic toast is unreachable from the UI here as well.
This component has the same behavior: submitBlocker disables the button, so the new local-host unavailable toast branch in handleRun cannot be reached via user interaction.
💡 Proposed fix
+ const isLocalHostServiceUnavailable =
+ !!selectedProjectId && !!hostId && hostId === machineId && !activeHostUrl;
+
const handleRun = () => {
if (!selectedProjectId || !hostId) return;
if (submitBlocker) {
- if (hostId === machineId && !activeHostUrl) {
+ if (isLocalHostServiceUnavailable) {
showHostServiceUnavailableToast(hostService, {
action: "run issues in workspaces",
});
} else {
toast.error(submitBlocker);
}
return;
}
@@
<Button
size="sm"
className="w-full h-8"
- disabled={!!submitBlocker}
+ disabled={!!submitBlocker && !isLocalHostServiceUnavailable}
onClick={handleRun}
>Also applies to: 379-381
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In
`@apps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/components/TasksView/components/TasksTopBar/components/RunIssuesInWorkspacePopover/RunIssuesInWorkspacePopover.tsx`
around lines 214 - 223, The current flow in handleRun makes the submitBlocker
check prevent the local-host unavailable branch from ever running because the
button is disabled when submitBlocker is set; change the logic so the local-host
unavailable diagnostic toast can be shown even when submitBlocker is
truthy—either by moving the hostId/machineId && !activeHostUrl check to run
before the submitBlocker guard within handleRun (call
showHostServiceUnavailableToast(hostService, { action: "run issues in
workspaces" }) and return) or by adjusting the button disabled condition to
allow clicks when host service is unavailable; update references: handleRun,
submitBlocker, hostId, machineId, activeHostUrl,
showHostServiceUnavailableToast, and toast.error.
| toast.error("Workspace creation failed", { | ||
| description: result.error, | ||
| }); |
There was a problem hiding this comment.
Sanitize backend error text before showing toast descriptions.
Line 143 and Line 168 now display raw backend error messages; this can leak internal SQL/query details to end users (same leak pattern already guarded elsewhere in this PR).
Suggested patch
+const sanitizeWorkspaceCreateError = (message: string) =>
+ message.startsWith("Failed query:")
+ ? "Could not create workspace. Please retry or check logs."
+ : message;
...
toast.error("Workspace creation failed", {
- description: result.error,
+ description: sanitizeWorkspaceCreateError(result.error),
});
...
toast.error("Workspace creation failed", {
- description: error instanceof Error ? error.message : String(error),
+ description: sanitizeWorkspaceCreateError(
+ error instanceof Error ? error.message : String(error),
+ ),
});Also applies to: 167-169
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In
`@apps/desktop/src/renderer/routes/_authenticated/components/DashboardNewWorkspaceModal/components/DashboardNewWorkspaceForm/PromptGroup/hooks/useSubmitWorkspace/useSubmitWorkspace.ts`
around lines 142 - 144, In useSubmitWorkspace.ts, sanitize any backend error
text before passing it into toast.error (the occurrences where toast.error(...)
is called with result.error) to avoid leaking internal SQL/query details to
users; replace the raw result.error in the toast description with a
user-friendly, generic message (e.g. "Workspace creation failed. Please try
again.") and send the full result.error to an internal logger or attach it to a
non-UI debug context for developers; ensure both places that reference
result.error for the toast (the current toast.error calls) are updated to use
the sanitized/generic message while preserving the original error for internal
logs.
There was a problem hiding this comment.
1 issue found across 20 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="apps/desktop/src/renderer/routes/_authenticated/components/DashboardNewWorkspaceModal/components/DashboardNewWorkspaceForm/PromptGroup/PromptGroup.tsx">
<violation number="1" location="apps/desktop/src/renderer/routes/_authenticated/components/DashboardNewWorkspaceModal/components/DashboardNewWorkspaceForm/PromptGroup/PromptGroup.tsx:278">
P2: The new host-service toast condition is too broad and can override unrelated submit blockers (for example, "Select a project"). Only show the rich host-service toast when the blocker is specifically the host-service-unavailable case.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
Re-trigger cubic
| } | ||
| if (submitBlocker) { | ||
| toast.error(submitBlocker); | ||
| if ((draft.hostId ?? machineId) === machineId && !activeHostUrl) { |
There was a problem hiding this comment.
P2: The new host-service toast condition is too broad and can override unrelated submit blockers (for example, "Select a project"). Only show the rich host-service toast when the blocker is specifically the host-service-unavailable case.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At apps/desktop/src/renderer/routes/_authenticated/components/DashboardNewWorkspaceModal/components/DashboardNewWorkspaceForm/PromptGroup/PromptGroup.tsx, line 278:
<comment>The new host-service toast condition is too broad and can override unrelated submit blockers (for example, "Select a project"). Only show the rich host-service toast when the blocker is specifically the host-service-unavailable case.</comment>
<file context>
@@ -273,11 +275,26 @@ export function PromptGroup({
}
if (submitBlocker) {
- toast.error(submitBlocker);
+ if ((draft.hostId ?? machineId) === machineId && !activeHostUrl) {
+ showHostServiceUnavailableToast(hostService, {
+ action: "create the workspace",
</file context>
| if ((draft.hostId ?? machineId) === machineId && !activeHostUrl) { | |
| if (submitBlocker === "Host service is not running") { |
Greptile SummaryThis PR replaces generic "Host service not available" toasts across ~15 call sites with a shared
Confidence Score: 4/5Safe to merge; the changes are largely additive error-message improvements with no data-path mutations, and the new processStatus poll is correctly scoped to when there is no active connection. All modified call sites follow the same well-understood pattern, and the new utility functions are pure string formatters. The only notable issue is the redundant boolean guard in the batch-submission error detail calculation across two files, which could produce a RunInWorkspacePopoverV2.tsx and RunIssuesInWorkspacePopover.tsx for the details-expression fix; LocalHostServiceProvider.tsx if the processStatus poll frequency needs tuning in future.
|
| Filename | Overview |
|---|---|
| apps/desktop/src/renderer/lib/host-service-unavailable.ts | New utility module for enriched host-service error messages and toasts; all enum cases covered, helper functions are well-scoped |
| apps/desktop/src/renderer/routes/_authenticated/providers/LocalHostServiceProvider/LocalHostServiceProvider.tsx | Adds processStatus polling query and exposes activeOrganizationId/Name + hostServiceStatus through context; polling correctly stops when a connection exists; stale processStatus edge case on disconnect is transient (~1s) |
| apps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/components/TasksView/components/TasksTopBar/components/RunInWorkspacePopoverV2/RunInWorkspacePopoverV2.tsx | Switches to enriched toast for local host-service failures; adds first-failure error details to batch-submission error — redundant boolean check in details expression |
| apps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/components/TasksView/components/TasksTopBar/components/RunIssuesInWorkspacePopover/RunIssuesInWorkspacePopover.tsx | Same batch-submission enrichment as RunInWorkspacePopoverV2; same redundant boolean check in details expression |
| apps/desktop/src/renderer/stores/workspace-creates/useWorkspaceCreates.ts | Replaces plain 'Host service not available' string with contextual message from helper; hostService added to callback dep array |
| apps/desktop/src/renderer/commandPalette/core/ContextProvider.tsx | Threads new host-service context fields through CommandContextProvider; straightforward data plumbing |
| apps/desktop/src/renderer/routes/_authenticated/components/DashboardNewWorkspaceModal/components/DashboardNewWorkspaceForm/PromptGroup/PromptGroup.tsx | Conditions on (draft.hostId ?? machineId) === machineId to gate enriched toast; logic is correct and dependency array is complete |
| apps/desktop/src/renderer/routes/_authenticated/settings/v2-project/$projectId/components/V2ProjectSettings/components/ProjectLocationSection/ProjectLocationSection.tsx | All five host-check paths consistently replaced with showHostServiceUnavailableToast; no issues |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[User triggers host-dependent action] --> B{submitBlocker set?}
B -- No --> C[Proceed with action]
B -- Yes --> D{hostId === machineId\nAND activeHostUrl null?}
D -- Yes --> E[showHostServiceUnavailableToast]
D -- No --> F[toast.error with submitBlocker message]
E --> G[getHostServiceUnavailableMessage]
G --> H{activeOrganizationId present?}
H -- No --> I[Cannot ACTION: no active organization selected]
H -- Yes --> J[Fetch hostServiceStatus from LocalHostServiceProvider]
J --> K{processStatus polling\n1s when disconnected,\noff when connected}
K --> L{status}
L -- starting --> M[Retry in a few seconds]
L -- stopped --> N[Use tray menu to restart]
L -- running --> O[Retry after connection refreshes]
L -- unknown --> P[Retry; if persists, restart Superset]
Comments Outside Diff (1)
-
apps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/components/TasksView/components/TasksTopBar/components/RunInWorkspacePopoverV2/RunInWorkspacePopoverV2.tsx, line 252-263 (link)The inner
!firstFailure.okguard is always true becausefind(result => !result.ok)already guarantees it. More importantly, iffirstFailure.erroris everundefined(a failure variant with no message), the toast description would literally read "N of M succeeded: undefined". Using optional chaining on.errorhandles both concerns.Prompt To Fix With AI
This is a comment left during a code review. Path: apps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/components/TasksView/components/TasksTopBar/components/RunInWorkspacePopoverV2/RunInWorkspacePopoverV2.tsx Line: 252-263 Comment: The inner `!firstFailure.ok` guard is always true because `find(result => !result.ok)` already guarantees it. More importantly, if `firstFailure.error` is ever `undefined` (a failure variant with no message), the toast description would literally read "N of M succeeded: undefined". Using optional chaining on `.error` handles both concerns. How can I resolve this? If you propose a fix, please make it concise.
Prompt To Fix All With AI
Fix the following 2 code review issues. Work through them one at a time, proposing concise fixes.
---
### Issue 1 of 2
apps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/components/TasksView/components/TasksTopBar/components/RunInWorkspacePopoverV2/RunInWorkspacePopoverV2.tsx:252-263
The inner `!firstFailure.ok` guard is always true because `find(result => !result.ok)` already guarantees it. More importantly, if `firstFailure.error` is ever `undefined` (a failure variant with no message), the toast description would literally read "N of M succeeded: undefined". Using optional chaining on `.error` handles both concerns.
```suggestion
const promise = Promise.all(submissions).then((results) => {
const failed = results.filter((r) => !r.ok).length;
if (failed > 0) {
const firstFailure = results.find((result) => !result.ok);
const details =
firstFailure?.error ? `: ${firstFailure.error}` : "";
throw new Error(
`${results.length - failed} of ${results.length} succeeded${details}`,
);
}
return results.length;
});
```
### Issue 2 of 2
apps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/components/TasksView/components/TasksTopBar/components/RunIssuesInWorkspacePopover/RunIssuesInWorkspacePopover.tsx:253-258
Same redundant double-check pattern as in `RunInWorkspacePopoverV2` — `find` already ensures `!result.ok` for the matched element, and an absent `error` value would produce `: undefined` in the error message.
```suggestion
const promise = Promise.all(submissions).then((results) => {
const failed = results.filter((r) => !r.ok).length;
if (failed > 0) {
const firstFailure = results.find((result) => !result.ok);
const details =
firstFailure?.error ? `: ${firstFailure.error}` : "";
```
Reviews (1): Last reviewed commit: "Remove host service unavailable message ..." | Re-trigger Greptile
| const promise = Promise.all(submissions).then((results) => { | ||
| const failed = results.filter((r) => !r.ok).length; | ||
| if (failed > 0) { | ||
| const firstFailure = results.find((result) => !result.ok); | ||
| const details = | ||
| firstFailure && !firstFailure.ok ? `: ${firstFailure.error}` : ""; |
There was a problem hiding this comment.
Same redundant double-check pattern as in
RunInWorkspacePopoverV2 — find already ensures !result.ok for the matched element, and an absent error value would produce : undefined in the error message.
| const promise = Promise.all(submissions).then((results) => { | |
| const failed = results.filter((r) => !r.ok).length; | |
| if (failed > 0) { | |
| const firstFailure = results.find((result) => !result.ok); | |
| const details = | |
| firstFailure && !firstFailure.ok ? `: ${firstFailure.error}` : ""; | |
| const promise = Promise.all(submissions).then((results) => { | |
| const failed = results.filter((r) => !r.ok).length; | |
| if (failed > 0) { | |
| const firstFailure = results.find((result) => !result.ok); | |
| const details = | |
| firstFailure?.error ? `: ${firstFailure.error}` : ""; |
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/components/TasksView/components/TasksTopBar/components/RunIssuesInWorkspacePopover/RunIssuesInWorkspacePopover.tsx
Line: 253-258
Comment:
Same redundant double-check pattern as in `RunInWorkspacePopoverV2` — `find` already ensures `!result.ok` for the matched element, and an absent `error` value would produce `: undefined` in the error message.
```suggestion
const promise = Promise.all(submissions).then((results) => {
const failed = results.filter((r) => !r.ok).length;
if (failed > 0) {
const firstFailure = results.find((result) => !result.ok);
const details =
firstFailure?.error ? `: ${firstFailure.error}` : "";
```
How can I resolve this? If you propose a fix, please make it concise.
🧹 Preview Cleanup CompleteThe following preview resources have been cleaned up:
Thank you for your contribution! 🎉 |
Summary
This updates host-service unavailable errors in the desktop renderer so they include actionable context instead of only saying the host service is unavailable.
What changed
LocalHostServiceProviderand command palette context.Why
The previous toast did not tell users whether the service was starting, stopped, tied to a specific organization/device, or what they could do next. These paths now surface enough detail to retry or restart the host service from the tray menu.
Validation
bun run lint -- apps/desktop/src/renderer/lib/host-service-unavailable.tsbun run lint -- <touched files>bun run --cwd apps/desktop typecheckbun run lint