Skip to content

vscode: IDE-mode foundation: dual-mode activation, workspace/IDE context keys, empty-window surfaces #1144

Closed

Description

@amrmelsayed

Scope expanded 2026-07-06: originally filed as the no-workspace dead-actions bug (kept below as Part 1). Expanded to cover the full extension-side work for Codev IDE mode, because it's all one layer model touching the same files, and fixing Part 1 standalone would mean touching the same code twice. The Codev IDE fork tracks its own side (extension bundling pipeline, fork-side integration verification) on its own board; this issue is self-contained for everything in packages/vscode.

The underlying model

The extension currently has no concept of a workspace-free layer. Its features split into:

  • Tower-level (user-global, workspace-free): connection, status bar, Agents view (Tower state is global — ~/.agent-farm/global.db), dashboard, first-run, CLI walkthrough.
  • Workspace-level (need a folder): Workspace view, Spawn Builder, New Shell, Backlog/PRs, worktree ops.

Two context keys make the model explicit, and everything below hangs off them:

codev.hasWorkspace: false codev.hasWorkspace: true
guest (codev.ideMode: false) hide workspace-bound views; welcome: "Open a folder to use Codev" today's normal experience (unchanged)
IDE (codev.ideMode: true) empty-window surface: Open Folder / Open Recent / spawn-your-first-builder; Tower-level views live full experience

Part 1 — Workspace sidebar renders non-executable actions when no folder is open (original bug)

When VS Code is opened with no folder, the Codev sidebar still renders the Workspace section with fully-clickable Architects / Spawn Builder / New Shell rows. None are executable (no .codev/config.json, no spawn target); users get a false signal that Codev is ready to act on an implicit workspace.

Root cause: packages/vscode/src/views/workspace.ts:108-124 builds tree items unconditionally in getChildren; nothing gates on vscode.workspace.workspaceFolders?.length > 0.

Fix: view-level gate via when: "codev.hasWorkspace" in contributes.views (matches VS Code conventions — Source Control/Explorer show empty-view content, not dead actions), with viewsWelcome fallback content. Audit Backlog/PRs/Agents views for the same issue.

Part 2 — Dual-mode activation

One codebase, one artifact, two channels: the marketplace vsix, and the same file set baked into the Codev IDE fork as a built-in extension. The behavioral split happens at runtime:

  1. package.json: add "onStartupFinished" to activationEvents (keep both workspaceContains entries).
  2. Top of activate() (src/extension.ts:136): compute ideMode = vscode.env.appName === 'Codev' — the fork sets this via product.json nameLong. Pin the string as a named constant with a comment marking it a cross-repo contract with the fork's product.json: if either side changes it, IDE mode silently dies.
  3. Ordering is the whole risk: activate() currently constructs ConnectionManager immediately, which auto-starts Tower (connection-manager.ts, autoStartTower default true). Safe today because activation implies a codev workspace; with onStartupFinished it runs in every window of every marketplace install. The guest+no-codev-workspace path must remain exactly as dormant as if activation had never fired — no Tower process, no UI mutation, no state writes.
  4. setContext('codev.ideMode', …) + setContext('codev.hasWorkspace', …) (tracked on workspaceFolders changes).

Part 3 — IDE empty-window surface

When ideMode && !hasWorkspace: focus the Codev view container on startup (workbench.view.extension.codev), viewsWelcome content with Open Folder / Open Recent / "spawn your first builder" pointer; one-time first-run notification gated on globalState; the existing CLI-preflight walkthrough becomes the first-run path. (Home-tab webview is a v1 concept, out of scope here.)

Acceptance

  • No-workspace guest window: no dead actions anywhere (Part 1), regardless of how activation happened.
  • Marketplace inertness test: activation via onStartupFinished under a vanilla appName with no codev project is provably inert (no Tower spawn, no focus steal, no notifications).
  • IDE mode (simulatable in the Extension Development Host via appName override or a test seam): container focused, welcome content shown, first-run fires once.
  • Behavior matrix above covered by tests per quadrant.
  • Documented answer for the built-in-vs-marketplace-copy collision inside the IDE (a user-installed marketplace copy shadows the built-in).

Coordination

The fork consumes this work as a built vsix, unpacked into its extensions/ dir by script (extension build output is never committed to either repo). Start trigger: the fork's rebrand lands and locks nameLong: "Codev" — the codev-ide architect will ping when that's done; this issue then becomes the pre-agreed PIR builder's scope (agreed with codev main 2026-07-06).

Activity

  1. added
    area/vscode
    on Jul 6, 2026
  2. changed the title [-]vscode: Workspace sidebar renders non-executable actions when no folder is open[/-] [+]vscode: IDE-mode foundation — dual-mode activation, workspace/IDE context keys, empty-window surfaces[/+] on Jul 6, 2026
  3. changed the title [-]vscode: IDE-mode foundation — dual-mode activation, workspace/IDE context keys, empty-window surfaces[/-] [+]vscode: IDE-mode foundation: dual-mode activation, workspace/IDE context keys, empty-window surfaces[/+] on Jul 6, 2026
  4. self-assigned this
    on Jul 6, 2026
  5. amrmelsayed commented on Jul 7, 2026

    @amrmelsayed
    CollaboratorAuthor

    Fork-side findings from the rebrand implementation (2026-07-07) that update this issue's context — requirements structure unchanged, two deltas:

    1. Part 3 is now the product's ONLY first-run UX. The fork removes upstream 1.127's core onboarding wizard entirely and ships workbench.startupEditor defaulting to 'none' — a cold first launch is an empty window + the Codev container. The empty-window surface specced here isn't additive polish on top of core onboarding; it is the sole onboarding the IDE has. Treat its acceptance criteria accordingly.

    2. New hard constraint (empirically verified in the fork): extension-contributed configurationDefaults cannot deterministically gate any first-launch surface. Defaults register asynchronously and race whatever renders at startup (observed ~1-in-3 cold-launch leaks before the affected core surfaces were removed in code). Everything in Part 3 must therefore be runtime code (onStartupFinished handler → setContext → explicit container focus / welcome content), never a settings default. The fork currently carries a tiny built-in defaults extension for steady-state settings; if those defaults later migrate into codev-vscode, migrate steady-state values only — never anything a user sees on first launch.

    Confirmed current: the detection contract is vscode.env.appName === 'Codev' (locked in the fork's rebrand, now implemented). Trigger ping coming shortly — rebrand is at final gate checks.

  6. amrmelsayed commented on Jul 7, 2026

    @amrmelsayed
    CollaboratorAuthor

    On it! Working on this with the PIR protocol (plan + dev-approval gates before PR).

  7. added 10 commits that reference this issue on Jul 7, 2026
  8. added 2 commits that reference this issue on Jul 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area/vscode

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions