fix(desktop): return expected failures as codes across IPC - #4878
Draft
orangeCatDeveloper wants to merge 1 commit into
Draft
fix(desktop): return expected failures as codes across IPC#4878orangeCatDeveloper wants to merge 1 commit into
orangeCatDeveloper wants to merge 1 commit into
Conversation
orangeCatDeveloper
force-pushed
the
fix/ipc-expected-failure-envelope
branch
5 times, most recently
from
September 6, 2026 21:32
3af86a4 to
8aaadc1
Compare
orangeCatDeveloper
force-pushed
the
fix/ipc-expected-failure-envelope
branch
from
September 8, 2026 20:00
b473c45 to
b98a8d3
Compare
Expected failures now cross the process boundary as machine-readable codes rather than prose the renderer has to parse. Attachment rejections carry a typed AttachmentIngestBlockedError whose message keeps the stable token, since Electron drops custom Error fields; the preload and session-settings surfaces throw ExpectedOperationError; and the Runtime's session-configuration guards throw typed transition errors instead of Chinese sentences. The renderer maps the codes through the updateFailures catalog in each locale. Generated-by: Claude Code Generated-by: OpenCode
orangeCatDeveloper
force-pushed
the
fix/ipc-expected-failure-envelope
branch
from
September 8, 2026 21:08
b98a8d3 to
ba1495e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Changing a task's permission mode, plan mode, orchestration or model while it is busy shows the generic "cannot change right now" toast in every locale, and an attachment that fails validation is reported by parsing an
attachment_ingest:<code>token out of the error text.Both Desktop serialization boundaries keep only
Error.message. The Runtime Host already answerssession.configuration.updatewith a structured code (session_busy,operation_conflict, …) and the Desktop client surfaces it asRuntimeHostOperationError.code— but the main-process handler rethrows, so Electron hands the rendererError invoking remote method 'sessions:setPermissionMode': Error: Session has a pending Interactionand the presenter can only fall back.The fix moves expected failures into return values. The five session-setting handlers answer
{ ok: true, session } | { ok: false, code }, narrowed to the four codes a user can act on; unexpected failures still throw. Attachment validation raises a typedAttachmentIngestBlockedError, which preload and main turn into thesubmitMessage/sendenvelope's newattachment_blockedvariant. The renderer adapters unwrap a failed envelope intoExpectedOperationError(code), so the existing intent hook andsessionSettingFailureCopykeep their shape and map the code through a newupdateFailurescatalog. In the Runtime, the session-configuration guards throw a typedSessionConfigurationTransitionErrorinstead of Chinese sentences.AttachmentIngestBlockedErrorcarries its code twice on purpose: as a field for consumers in the same process, and inside its message as the stableattachment_ingest:<code>token for anything on the far side of the IPC boundary, which drops custom Error fields. So the presenter reads the typed code where the throw is local and never parses a string.Boundaries: the protocol is untouched, so there is no Host version skew. The plan-mode write in
app-shellgoes through the session-settings port rather thanwindow.makadirectly, which keeps the root-file ratchet flat.Refs #2672
Verification
Before, a
session_busyanswer reached the toast as the locale fallback. After:Not run: Electron e2e, packaged build.
AI use
Select exactly one:
Tool(s) and scope: Claude Code — traced the failure path, wrote the envelope types and the main/preload/renderer changes, the catalog copy, the tests, the rebase onto current main after #4457 merged, and this description. The decision to leave the protocol untouched and the copy wording were reviewed by hand.
Checklist
Does this PR entail a change in behavior?