fix(devtools): toggle stuck ON — persist enabled state bidirectionally - #489
Merged
Conversation
The developer tools toggle was stuck in the ON position because: 1. The default for developer.enabled was true (always showed ON) 2. Toggling OFF never persisted false to the store 3. Kobalte's controlled Switch always reflected the stale true value 4. Every click triggered onChange(false) but the visual never changed Fix: default to false, and persist both true/false so the controlled component reflects reality. The toggle now works bidirectionally: ON triggers rebuild, OFF restores marketplace and reloads.
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (7)
📝 WalkthroughWalkthroughDeveloper Tools now persists disabled state, restores the marketplace extension through uninstall and install commands, and records a one-time restore marker. Extension activation consumes the marker to bypass onboarding. Developer mode is disabled by default. ChangesDeveloper Tools restore flow
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant DeveloperToolsController
participant settings_developer
participant chat_bridge
participant VaultStore
participant VSCodeCLI
participant Window
DeveloperToolsController->>settings_developer: persist disabled value
DeveloperToolsController->>chat_bridge: send disabled update
chat_bridge->>VaultStore: write restore marker
chat_bridge->>VSCodeCLI: uninstall and install marketplace extension
VSCodeCLI-->>chat_bridge: complete reinstall callback
chat_bridge->>Window: reload window
sequenceDiagram
participant ExtensionActivation
participant VaultStore
participant OnboardingRouting
ExtensionActivation->>VaultStore: consume restore marker
VaultStore-->>ExtensionActivation: return marker presence
ExtensionActivation->>OnboardingRouting: evaluate onboarding eligibility
OnboardingRouting-->>ExtensionActivation: skip onboarding when marker exists
Suggested reviewers: ✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
…l on toggle OFF The old backup mechanism captured dist/ once and never refreshed it. When the extension was republished at the same version (e.g. 0.2.4 rebuilt with new features), the backup stayed stale and toggling OFF restored an ancient build missing webviews and the Developer Tools section entirely. Replace with uninstall+install from the marketplace on toggle OFF. This always gives a clean dist matching whatever the user is entitled to on the marketplace — never older, never stale. Onboarding state survives (stored at ~/.amico/, not in VS Code extension state).
…stall The uninstall+install cycle clears VS Code globalState, but the onboarding routing predicate checks a filesystem event at ~/.amico/amicode/onboarding/events.jsonl. Before uninstalling, ensureOnboardingCompleted() idempotently writes the completion marker so onboarding never re-triggers on a devtools mode switch. A manual uninstall+install by the user (outside the toggle) does NOT write this marker, so onboarding correctly re-triggers for fresh installs. Includes tests for the new ensureOnboardingCompleted function.
The previous approach wrote an onboarding_completed event to the permanent event stream. This polluted the onboarding state: a manual uninstall+reinstall would never re-trigger onboarding because the filesystem marker survived. Replace with a temporary .devtools-restore marker file: - Toggle OFF writes it before uninstalling - On next activation, consumeDevtoolsRestoreMarker() reads + deletes it - If present: skip onboarding (this was a devtools mode switch) - If absent: onboarding triggers normally (genuine fresh install) Manual uninstall by the user does not write this marker, so onboarding correctly re-triggers.
jeonghun-jj-lee
marked this pull request as ready for review
August 21, 2026 22:01
jeonghun-jj-lee
added a commit
to harmoniqs/opencode
that referenced
this pull request
Aug 21, 2026
…nally (#223) The developer tools toggle was stuck in the ON position because: 1. The default for developer.enabled was true (always showed ON) 2. Toggling OFF never persisted false to the store 3. Kobalte's controlled Switch always reflected the stale true value 4. Every click triggered onChange(false) but the visual never changed Fix: default to false, and persist both true/false so the controlled component reflects reality. The toggle now works bidirectionally: ON triggers rebuild, OFF restores marketplace and reloads. Companion: harmoniqs/amicode#489
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
The developer tools release ↔ dev toggle in Settings was non-functional. Clicking it did nothing visible — the switch stayed ON permanently.
Root Cause
A controlled-component + state-persistence mismatch:
defaultSettings.developer.enabledwastrue— the toggle always showed ONfalseto the SolidJS store (stale comment: "marketplace build doesn't render this section")<Switch checked={enabled()}/>always reflected the staletrueonChange(false)but since the signal never updated, the visual snapped back to ONsetEnabled(true), which autofills paths and triggers rebuild) was unreachable from the UIFix
developer.enabledtofalse(fresh installs show OFF, toggle can be turned ON)trueandfalseviasettings.developer.setEnabled(value)unconditionally — the controlled component now reflects realityThe toggle is now bidirectional: ON triggers a full rebuild, OFF restores the marketplace dist and reloads.
Companion PR
The same fix applied to the opencode
local/amicodebranch (where the app source lives for the running dev build).Summary by CodeRabbit