fix(desktop): keep the live controller when a model switch fails#3003
Merged
Conversation
SetModel and rebuild closed the active tab's controller before building the replacement, so a failed boot.Build (e.g. an unknown model) left the tab with a closed controller and the conversation dead — and the frontend swallowed the error. Build first, swap, then close the old controller only on success; on failure the existing controller stays live. Surface the failure in the UI via local_notice instead of dropping it, and pass io.Discard for boot diagnostics so sandbox warnings stop leaking to the desktop console on rebuilds.
This was referenced Jun 4, 2026
esengine
added a commit
that referenced
this pull request
Jun 4, 2026
…3011) * fix(desktop): remove accidental project tabs rollout * fix(desktop): preserve settings session on rebuild errors * fix(desktop): preserve model-switch + macOS chrome fixes in tabs revert The tabs revert reintroduced regressions for fixes that landed on top of #2928: - SetModel closed the controller before boot.Build, so a failed switch left a dead controller (regressed #3003); restore build→swap→close and io.Discard for boot diagnostics, and surface the failure in the UI. - The macOS window chrome (#2997) was stripped from the frontend; restore Platform() wiring (bridge.ts), the data-platform/chrome layer (App.tsx), and the darwin-only CSS (minus the removed workspace-tabs-bar rule). --------- Co-authored-by: Sivan <liuxw96@foxmail.com> Co-authored-by: reasonix <reasonix@deepseek.com>
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.
Re-implementation of #2768 by @paradoxSCH (Closes #2644) against current main-v2 — the original couldn't be rebased because #2928's multi-tab refactor moved every field it touched (
a.ctrl→tab.Ctrletc.), so I re-applied the load-bearing fixes against the newWorkspaceTabmodel.The bug (still live on main-v2)
SetModel(desktop/app.go) andrebuild(desktop/settings_app.go) both didtab.Ctrl.Close()beforeboot.Build. A failed build — e.g. switching to an unknown/misconfigured model — returned the error but left the tab pointing at a closed controller, killing the conversation. The frontend then swallowed the error (SetModel(...).catch(() => {})), so the user saw nothing.Fix
boot.Build, the existing controller is left untouched and still usable. (bothSetModelandrebuild)useController.tsvialocal_noticeinstead of dropping it.Stderr: io.Discardto the three desktopboot.Buildsites (SetModel,rebuild, initial tab build) so bash-sandbox warnings stop leaking to the Windows desktop console during rebuilds.Scoped to the correctness fixes; left out the original PR's unrelated bits (dist placeholder, a JSX→ReactElement type tweak) which aren't bugs.
Verification
gofmtclean;go build ./...(desktop) + fullgo test ./...(desktop module) greenpnpm run typecheck(frontend) cleanTestSetModelFailureLeavesTabStateIntact(failed switch returns an error and leaves tab controller/model unmutated)Closes #2768
Closes #2644