Skip to content

Commit 523f45b

Browse files
ndemiancclaude
andcommitted
fix: restore the Agents window — stop gating the de-brand on Setup.hidden
REGRESSION, shipped in v0.6.0 + v0.7.0. My B4 de-brand (#12) forced IChatEntitlementService.setForceHidden(true) to hide the "Sign in to use GitHub Copilot" call-to-actions. I read Setup.hidden as "the Copilot setup CTA gate". It is not — it is upstream's hide-ALL-chat/agent-UI flag, and forcing it also hid: - OPEN_AGENTS_WINDOW_PRECONDITION (chat/common/constants.ts) → "Open Agents Window" vanished from the Command Palette, making the whole Agents window (and the aquarium easter egg inside it) unreachable; - the Agent Plugins view + its menus/actions (agentPluginsView.ts ×6); - chat participants, createPluginAction, chatPluginActions, chatActions, agent-sessions experiments. Every other term of that precondition passes (chat.agent.enabled defaults true; the window/auxiliary checks pass in the main window) — Setup.hidden.negate() was the only failing term, so this was solely self-inflicted. Fix: - REMOVE the setForceHidden contribution → Setup.hidden returns to its default (false) and every surface above comes back. chat.shared.contribution.ts is pristine again and leaves the patch. - Hide the two CTAs at the MENU ITEM instead — `when: ContextKeyExpr.false()` on the Accounts-menu and title-bar entries (the same item-scoped pattern used for "Ask @VScode", which has no blast radius). Drops two imports that this orphans (strict build: TS6133). Patch stays at 11 files (chat.shared out, chatSetupContributions in). npm run compile-client → 0 errors. de-brand → 0 warnings. Known remainder: the chat STATUS-BAR dashboard still offers "Sign in to use GitHub Copilot" (chatStatusDashboard.ts) — it is created behind `!sentiment.hidden`, i.e. the same Setup.hidden flag, so hiding it needs a different, narrower gate. Tracked separately rather than re-breaking the window. Lesson recorded in docs/CORE-PATCHES.md row 11: never gate a de-brand on Setup.hidden — gate the item. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent ba4f454 commit 523f45b

2 files changed

Lines changed: 59 additions & 28 deletions

File tree

docs/CORE-PATCHES.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ git -C vscode diff HEAD -- \
3737
src/vs/workbench/contrib/welcomeWalkthrough/browser/walkThrough.contribution.ts \
3838
src/vs/workbench/contrib/welcomeOnboarding/browser/welcomeOnboarding.contribution.ts \
3939
src/vs/workbench/api/node/loopbackServer.ts \
40-
src/vs/workbench/contrib/chat/browser/chat.shared.contribution.ts \
40+
src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupContributions.ts \
4141
> patches/levelcode-core.patch
4242
# NOTE 1: use `diff HEAD` (not plain `diff`) — bootstrap's `git apply` may leave these STAGED,
4343
# and plain `git diff` shows only UNSTAGED changes, silently dropping the staged patches.
@@ -72,7 +72,7 @@ compile-client` after touching a core file.**
7272
| 8 | `welcomeWalkthrough/browser/walkThrough.contribution.ts` | **Remove** the "**Editor Playground**" action registration + Help item + their now-unused imports (`registerAction2`, `MenuRegistry`, `MenuId`, `EditorWalkThroughAction`). | De-brand (WS-C/M5). Its walkthrough is verbatim Microsoft VS Code content. Clean full removal (no leftover unused imports). |
7373
| 9 | `welcomeOnboarding/browser/welcomeOnboarding.contribution.ts` | Developer command **"Welcome Onboarding 2026"**`f1: false`. | De-brand (WS-A/B3). That command calls `onboardingService.show()`, which renders the verbatim **"Welcome to VS Code — Sign in to use GitHub Copilot"** modal. Patch #4 blocks it on *first run*; this hides the one remaining Command-Palette path to it. `f1:false` (not removal) keeps the action + its imports used. |
7474
| 10 | `api/node/loopbackServer.ts` (`getHtml`) | Replace the `this._appName === 'Visual Studio Code'` / `'… - Insiders'` branches (which embedded the VS Code stable/Insiders **shields**, falling through to the blue VS Code **"book"** default) with a single **LevelCode chevron** data-URI. | De-brand (WS-C/L5). A latent bug **and** a leak: `appName` is now "LevelCode" so no branch matched → every GitHub OAuth success page flashed a VS Code logo. `this._appName` is still used in the page text, so no unused-field error. |
75-
| 11 | `chat/browser/chat.shared.contribution.ts` | Add a `WorkbenchPhase.BlockRestore` contribution that calls `IChatEntitlementService.setForceHidden(true)`. | De-brand (WS-A/B4). `product.defaultChatAgent` is kept (assertDefined-d, ~15 files), which leaves `Setup.hidden=false` → a signed-out user sees "Sign in to use GitHub Copilot" CTAs in the Accounts menu, title bar, and Chat status. `setForceHidden(true)` flips **only** that gate — it does **not** disable AI/inline suggestions or suppress LevelCode's own AI-panel auto-open, unlike `chat.disableAIFeatures:true` (`layout.ts` first-run). No new imports (file already imports `registerWorkbenchContribution2` + `IChatEntitlementService`). |
75+
| 11 | `chat/browser/chatSetup/chatSetupContributions.ts` | **Hide** the two GitHub Copilot sign-in call-to-actions (Accounts menu + title bar) with `when: ContextKeyExpr.false()`, and drop the two imports that becomes unused (`ChatEntitlementContextKeys`, `InEditorZenModeContext` — strict build). | De-brand (WS-A/B4). A sign-in funnel for an extension we don't ship. **Gated per MENU ITEM on purpose.** The previous attempt forced `IChatEntitlementService.setForceHidden(true)` instead — but `Setup.hidden` is upstream's *hide-ALL-chat/agent-UI* flag, not a CTA gate: it also gates `OPEN_AGENTS_WINDOW_PRECONDITION` (constants.ts), the **Agent Plugins view**, chat participants and several chat/plugin actions. That shipped in v0.6.0–v0.7.0 and made **Open Agents Window disappear from the Command Palette**. Never gate a de-brand on `Setup.hidden`; gate the item. |
7676

7777
## String + link rebrands — `scripts/de-brand.mjs` (NOT in the patch)
7878

patches/levelcode-core.patch

Lines changed: 57 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -95,32 +95,63 @@ index 8251c4a4..d2da153b 100644
9595
});
9696

9797
// --- Actions Registration
98-
diff --git a/src/vs/workbench/contrib/chat/browser/chat.shared.contribution.ts b/src/vs/workbench/contrib/chat/browser/chat.shared.contribution.ts
99-
index 883dab9e..99861bde 100644
100-
--- a/src/vs/workbench/contrib/chat/browser/chat.shared.contribution.ts
101-
+++ b/src/vs/workbench/contrib/chat/browser/chat.shared.contribution.ts
102-
@@ -2440,6 +2440,21 @@ registerWorkbenchContribution2(ChatSlashCommandsContribution.ID, ChatSlashComman
103-
registerWorkbenchContribution2(ChatSessionOptionSlashCommandsContribution.ID, ChatSessionOptionSlashCommandsContribution, WorkbenchPhase.Eventually);
104-
105-
registerWorkbenchContribution2(ChatExtensionPointHandler.ID, ChatExtensionPointHandler, WorkbenchPhase.BlockStartup);
106-
+
107-
+// [LevelCode] Hide the GitHub Copilot sign-in call-to-actions. product.json keeps `defaultChatAgent`
108-
+// (it is assertDefined-d and consumed across ~15 core files, so it can't be removed), which leaves
109-
+// ChatEntitlement's Setup.hidden = false — so a signed-out user still sees "Sign in to use GitHub
110-
+// Copilot" in the Accounts menu, the title bar, and the Chat status dashboard: a dead funnel for an
111-
+// extension LevelCode does not ship. setForceHidden(true) flips ONLY that Setup.hidden gate. Unlike
112-
+// `chat.disableAIFeatures: true`, it does not disable AI/inline suggestions and does not suppress the
113-
+// secondary-sidebar auto-open where LevelCode's own AI panel lives (layout.ts first-run behaviour).
114-
+class LevelCodeHideCopilotSetupContribution implements IWorkbenchContribution {
115-
+ static readonly ID = 'workbench.contrib.levelcode.hideCopilotSetup';
116-
+ constructor(@IChatEntitlementService chatEntitlementService: IChatEntitlementService) {
117-
+ chatEntitlementService.setForceHidden(true);
118-
+ }
119-
+}
120-
+registerWorkbenchContribution2(LevelCodeHideCopilotSetupContribution.ID, LevelCodeHideCopilotSetupContribution, WorkbenchPhase.BlockRestore);
121-
registerWorkbenchContribution2(LanguageModelToolsExtensionPointHandler.ID, LanguageModelToolsExtensionPointHandler, WorkbenchPhase.BlockRestore);
122-
registerWorkbenchContribution2(ChatPromptFilesExtensionPointHandler.ID, ChatPromptFilesExtensionPointHandler, WorkbenchPhase.BlockRestore);
123-
registerWorkbenchContribution2(ChatCompatibilityNotifier.ID, ChatCompatibilityNotifier, WorkbenchPhase.Eventually);
98+
diff --git a/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupContributions.ts b/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupContributions.ts
99+
index ac91175c..883a7ed6 100644
100+
--- a/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupContributions.ts
101+
+++ b/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupContributions.ts
102+
@@ -38,13 +38,12 @@ import { ITelemetryService } from '../../../../../platform/telemetry/common/tele
103+
import { ToggleTitleBarConfigAction } from '../../../../browser/parts/titlebar/titlebarActions.js';
104+
import { IWorkbenchContribution } from '../../../../common/contributions.js';
105+
import { IViewDescriptorService, ViewContainerLocation } from '../../../../common/views.js';
106+
-import { ChatEntitlement, ChatEntitlementContext, ChatEntitlementContextKeys, ChatEntitlementRequests, ChatEntitlementService, IChatEntitlementService, isProUser } from '../../../../services/chat/common/chatEntitlementService.js';
107+
+import { ChatEntitlement, ChatEntitlementContext, ChatEntitlementRequests, ChatEntitlementService, IChatEntitlementService, isProUser } from '../../../../services/chat/common/chatEntitlementService.js';
108+
import { EnablementState, IWorkbenchExtensionEnablementService } from '../../../../services/extensionManagement/common/extensionManagement.js';
109+
import { ExtensionUrlHandlerOverrideRegistry, IExtensionUrlHandlerOverride } from '../../../../services/extensions/browser/extensionUrlHandler.js';
110+
import { IExtensionService } from '../../../../services/extensions/common/extensions.js';
111+
import { IHostService } from '../../../../services/host/browser/host.js';
112+
import { IWorkbenchLayoutService, Parts } from '../../../../services/layout/browser/layoutService.js';
113+
-import { InEditorZenModeContext } from '../../../../common/contextkeys.js';
114+
import { ILifecycleService } from '../../../../services/lifecycle/common/lifecycle.js';
115+
import { IPreferencesService } from '../../../../services/preferences/common/preferences.js';
116+
import { IExtension, IExtensionsWorkbenchService } from '../../../extensions/common/extensions.js';
117+
@@ -367,12 +366,10 @@ export class ChatSetupContribution extends Disposable implements IWorkbenchContr
118+
menu: {
119+
id: MenuId.AccountsContext,
120+
group: '2_copilot',
121+
- when: ContextKeyExpr.and(
122+
- ChatContextKeys.Setup.hidden.negate(),
123+
- ChatContextKeys.Setup.disabledInWorkspace.negate(),
124+
- ChatContextKeys.Setup.completed.negate(),
125+
- ChatContextKeys.Entitlement.signedOut
126+
- )
127+
+ // [LevelCode] Hidden: a GitHub Copilot sign-in funnel for an extension we do not ship. Gated on
128+
+ // THIS MENU ITEM, deliberately not via ChatEntitlement's Setup.hidden — that flag also gates the
129+
+ // Agents window, the Agent Plugins view and chat participants, and forcing it hid all of them.
130+
+ when: ContextKeyExpr.false()
131+
}
132+
});
133+
}
134+
@@ -399,16 +396,10 @@ export class ChatSetupContribution extends Disposable implements IWorkbenchContr
135+
menu: [{
136+
id: MenuId.TitleBarAdjacentCenter,
137+
order: 0, // same position as the update button
138+
- when: ContextKeyExpr.and(
139+
- IsWebContext.negate(),
140+
- ChatContextKeys.Entitlement.signedOut,
141+
- ChatEntitlementContextKeys.hasByokModels.negate(),
142+
- ChatContextKeys.Setup.hidden.negate(),
143+
- ChatContextKeys.Setup.disabledInWorkspace.negate(),
144+
- ContextKeyExpr.equals(`config.${ChatConfiguration.TitleBarSignInEnabled}`, true),
145+
- ContextKeyExpr.has('updateTitleBar').negate(),
146+
- InEditorZenModeContext.negate(),
147+
- ),
148+
+ // [LevelCode] Hidden: a GitHub Copilot sign-in funnel for an extension we do not ship. Gated on
149+
+ // THIS MENU ITEM, deliberately not via ChatEntitlement's Setup.hidden — that flag also gates the
150+
+ // Agents window, the Agent Plugins view and chat participants, and forcing it hid all of them.
151+
+ when: ContextKeyExpr.false(),
152+
}]
153+
});
154+
}
124155
diff --git a/src/vs/workbench/contrib/files/browser/files.contribution.ts b/src/vs/workbench/contrib/files/browser/files.contribution.ts
125156
index 574c2d8e..f6b8c7af 100644
126157
--- a/src/vs/workbench/contrib/files/browser/files.contribution.ts

0 commit comments

Comments
 (0)