Skip to content

[2/4] Keep chat preference changes immediate with safe background saves - #453

Draft
Sheng Chen (jdneo) wants to merge 1 commit into
jdneo-preferences-01-nonblocking-loadingfrom
jdneo-preferences-02-safe-background-saves
Draft

Sheng Chen (jdneo) wants to merge 1 commit into
jdneo-preferences-01-nonblocking-loadingfrom
jdneo-preferences-02-safe-background-saves

Conversation

@jdneo

Copy link
Copy Markdown
Member

Stack

Layer 02 of the nonblocking preference work. Parent: #452.

Base: jdneo-preferences-01-nonblocking-loading at 450bb7814e20b8e8143ecd4c8aa6d40a05129d2a (not main). Do not merge independently of the stack.

Changes

  • Apply mode, model, reasoning/context options, confirmation settings, and input-history changes immediately through the shared preference owner; Realm observables and events do not wait for disk.
  • Return detached read snapshots and serialize stable account-bound revisions through one coalescing background writer. Only completed revisions clear dirty state; account changes and disposal cannot redirect writes or publish obsolete completion state.
  • Preserve current choices on save failure, with localized unsaved indication and explicit retry of the latest snapshot using the ready CLS path (no interaction-time persistence RPC).
  • Write complete same-directory owned temporary files and atomically replace the target. Unsupported atomic replacement and metadata/write failures propagate; there is no truncating fallback.

Approved POSIX protection clarification

Standard Java 17 cannot reliably inspect/preserve Linux extended POSIX ACLs. On POSIX filesystems without a supported ACL view, replacement therefore preserves the original owner/group identity and OWNER permission bits while removing GROUP/OTHERS access. This intentionally narrows group/ACL sharing, which may stop working; same-OS-user multi-instance last-completed-save behavior is retained. Full extended ACL preservation is not claimed. Supported Windows ACL preservation is unchanged, and inability to apply required protections fails without replacing the original target.

Automatic authentication/reconnection recovery and the bounded workbench shutdown flush belong to later stack layers and are not included.

Validation

All final commands passed with Java 21 and -Dtycho.disableP2Mirrors=true:

  • .\mvnw.cmd -B '-Dtycho.disableP2Mirrors=true' clean verify
  • .\mvnw.cmd -B '-Dtycho.disableP2Mirrors=true' checkstyle:check
  • .\mvnw.cmd -B '-Dtycho.disableP2Mirrors=true' test

Full verify: 10,800 tests, zero failures/errors, 8 POSIX-only tests skipped on Windows. SWTBot probe module skips by default; no probe execution is claimed. Tests cover real UI/event responsiveness under delayed saves, coalescing/in-flight revisions, failure/retry, history, account-transition publication, disposal, complete files, replacement failures and Windows ACL preservation.

Review

Parallel Standards/Spec review against the parent SHA: Standards reported no findings. Spec identified an auth-transition publication race (fixed with a reproduced regression) and the extended-ACL limitation (addressed by the explicitly approved conservative POSIX policy above).

Centralize revisioned account-bound snapshots and a coalescing serialized writer. Keep UI choices active after failures with localized retry, and atomically replace complete preference documents while preserving supported protections.

On POSIX filesystems without an ACL view, retain owner/group identity and owner permission bits while removing group/other access, as approved to prevent unverified extended ACLs from broadening access.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@jdneo
Sheng Chen (jdneo) added this pull request to stack #456 September 20, 2026 10:31
@jdneo Sheng Chen (jdneo) changed the title Keep chat preference changes immediate with safe background saves [2/4] Keep chat preference changes immediate with safe background saves Sep 20, 2026
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