Skip to content

🤖 refactor: delete the dead agent, compaction and runtime default keys - #5913

Closed
ibetitsmike wants to merge 7 commits into
mike/server-side-ai-pick-keysfrom
mike/server-side-ai-dead-keys
Closed

ibetitsmike wants to merge 7 commits into
mike/server-side-ai-pick-keysfrom
mike/server-side-ai-dead-keys

Conversation

@ibetitsmike

@ibetitsmike ibetitsmike commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Four more localStorage key families go, with their storage registry entries:

  • disableWorkspaceAgents:{scope}: its UI toggle was already gone, and AgentContext only reset a stored true back to false on mount. AgentContext stops reading it and stops passing it to agents.list; the command palette and the workspace menu pass false, and the composer's skill suggestions and sends keep only the existing per-draft discovery flag.
  • pinnedAgentId:{workspace} and autoCompaction:enabled:{workspace}: nothing read or wrote them.
  • runtime:{project}: a superseded per-project default. Its only writer, setDefaultRuntimeChoice in useDraftWorkspaceSettings, had no UI caller and is deleted with its plumbing through useCreationWorkspace and CreationControls.

/new read runtime:{project} when no runtime was given. It now uses the default runtime from Settings, the project's first and then the global one as the creation UI does, when that default is local, and the backend's worktree default otherwise, because /new cannot ask for the host, image or config path that the other runtimes need. A leftover per-project value no longer applies, and startup cleanup (removeDroppedCacheKeys) now deletes leftover pinnedAgentId:, autoCompaction:enabled:, disableWorkspaceAgents: and runtime: values.

The send option builders already read no localStorage key, so their comments, and the runtime string helpers' comments, stop saying they do.

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.json instead 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 20 of 20.

Testing

  • Deleted "persists Coder default string when toggling default" (useDraftWorkspaceSettings.test.tsx): it drove the removed setter. "keeps Coder default even after plain SSH usage" no longer seeds the removed key.
  • "removes per-workspace keys the old lists missed" (workspaceStorage.test.ts) drops the removed key from its list.
  • "/new applies only a configured local default runtime, the project's first" (chatCommands.test.ts): with a local default /new creates a local workspace, with an ssh default it sends no runtime, and a project default outranks the global one.
  • "removes only keys with a dropped cache prefix" (legacyLocalStorageCleanup.test.ts) covers the four removed prefixes.
  • make static-check and the touched test suites pass at the top of the stack; CI checks each layer on its own.

Review record

disableWorkspaceAgents, pinnedAgentId and autoCompaction:enabled had no live writer or reader,
and runtime:{project} was a superseded default whose writer no UI called. /new now uses the
configured default runtime instead. Sends no longer read any localStorage key, so the send
option comments stop saying they do.

Stack-Layer: A4
Also tests that /new applies only a configured local default runtime and drops stale
localStorage mentions from the runtime parser and compaction option comments. Merges the
updated layer below.

Stack-Layer: A4
@ibetitsmike
ibetitsmike added this pull request to stack #5868 October 8, 2026 21:03
@ibetitsmike ibetitsmike changed the title mike/server side ai dead keys 🤖 refactor: delete the dead agent, compaction and runtime default keys Oct 8, 2026
Also tests that /new applies only a configured local default runtime and drops stale
localStorage mentions from the runtime parser and compaction option comments. Merges the
updated layer below.

Stack-Layer: A4
@ibetitsmike
ibetitsmike marked this pull request as ready for review October 8, 2026 21:33
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-09T00:27:01.032161Z 3943dfc New commits
🔒 Security Review ✅ Completed 2026-10-09T00:27:27.701428Z 3943dfc New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@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: 58ac1bdb48

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

Comment thread src/browser/utils/chatCommands.ts Outdated
/new read only the global default runtime, so a project that overrides it got the global
choice. It now uses the project default first, as the creation UI does, and still applies
only a local default.

Stack-Layer: A4
@ibetitsmike
ibetitsmike removed this pull request from stack #5868 October 9, 2026 04:50
@ibetitsmike

Copy link
Copy Markdown
Contributor Author

Landed in #5916 (7b9899d), which collapsed this stack into one squash merge.

@ibetitsmike ibetitsmike closed this Oct 9, 2026
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.
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