Repository navigation
🤖 feat: backend fork copies AI settings and sends persist auto-routing flags - #5894
Closed
ibetitsmike wants to merge 2 commits into
Closed
ibetitsmike wants to merge 2 commits into
ibetitsmike wants to merge 2 commits into
Conversation
…flags The backend now holds every per-workspace AI pick a fork or send needs, so later layers can drop the renderer's localStorage copies of them. Stack-Layer: A1
…kening A send can carry savedAutoRouting, which the backend saves for the agent instead of the send's own Auto flags, so a plan handoff can send unrouted and still keep the target agent's Auto choices. A sub-agent reawakening keeps the saved Auto flags, and its inputs key ignores them. Adds tests for a send without Auto clearing saved flags and for picker updates keeping them. Stack-Layer: A1
ibetitsmike
added this pull request to stack #5868
October 8, 2026 21:03
This was referenced Oct 8, 2026
ibetitsmike
marked this pull request as ready for review
October 8, 2026 21:32
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d7dcafdd6d
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
ibetitsmike
removed this pull request from stack #5868
October 9, 2026 04:49
Contributor
Author
yermakoffivan
pushed a commit
to yermakoffivan/mux
that referenced
this pull request
Oct 9, 2026
…der#5916) ## Summary Lands the server-side preferences work in one squash merge. Every user preference and every per-workspace AI choice now lives only on the server (`config.json` `userPreferences` and workspace metadata); browsers keep no copies in localStorage. This PR replaces the reviewed stacks coder#5844-coder#5879 (preferences) and coder#5894-coder#5913 (workspace AI picks), so the merge queue runs once. Experiments landed earlier in #5833. ## What changes - **Preferences** (appearance, terminal, review, notifications, AI and provider defaults, compaction thresholds, sidebar, usage and analytics choices, tutorial state, power mode, git status mode) follow the user across browsers and update live. Edits go to the server as per-key merge patches (`config.updateUserPreferences`); `config.saveConfig` no longer accepts `userPreferences`. Old localStorage keys are never read again (`uiTheme` stays as a first-paint cache); formerly browser-local values reset once. - **Workspace AI picks** (model, thinking, reasoning mode, agent, Auto routing) resolve from workspace metadata plus an unsent in-memory pick, which the next send saves. Forks copy the source's AI settings and unsent picks. Retired workspace AI keys are deleted at startup, in the desktop app and the VS Code webview. - No import of old local values and no downgrade handling, by design. ## Review record - Per layer: Codex reviewed the preference layers over 7 rounds and the AI-pick layers over 2 rounds; every finding was fixed or answered on its thread. - On this PR: Codex rounds 1 (3 findings), 2 (5), 3 (3), 4 (4), 5 (none), 6 (4), 7 (none) and 8 (1), plus the 6 AI-pick layer findings still open after their round 2, are fixed here or answered on their threads. Declined with reasons: importing old local preference values, keeping the `userPreferencesInitialized` marker and mapping legacy theme names (the plan rules out migration and downgrade handling and resets legacy themes), clearing cached agent bases during a reload, pruning project-keyed preferences of removed projects (the plan keeps them), a timeout for the startup telemetry event (it can only be sent once connected), having a send wait only for the compaction threshold write (the plan has it wait for all pending preference writes, which share one request), and refusing an initial `/goal` when the creation settings save is rejected (same on main; follow-up below). - Remote UAT: PASS at fed9ae5 (round 1). FAIL at 8cbf748 (round 2): a default model save cut off by a lost connection said "Settings could not be saved" although it landed, and a model pick sent with Auto on never ended, so the next send wrote it back over another window's change. Both fixed in f7db7b4. PASS at f7db7b4 (round 3): both fixes, the startup gate (frozen backend, token prompt) and a regression smoke. FAIL at 453a1e7 (round 4): the round 6 fixes (fork start message, full-width toggle, Auto choices while the experiment is off) passed, but when two windows sent within about 200 ms, the first kept showing its own pick and its next send wrote it back over the other window's choice. Fixed in ed42346. PASS at ed42346 (round 5, the final head): the two-window send race in 19 timed runs, the other pick kinds, the single-window send without races, and a smoke of the earlier fixes. - Pixel / Review snapshots need a human reviewer. ## Testing - `make static-check` on the final head; Bun suites for the touched areas (renderer, workspace and task services, backup and context); Jest UI suites for the composer and plan flows; VS Code extension suite (162 tests). - Red-green for every review fix: removing the fix, or unwiring its call site, fails its test. ## Follow-ups - VS Code webview: forward project and global AI defaults, limited to the projects of the shown workspaces. Until then it falls back to per-agent and app defaults, as on main. - Workspace creation with an initial `/goal`: refuse or recover the goal setup when the creation AI settings save is rejected, instead of letting the kickoff use the previously saved settings (as on main). ## Risks Broad but mostly deletion (+6.2k/-9.8k). Highest-risk areas: first paint before the config snapshot arrives, concurrent edits from two windows (last write per key wins), and the AI pick lifecycle around sends, creation, forks and reloads.
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
The backend now holds every per-workspace AI pick that a fork or a send needs, so later layers can drop the renderer's localStorage copies of them.
agentId,aiSettingsandaiSettingsByAgentinto the new workspace's metadata. Before, only the renderer's copy of the localStorage keys carried them over.aiSettingsByAgententry gains two optional flags,autoModelRoutingandautoThinkingLevel(WorkspaceAgentAISettingsSchema). A send saves them for its agent, and a flag the send leaves out means off. A send can instead name the choices to save in the newsavedAutoRoutingoption, so a plan handoff can run unrouted and still keep the agent's Auto choices. Picker updates never carry the flags and keep the stored values.applyAgentTaskTurnAiSnapshot) keeps the child's saved Auto flags. The reawaken inputs key ignores them because planning does not read them, so a flag-only change cannot refuse a reawaken.Stack
Milestone M4 of the server-side settings stack, on top of M3 (#5869 to #5879): per-workspace AI picks (model, thinking level, reasoning mode, agent and Auto routing) are stored in workspace metadata in
config.jsoninstead of per-browser localStorage keys, so every browser shows the same picks. An unsent picker change stays in memory in its tab until a send saves it, and a reload before sending drops it, as the plan accepts. Layer 1 of 20.The stack moves one pick at a time: this layer adds the backend fields, #5895 adds the renderer resolver, #5896 lets it resolve custom agents' inherited defaults anywhere, #5897 carries unsent picks into forks, #5901 to #5907 move model, thinking level and reasoning mode onto it, #5908 to #5912 move the agent and Auto routing and delete their keys, and #5913 deletes keys that had no live reader.
Testing
workspaceService.fork.test.ts): the fork's saved metadata carries the parent's agent, settings and per-agent settings with both Auto flags.workspaceService.aiSettings.test.tssends both Auto flags and expects them in the agent's saved entry.savedAutoRoutingwins over the send's own flags in both directions. "a picker update keeps the saved Auto choices":updateAgentAISettingsleaves them alone.agentTaskReawakenAi.test.ts): a reawaken keeps the flags, and a flag-only change leaves the inputs key unchanged.make static-checkand the touched test suites pass at the top of the stack; CI checks each layer on its own.Review record
efe7e29096, because a fork without a message dropped the source's unsent picks (fixed by 🤖 feat: fork a workspace with the source composer's unsent AI picks #5897, 🤖 refactor: resolve the workspace agent from metadata and an unsent pick #5908 and 🤖 refactor: resolve auto routing from the unsent pick, saved flags and agent defaults #5909); everything else passed. Round 2: PASS on80f2b5379e: forks from all five entry points keep the unsent picks, startup removes the retired keys, and the round 1 checks still pass; the plan handoff was not exercised because the mock model cannot propose a plan. The Codex round 1 fixes made since then have no remote UAT yet; that is left to the next UAT round on 🤖 refactor: keep preferences and workspace AI picks on the server #5916.d7dcafdd6d: 1 finding, declined with the reason in its thread. Mike asked to land the stack as one PR, so further review runs on 🤖 refactor: keep preferences and workspace AI picks on the server #5916.