Skip to content

[1/4] Load chat preferences without blocking Eclipse - #452

Draft
Sheng Chen (jdneo) wants to merge 4 commits into
mainfrom
jdneo-preferences-01-nonblocking-loading
Draft

Sheng Chen (jdneo) wants to merge 4 commits into
mainfrom
jdneo-preferences-01-nonblocking-loading

Conversation

@jdneo

@jdneo Sheng Chen (jdneo) commented Sep 20, 2026 •

Copy link
Copy Markdown
Member

Opening chat can block Eclipse's SWT thread while the Copilot Language Server resolves the preference path or saved preferences are read. This first layer addresses initial-loading responsiveness from #408 without changing the preference file location, representation, account association, or CLS persistence contract.

Scope and approach

  • Give ChatServiceManager one authoritative, lifecycle-owned PreferenceStorage, shared by actual mode/model preference consumers. Constructors and synchronous getters no longer wait for preference RPCs or file reads.
  • Restore preferences asynchronously with a 15-second logical deadline covering path resolution and reading. Publish successful restoration through the correct observable Realm; show localized loading, failure, and retry states while disabling only dependent controls.
  • Treat a definitely missing file as first-run defaults. Reject unreadable files, malformed/null JSON, invalid persistence responses, and RPC failures without overwriting existing files. Reject legacy Gson syntax extensions on older supported Eclipse targets.
  • Coalesce initialization/retry requests and reject obsolete results after timeout, account changes, or disposal. Preserve restored mode, model, history, confirmation, reasoning-effort, and context-window choices and existing policy behavior.
  • Remove a cold built-in-mode discovery wait that otherwise still blocked initialization. Preserve unresolved mode identity instead of silently sending Plan as Agent, refresh dependent controls after discovery, and provide independent manual mode-discovery failure/retry without reloading ready preferences.
  • Keep vision bindings observable during loading and handle unavailable/disposed models safely, including image-reference tooltips.

Review and regression coverage

Parallel Standards and Spec reviews were performed against b138f1a7cfec6aa293b6834bbe9fb5bf8e1f0235, including follow-up changes before commit. All in-scope findings were resolved. The known synchronous-saving limitation is intentionally assigned to layer 02.

Tests exercise real first-initialization entry points and the public storage lifecycle: incomplete authenticated RPCs with separately queued SWT actions, readiness/control states, controlled deadlines, restoration and file/RPC failures, coalesced retries, stale/account/disposal protection, both preference/mode-discovery completion orders, and manual discovery recovery preserving loaded choices. UI tests propagate SWT-thread failures back to JUnit rather than relying on workbench exception handling. Red-to-green failures were demonstrated for lost vision observation, unavailable-image-model dereference, and disposed-observable access.

Validation

Final committed code was validated on Windows using installed Java 21 (JAVA_HOME=C:\Users\sheche\.jdks\ms-21.0.11):

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

All three commands passed. The final clean build passed all 19 reactor modules and 10,767 tests: core 10,210, UI 553, and jobs 4, with zero failures, errors, or skipped tests in those suites. The targeted preference/initialization/image selection passed 87 tests. Tycho's executed suite evidence comes from verify; the test phase also completed successfully. git diff --check passed.

The SWTBot JSON-probe module skips execution by default. No JSON probe was authored or executed, and no probe coverage is claimed.

Bootstrap issues were resolved without tracked build changes: npm install --force --no-audit --no-fund in com.microsoft.copilot.eclipse.core\copilot-agent restored pinned CLS 1.541.0 assets; disabling Eclipse P2 mirrors avoided a stalled download; installed Java 21 avoided the pinned Mockito/Byte Buddy incompatibility with the default Java 25. No validation blocker remains.

Stack boundaries and follow-ups

This is layer 01 of 04, based on main. It delivers nonblocking loading, not the whole nonblocking-preferences specification.

  • 02: Immediate updates and serialized, atomic, retryable background saving. This layer preserves existing saving through shared state; synchronous mode/confirmation/sign-out/disposal saves and save-lock contention remain for that follow-up.
  • 03: Automatic preference recovery on authentication and actual CLS reconnection, preserving dirty choices and account isolation. This layer adds basic invalidation and manual recovery only.
  • 04: Best-effort asynchronous shutdown flush within a two-second budget.

No CLS CPU investigation, preference-format migration, cross-instance merging, or protocol change is included.

Sheng Chen (jdneo) and others added 2 commits September 20, 2026 14:59
…ation

Centralize account-scoped preference state in lifecycle-owned storage. Restore mode, model and history through guarded Realm publication; keep preference-dependent controls disabled until ready and show loading, failure and retry states.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Keep cold built-in mode discovery off SWT, preserve selected-mode identity until discovery completes, and expose independent manual recovery without reloading ready preferences. Restore model vision observation, guard disposed access, tolerate unavailable image models, and reject legacy Gson JSON extensions. Harden UI regressions so SWT failures reach JUnit.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI and others added 2 commits September 30, 2026 13:04
* Initial plan

* Consolidate built-in chat mode loading into manager

Co-authored-by: jdneo <6193897+jdneo@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: jdneo <6193897+jdneo@users.noreply.github.com>
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.

2 participants