Skip to content

fix(settings): return current preferences after slow updates - #27199

Merged
nwparker merged 2 commits into
mainfrom
nwparker/medium-settings-reply-risk-10-10
Oct 11, 2026
Merged

nwparker merged 2 commits into
mainfrom
nwparker/medium-settings-reply-risk-10-10

Conversation

@nwparker

@nwparker nwparker commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

Settings writes now reply with the latest preferences after a slower language, proxy, or agent-hook update finishes.

What Changed

Previously, a desktop settings write captured a full settings snapshot before waiting for those updates. Another write could finish during that wait, leaving the older request to return outdated preferences. The handler now reads the current Store when it returns. Side effects and telemetry still use the original write's snapshot.

Why

The existing paired-runtime settings writer already reads current settings after reconciliation. Using the same response boundary on desktop fixes the stale reply without adding settings versions, changing persistence, or serializing unrelated writes.

Linked Issue

Related to the settings-concurrency verification for #26853; this regression also reproduces on main without that PR. No separate existing issue found in the bounded search.

Visual Proof

N/A — this changes the backend reply boundary. No rendering control or layout changes. The table shows recorded registered-handler results with real Store and SQLite persistence; it is not an application screenshot.

Delayed write Before: returned theme After: returned theme Current Store / SQLite
Language update, then newer theme dark light light
Proxy update, then newer theme dark light light

Testing

  • I manually tested these changes locally
  • Automated tests added/updated, or explained why not below

On macOS with Node 24.20.0, 44 tests pass across the new delayed-reply suite, existing settings-handler suite, and durable preference suite. The language and proxy controls fail on unchanged main: the reply says dark while both the Store and independent SQLite read say light. The hook control also verifies that its side-effect input retains the original dark snapshot while the reply contains light.

Head 924dc8be5734f965ad1d156eebc08400bfc789ec adds the new SQLite IPC suite to the existing explicit Node-runtime test list. Its production code and test assertions are byte-identical to the previously verified head 964cc4d858e9915678769cefb7152fcebda3a8f4. The canonical runner now dispatches the same three cases to Node; all three plus the existing runtime/SQLite boundary controls pass, 16 tests across three files. Before registration, the same three assertions also passed in Bun. This follows the existing SQLite worker-IPC runtime policy; it is not a product fix or a weakened assertion.

Full Node typecheck, full-file root/native/type-aware/anti-slop/React Doctor checks, test casting check, changed-code quality gate, formatting, and diff whitespace checks pass. Commands ran directly with the required background-launch environment, using existing dependencies without installation or native rebuilding. Full application build, rendered Electron validation, Linux, Windows, and SSH execution were not run for this backend-only change; CI remains required.

AI Disclosure

Review

Reviewed write authority, asynchronous response timing, real persisted state, retained side-effect inputs, paired-runtime behavior, and renderer publication fencing. The response shape and all persisted fields remain compatible with existing clients.

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

The bounded related-code search found the paired runtime already returns a fresh read. Open #26826 extracts this same desktop handler for settings backup/import and should retain this correction when rebased. No Git commands, paths, shortcuts, platform checks, or remote wire fields change.

The prior head 964cc4d completed CI with 14 successful and 16 skipped checks. Fresh CI is required for the additive test-registration head 924dc8be; prior results do not represent that new run.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

@coderabbitai

coderabbitai Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: dbd3a682-f040-449d-8054-1c47c2a0a50a


📥 Commits

Reviewing files that changed from the base of the PR and between 964cc4d and 924dc8b.



📒 Files selected for processing (1)
  • config/scripts/vitest-node-runtime-files.mjs


Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.




📝 Walkthrough
📝 Walkthrough

Walkthrough

The settings:set handler now returns the settings currently held by the store after processing an update. New tests cover delayed language, agent-hook, and proxy reconciliation while a newer light-theme write completes. They check that the first write’s response and the persisted and read state reflect the newer theme. The agent-hook test also checks that reconciliation receives the original dark-theme settings snapshot.



Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to 924dc

The handler now returns current preferences after delayed updates. No merge-blocking issue was identified; the reported platform validation remains for CI.

Pre-merge checks | Passed 4 | Failed 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 3 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Title check Passed The title clearly and concisely describes the main change: returning current preferences after slow settings updates.
Description check Passed The description covers the required sections, explains the stale-response problem and implementation, references issue #26853, documents the backend-only visual impact, testing results, limitations, r…

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR



  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@nwparker
nwparker merged commit 91f9744 into main Oct 11, 2026
30 checks passed
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