Repository navigation
Conversation
Drop the onStartupFinished activation event so opening a window where Amicode isn't used no longer activates the extension, and so no longer spawns or adopts the opencode server. Activation now happens on first use: any contributed command (implicit onCommand, engine ^1.95), opening the AMICODE view (onView), or a restored fleet-client amico-host:/ folder (new onFileSystem:amico-host event, which VS Code never generates implicitly). Once activated, activate() runs unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
jacktrnr
marked this pull request as ready for review
November 23, 2026 22:21
Contributor
Author
|
Verified hands-on in the combined 0.4.1-beta test build ( |
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.
Closes #1572
Problem
onStartupFinishedactivated the extension on every VS Code/Cursor window, andactivate()always brings up (spawns or adopts) the opencode server. So a window where you weren't using Amicode still started a server.amicode.chat.autoOpenonly controls the chat panel, not the server.Approach: lazy activation (manifest-only)
onStartupFinishedfromactivationEvents.onFileSystem:amico-host, so a restored fleet-client window with theamico-host:/Host folder (Fleet client: native Explorer shows host files via an amico-host:// FileSystemProvider (with honest capability label) #1267) still activates the extension and registers its FileSystemProvider. VS Code never generates this event implicitly, andonStartupFinishedused to cover it.Activation now happens on first use:
engines.vscodeis^1.95, so VS Code generatesonCommand:<id>for every contributed command. The existing explicitonCommandentries stay.onView:amicode.workspace). If the sidebar was visible when the window was last closed, it activates at startup. That is the user actively using Amicode.amico-host:/folder (onFileSystem:amico-host).After activation,
activate()runs exactly as before. Server bring-up,chat.autoOpen, and the stale-port and handshake handling (#2012, #1420) are untouched.Why this rather than gating on
chat.autoOpen(the closed #1575 approach)activate()in a deferred closure, then addingensureLocalServer()and wait-for-ready calls to every server-dependent entry point (openChat, newChat, chatDeck, bindToEnvironment, newProject, newEnvironment, sidebar launches, restartServer, and others). fix(extension): gate eager server start on chat.autoOpen (#1572) #1575 itself leftnewProjectandnewEnvironmentuncovered.activate(), so there is no risk to the adopt/spawn, keepalive, stale-port, or handshake ordering.chat.autoOpendefaults totrue, so gating on it would still spawn a server in every window for most users.Behavior change: with
chat.autoOpen=true, chat no longer opens by itself in a fresh window where the Amicode sidebar was not visible. It opens the first time the user engages Amicode, through the sidebar or a command. This is the intent of #1572.Tests
New file
packages/extension/test/lazy_activation_1572.test.tsfollows the existing pattern of asserting against the manifest (sidebar_view.test.ts).onStartupFinishedor*). Written first and failed (RED), then passed (GREEN).onFileSystem:amico-hostis declared, usingHOST_SCHEMEfrommount_policy. Written first and failed (RED), then passed (GREEN).mainand fail if a later change breaks lazy activation:onCommandandonViewevents are generated;enablementorwhenclause depends on a context key thatactivate()sets.Results:
pnpm --filter amicode run typecheck: clean.pnpm --filter amicode test: 346 files passed, 2 skipped; 5,820 tests passed, 60 skipped; 0 failures.Unrelated issue found (not fixed here)
amicode.savePulseis contributed inpackage.json, but nothing insrcregisters it, so running it fails with "command not found". This was already true with eager activation and is out of scope here.Manual check (not run yet)
🤖 Generated with Claude Code