fix(doctor): surface cached extension version when disconnected to detect version mismatch#1914
Open
hyyu189 wants to merge 1 commit into
Open
fix(doctor): surface cached extension version when disconnected to detect version mismatch#1914hyyu189 wants to merge 1 commit into
hyyu189 wants to merge 1 commit into
Conversation
When the Chrome Web Store auto-upgrades the extension but npm CLI stays pinned at an older version, the bridge silently breaks. `opencli doctor` shows only "extension not connected" with no indication of version mismatch. Changes: - update-check.ts: export getCachedExtensionVersion() to read the last-seen extension version from the daemon hello cache - doctor.ts: when the extension is disconnected, check the cached version and report a version-mismatch hint with a suggested fix (npm install -g + restart Chrome) The daemon already records currentExtensionVersion on every successful WebSocket handshake; this change just exposes that information in the doctor report when the extension goes missing.
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.
Problem
When the Chrome Web Store auto-upgrades the extension but the npm CLI stays pinned at an older version, the bridge silently breaks.
opencli doctorshows only "extension not connected" with no indication of a version mismatch — the user (and automated agents) have no way to diagnose the root cause.Repro
opencli doctor→Extension: not connected(silent)COOKIE/INTERCEPT/UIadapters fail withextension not connectedThe existing compat-range check (lines 168-185 in doctor.ts) correctly detects protocol mismatches when the extension IS connected, but it never runs when the extension is disconnected.
Fix
Two minimal changes:
update-check.ts: ExportgetCachedExtensionVersion()to readcurrentExtensionVersionfrom the daemon's shared cache. The daemon already writes this on every successful WebSocket handshake viarecordExtensionVersion()— we just weren't reading it in the doctor path.doctor.ts: When the extension is disconnected (daemonRunning && !extensionConnected), check the cached extension version. If found, append a version-mismatch hint to the issues list, suggestingnpm install -g+ restart Chrome.Example output (before → after)
Before:
After:
Testing
All existing tests pass:
src/doctor.test.ts— 17/17npm test --project unit— 1175 passed, 1 skipped