Skip to content

[Spec 1963] VS Code alternative layout: Codev Cockpit - #1971

Merged
waleedkadous merged 143 commits into
mainfrom
builder/spir-1963
Nov 25, 2026
Merged

waleedkadous merged 143 commits into
mainfrom
builder/spir-1963

Conversation

@waleedkadous

@waleedkadous waleedkadous commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Plan phases 1–9 of 9 and the review are done, and so is the PR review phase: owner ruling ide-3 and the final runs. The pr gate is pending: the owner's review.

History was rewritten on 2026-11-24 at the owner's direction to remove verification binaries; SHAs in earlier comments predate it.

Final head a5295bc8b:

  • Rendered on the final code, every check indexed with a permalink in verification.md (evidence commit 8b7def1ed):
    • VS Code 1.147.0 serve-web: 115/115, every verify script;
    • Codev IDE 1.138.0's server, fenced: 53/56. The three failures are webviews outside this PR that the IDE leaves blank (below);
    • VS Code Server 1.128.0, the engine floor, fenced: 50/50.
  • Two run heads. The scripts that render the Work or Decisions panel ran on d31df3a84 (vsix built at 7cdc24716); the nine that render none ran on 35334efbf (vsix built at 4ab7ed1d4). In each pair, the commit between build and head changes only the harness. Between the two heads the vsix inputs changed only in vscode-theme.css and its test, and a5295bc8b adds only documents.
  • GitHub CI passes all eight checks on this head (Tests, CLI Integration Tests).
  • Windows run 45516686696 succeeded on this head: unit tests, CLI tests, install verification, and both probes (windows-latest, windows-11-arm).

Since the previous final head, 513bbd910, the branch gained:

Closes #1963

Spec: codev/specs/1963-vscode-alternative-layout-seco.md. Plan: codev/plans/1963-vscode-alternative-layout-seco.md. Review: codev/reviews/1963-vscode-alternative-layout-seco.md.

Screenshots

The rendered evidence (screenshots, results JSON, the layout spike's screenshots) lives on the branch evidence/spir-1963, which is never merged. Every check of the final runs is indexed, with its pass count and a permalink, in verification.md. The shots below are from those runs on VS Code 1.147.0 unless they say otherwise.

The Cockpit button, directly below Codev (verify render), and the arranged Cockpit (verify arrange): main on the left, Work over Decisions on the right with a pending decision, in Light Modern:

The Cockpit button below Codev in the activity bar The arranged Cockpit in Light Modern

The same split in Dark Modern, and the Cockpit hierarchy (two, one and no builders, and the Dormant group) in the light theme:

The arranged Cockpit in Dark Modern The Cockpit hierarchy, light

The Work panel (verify work) and the Decisions panel (verify decisions):

The Work panel The Decisions panel

The same split on Codev IDE 1.138.0 and on VS Code Server 1.128.0, both fenced:

The arranged Cockpit on Codev IDE 1.138.0 The arranged Cockpit on VS Code Server 1.128.0

The hierarchy in the dark theme, and every other screenshot, are linked from verification.md. The per-phase sections below describe each phase's own run and link it at 51e2bbf17, in the evidence branch's history; their counts were per phase, and the final runs replace them.

Why it was opened early

At the end of Phase 4 (cockpit_hierarchy, 18f10db34), porch done's local tests check failed without naming a test. Under the builder's standing order, the branch was pushed and this draft opened, so CI could name the failure.

  • GitHub CI was green on 43f34f0f, and bugfix-1267-launch-loop.test.ts passed alone, 7/7.
  • The architect relayed a one-time skip of the local tests check for that one porch done. It was removed straight afterwards.
  • The Phase 4 iteration-2 and Phase 6 porch done runs passed the full local suite with no skip.

Done so far

  1. verification_harness: an isolated Tower plus serve-web harness, with pre-flight gates and a tripwire.
  2. fleet_overviews: the fleet cache keeps each active workspace's overview.
  3. architect_tree_builder: a reusable, workspace-scoped ArchitectTreeBuilder behind the Agents view.
  4. cockpit_hierarchy: the Codev Cockpit activity-bar button and its tree, Tower → workspaces → architects → builders.
    • This window's workspace acts.
    • Every other workspace navigates to its own window.
  5. cockpit_actions: the row actions.
    • Builder rows carry the Agents view's full right-click menu and the inline Approve Gate.
    • The current workspace row carries inline Spawn Builder, New Shell and Add Architect. Its menu adds Open Web Interface, Start Dev or Stop Dev, and Open Dev URL….
    • A sibling architect carries Remove Architect.
    • In a builder-worktree window, the parent row offers only the worktree-scoped dev actions.
    • A checked-in menu oracle (views/cockpit-menu-map.ts) and its parity test fail on any source-view menu entry the Cockpit does not place.
  6. workspace_views_package: a new private package, @cluesmith/codev-workspace-views (packages/workspace-views).
    • It holds the Work and Decisions views, the useDecisions polling hook and the issue-key grammar, each once.
    • The dashboard keeps thin wrappers with the same names and props. It renders and behaves unchanged (spec scenario 20): the rendered DOM and computed-style snapshot, 221 elements, and all four screenshots are byte-identical to a run on the branch base's build (verification-phase6/).
  7. decisions_panel: the Decisions panel in VS Code, and a Decisions entry under every active workspace in the Cockpit. Details below.
  8. work_panel: the Work panel in VS Code, fed from the overview cache. Increment 2 (the Cockpit's Decisions entries beside both panels) is verified rendered. Details below.
  9. arrange_cockpit: Arrange Cockpit, the main architect | (Work over Decisions), on demand and on the first Cockpit show per window. Increment 3 is verified rendered. Details below.

Deviations and behaviour changes for the owner

  • Spec deviation: a dormant window does not list the fleet. A dormant window is the
    marketplace extension in plain VS Code, in a folder without Codev. The spec's no-workspace
    criterion asks every workspace's rows to navigate there. In this window the Cockpit shows Not
    connected to Tower
    instead, with the reason and an Open Folder action, and never connects.
  • Existing behaviour change: the Codev button's badge during a Tower outage. The activity-bar
    badge now repaints on every connection-state change. During an outage it clears, rather than
    keeping the last count as it did before. This applies to the existing Codev button as well as the
    Cockpit's. Before, nothing repainted it on a disconnect, because the overview cache keeps its data
    and emits nothing then.
  • Agent cycle (ctrl+alt+n / ctrl+alt+p): while the Cockpit is visible and the Agents view
    is not, the cycle runs in the Cockpit's visible order for this window's workspace (architects and
    their builders). Otherwise the existing Agents order applies unchanged (architect ruling (b)). A
    Cockpit with no acting rows, such as in a builder-worktree window, also keeps the Agents order.
  • Small changes to existing commands (Phase 5):
    • codev.spawnBuilder and codev.newShell gain icons ($(rocket), $(terminal-new)), because
      inline actions need one. Their titles are unchanged.
    • codev.openDevUrl opens directly only for a non-empty string argument. A row argument now
      falls through to the URL picker instead of being treated as a URL.
    • The command-argument helpers moved from extension.ts to commands/command-args.ts, so a test
      can drive each handler with a Cockpit row. extractIssueId also now checks that the id is a
      string.

Adjacent fix: Spawn Builder spawned in the wrong directory

Found by the harness's recording stub, and fixed in this PR because it is small and the Cockpit
offers the same command.

  • The bug. codev.spawnBuilder ran afx spawn with no cwd, so in the extension host's own
    directory. afx spawn resolves its workspace from its cwd.
    • In the Codev IDE that directory is Tower's, so a window could spawn a builder into whichever
      project Tower was started in.
    • Where that directory is no project, it fails.
    • It affected every entry point: the Workspace view, the palette, the Backlog row, and now the
      Cockpit.
  • The fix. It now runs in this window's Tower workspace (detectWorkspacePath(), the parent
    workspace in a builder-worktree window), the cwd Run Worktree Setup and Approve Gate already use.
    Without a workspace it shows an error instead of prompting.
  • Tests: spawn-builder-not-found.test.ts asserts the cwd, and that the command refuses without
    a workspace.

Note on Approve Gate

The plan says the Cockpit's Approve Gate is "verified through the stubs as porch approve". Since
#1494 the button relays the decision to the builder's spawning architect through Tower's
/api/send, and runs porch approve itself only when no architect is live. The harness check
asserts what happens, for #101 (spawned by main, which is live): one POST /api/send, no porch
call, and the "sent … to main" notification. This is unchanged behaviour from the Agents row.

Phase 6: the shared package's host contract

  • Two host interfaces, WorkViewHost and DecisionsViewHost, rather than the plan's single WorkspaceViewsHost. Each view takes only what it uses.
  • overview is a value (OverviewState | null, where null means loading), not a subscription. Each host owns its own polling.
  • Every Work action is optional, and its control renders only when the host provides it. openBuilder takes the builder, not an id, because the dashboard's tab lookup needs more than the id. showImage takes {src, alt}.
  • Links. openExternal is optional on both views. Without it (the dashboard) links stay native anchors, as before. With it (VS Code) they go to the host, which opens only http(s). This also stops VS Code's webview script opening a clicked anchor itself, which would bypass the allowlist.
  • Styles. Every colour, font and (since Phase 8) font size in the package's styles.css is a --codev-wv-* token whose default is the dashboard's value. Tests forbid literal colours and literal pixel font sizes.
  • The dashboard passes its /api/state architect count. The spec accepts the live count for VS Code only.

Phase 7: the Decisions panel

What it is.

  • Codev: Open Decisions, or the Cockpit's Decisions entry, opens one editor-area panel. It shows the shared Decisions view for this window's workspace.
  • Opening it again reveals the same panel.
  • A window reload restores it (WebviewPanelSerializer, with onWebviewPanel:codev.decisions).
  • In a builder-worktree or no-workspace window the command explains why it is not offered. There, the Cockpit entry navigates to the workspace's own window, as other rows do.

Every Tower call is the extension host's.

  • The webview posts requests (read, rule, image) with a requestId; the host answers them through new SDK methods: getDecisions, ruleDecision, getDecisionImage.
  • A refusal keeps its code and message. Image bytes come through a new binary request.
  • The webview has no connect-src in its CSP: default-src 'none', nonce-only scripts, img-src limited to the bundle, blob: and http(s).
  • Its code has no fetch, XHR, WebSocket, EventSource or beacon. An ESLint rule enforces this while editing, and a source test enforces it in CI.
  • The host validates every webview message.
  • External links open only for http(s).
  • Paths use canonical containment (realpath, then path.relative), with path.win32 table tests.
  • A host test drives a real TowerClient through the panel and asserts that the key, the Tower URL and the port appear in no message posted to the webview.

Polling has one owner, the shared hook (2 s). The host relays the panel's own visibility. A retained, hidden webview still reports its page as visible, so without the relay a hidden panel would keep polling.

Theme. vscode-theme.css maps all 28 --codev-wv-* tokens to VS Code theme variables. A test holds it to the package's token list.

  • Each token is chosen for how it is drawn, and a rendered check measures the result (below).
  • The accent is VS Code's link colour, and text on accent fills is the editor background. VS Code's button background cannot be the accent: high-contrast themes make it black, and the accent is also text on the page.
  • Muted text uses VS Code's placeholder grey, not its disabled-control colour.
  • Waiting and error text use VS Code's list warning and error colours, which are made for text. High-contrast themes, which leave those unset, fall back to the chart yellow and the error foreground.

Rendered verification (isolated harness, VS Code 1.147.0 serve-web, verify decisions): 15/15, evidence in verification-phase7/.

Check Result
Cockpit entries Decisions under alpha, beta and gamma (beta and gamma have no file), none under dormant delta. Beta's entry opens beta's window. Alpha's opens one panel; a second click reveals it
Images The workspace SVG renders from a blob: URL: image bytes survive webview.postMessage. The https image renders. A remote image answered 404 and an image outside the workspace each show Image not loaded, with the browser's or Tower's reason. The full-size view opens; Escape and Close close it
Link Opens through the host, after VS Code's own open external website? prompt
Ruling (scenario 15) The file is updated, the card shows the ruling, and Tower notifies main. The notice is held: the fixture architect is a shell, not an agent
Stale fingerprint Refused (Item main-2 changed since it was shown…), with the draft and word kept
Polling (scenario 21) 3 reads in 6 s shown, 0 in 8 s hidden, and reads resume when shown again
Themes (scenario 18) Dark, Dark HC, Light HC and Light, switched live: the webview never reloads and the draft is kept. The contrast of every visible text in the panel (62) is measured against its composited background. The lowest text is 5.5 (Dark), 6.6 (Dark HC), 5.5 (Light HC) and 4.1 (Light). Under 4.5, only in Light: the section labels at 4.3 (VS Code's placeholder grey) and the Recommended badge at 4.1
Reload The panel is restored
Windows (scenario 19) The explanations in a worktree window and a no-workspace window
Empty state (scenario 16) Gamma shows There is no decisions file … run afx decisions init. The real afx decisions init gives 0 open, then an added item appears
Network (scenario 22) 205 browser requests: none to the Tower port, none carrying the key. Webview frames loaded only extension resources and the remote item image

Bugs in this phase's own code found by the harness and the reviews, all fixed here:

  • A restored panel was closed, because availability was read before the connection manager had initialized. It now comes from the window's folders.
  • High contrast hid the item ids, because the accent was mapped to the button background.
  • A remote image the browser refused stayed a broken image, not Image not loaded (Codex).
    • The fix is in the shared view, so the dashboard gains the note too. That is the spec's stated behaviour.
    • The Phase 6 snapshot is unaffected: its fixture has no remote image.
  • The option words were invisible in Light High Contrast (Claude).
    • VS Code's webview colours every code, and the option word paints its own background. It now sets color: inherit, which is a no-op in the dashboard.
    • Measuring every text then found three more wrong colour mappings: muted, error and waiting text, at 2.1 to 2.9:1 in Light Modern.

Review: Codex REQUEST_CHANGES, then APPROVE; Claude APPROVE twice. The responses are in 1963-decisions_panel-iter1-rebuttals.md.

Windows. The containment tests also run on real Windows paths, with a directory junction escaping the workspace. The workflow's unit job gained a step for them.

Small adjacent change: .vscodeignore drops **/tsconfig.*.json. The vsix had been shipping tsconfig.webview.json.

Phase 8: the Work panel

What it is.

  • Codev: Open Work opens one editor-area panel with the shared Work view for this window's workspace: Builders, Needs Attention, Backlog and Recently Closed.
  • Opening it again reveals the same panel, and a window reload restores it (onWebviewPanel:codev.work).
  • In a builder-worktree or no-workspace window the command explains why it is not offered, using the same rules as Decisions.
  • The dashboard-only pieces are not rendered: the file panel, the tip of the day, and Open Files & Shells.

Data. The host pushes the OverviewCache and the connection state. The webview makes no Tower call (scenario 22: 256 browser requests, none to the Tower port, none keyed).

  • Before the first overview the panel shows Loading….
  • While not connected, the last overview stays under Not connected to Tower.
  • With no overview yet, each section shows Loading… under that notice (see the adjacent fix below).
  • The panel counts toward the periodic overview refresh: the refresh runs with only Work visible, and stops when it is hidden or closed.

Actions, each mapped in the host:

Action What the host does
Open openBuilderByRoleOrId, only for a builder in the current overview
+ Shell codev.newShell
Refresh POST /api/overview/refresh, then the cache's own read
spec / plan / review Open the workspace file, containment-checked; a refusal or a missing file warns
issue / PR links Open in the browser, http(s) only

A builder decision: single-panel.ts now holds what Work and Decisions share: the single instance, the serializer, reveal, observable visibility, dropping posts after close, the http(s) gate, and logging a handler that rejects. DecisionsPanels moved onto it, with its tests unchanged. Phase 9 needs both panels to take a view column, and this gives it one place to add that.

Wiring test: cockpit-wiring.test.ts pinned the refresh gate's view list. It now includes the Work panel; the guarded behaviour is unchanged.

What rendering found, all fixed here (VS Code only unless said):

  • Implementing orange (a PIR dev-approval row) measured 2.9:1 on Light Modern's white. It is now mixed from the error and waiting text colours, and measures 6.7 to 11.3:1.
  • Progress track: in Light Modern it was the row's own colour, so a bar read as a dash. It is now a faint mix of the text colour.
  • Half-width group (about 470 px, Work's width beside Decisions and in Phase 9's split):
    • The Open buttons were cut off, and backlog labels ran over their links.
    • Secondary columns and labels now go first: Elapsed and the labels under 760 px, Progress under 600 px.
    • Under 600 px each builder row is two lines: issue, title and Open on the first, the state under the title. A typical 44-character title shows 42 characters.
  • Type scale: the panels read larger than the 13px workbench. Font sizes are now a --codev-wv-font-size-* scale (defaults the dashboard's px), and VS Code maps it to --vscode-font-size. Both panel headings are one size.
  • Decisions' no-file state drew as the amber notice, which reads as a warning. A decisions-notice--no-file modifier lets VS Code draw it as plain description text; the dashboard keeps its look.
  • Shots are taken with the pointer parked, after any hover tooltip has closed.

Adjacent fix, shared view (the dashboard changes too):

  • The bug. An error with no overview yet rendered No active builders, Nothing needs attention and No open issues under the error, claiming an empty workspace. In VS Code that is "not connected before any data" (Codex). In the dashboard it is a failed first overview read.
  • The fix. Each section now says Loading… under the error.
  • Unchanged. A dashboard first read still in flight (no error) keeps its empty sections, as before.

The dashboard is otherwise unchanged (scenario 20):

  • The method is the Phase 6 one. verify dashboard ran on the pre-change build, and its snapshot was kept. packages/codev was then rebuilt with the type scale and the loading fix.
  • All 138 Work and 83 Decisions elements are identical in computed style and DOM (verification-phase8/dashboard/).

Rendered verification (verify work 14/14, verify decisions 15/15 re-run after the shared-base move, verify dashboard 6/6). Evidence is in verification-phase8/:

Check Result
Panel (scenario 17) All four sections and alpha's rows, with only the mapped buttons. A second Open Work reveals the same tab
Progress bar Drawn at its width under the panel's CSP: 16 of 80 px at 20%
Actions Open opens #102's terminal. + Shell opens a Tower shell. Refresh sends the POST, then reads. A spec link opens the file. An issue link and a PR link open after VS Code's prompt
Themes (scenario 18) Four themes, switched live without a webview reload. Every visible text is measured, and none is under 3:1. Under 4.5:1, Light Modern only: .attention-row-age and .recently-closed-check at 4.3
Increment 2 The Cockpit's Decisions entries under alpha, beta and gamma, with Decisions and Work side by side in two groups, dark and light. The half-width fit is checked
Tower down (scenario 19) Both panels keep their content under Not connected to Tower, with no error toast. Both recover when Tower is back
Windows (scenario 19) The explanations in a builder-worktree window and a no-workspace window
Reload The panel is restored

Review: Codex REQUEST_CHANGES (the loading state above), then APPROVE. Claude APPROVE twice. I took its notes: a rejected webview handler is logged, an artifact refusal after close shows no toast, and an unused class is gone. Responses are in 1963-work_panel-iter1-rebuttals.md.

For the owner:

  • The not-connected notice reads Failed to load overview: Not connected to Tower. That is the dashboard's template, kept for parity. A host-supplied notice could reword it in VS Code only.
  • Two Light Modern texts sit at 4.3:1: a Needs Attention row's age (VS Code's placeholder grey) and Recently Closed's ✓ (the chart green). Both are above the 3:1 floor and below 4.5.

Phase 9: Arrange Cockpit

What it is.

  • Codev: Arrange Cockpit (palette, and the Cockpit's title bar) arranges the editor area: the main architect's terminal on the left, Work over Decisions on the right, each the active tab in its group.
  • Nothing is closed. The user's editors, dirty and untitled ones included, stay open, possibly in another group. An open architect terminal or panel is the same one, moved; no webview reloads, so a Decisions draft survives.
  • Automatic once per window: the first time the Cockpit is shown in a window, it arranges (codev.cockpit.autoArrange, default on). It waits for the window's first connection attempt, so a reload with the Cockpit showing still finds the architect.
  • A one-time notice follows the first automatic arrange (per profile). Its Don't arrange automatically turns the setting off at the user level; dismissing it changes nothing; a manual arrange never shows it.
  • Always main: through openResolvedArchitect (vscode: open-architect silently substitutes architects[0] for a non-live 'main', strips the disambiguating label, and captures the text-injection path #1497). A non-live main gets the existing warning, nothing is substituted, and the right side is still arranged. This path opens the architect in the editor area even with codev.terminalPosition: panel; every other path keeps honouring the setting.
  • In a builder-worktree or no-workspace window the command explains why it is not offered, and the title-bar entry is hidden.
  • Another terminal with the architect's name (a renamed one, say): arrange stops before moving any editor and asks for it to be renamed or closed. The tab API gives a terminal tab no identity, only its label, so the label must be unambiguous (from the codex review). A namesake VS Code is still closing (the terminal manager disposes a stale-session architect and reopens it under the same name) first gets the 5 s settle bound to go (from the claude review, iteration 2).
  • Tower down at the automatic arrange: the architect is skipped and the reason logged, with no error toast; the command keeps its toast (from the claude review).

How (cockpit/arrange.ts, on the layout spike). Moving a group's only editor closes the group and renumbers the groups after it, so the architect, Work and Decisions are placed in column order before vscode.setEditorLayout is applied. With no architect placed and only the Cockpit's panels in the first group, an empty group is opened to their left first, so the left column stays; the panels are counted by tab, so a restored tab not yet revived counts too (from the claude review, iteration 2). Every move is awaited against the tab model with a 5 s bound; a move that does not happen stops the arrange with an error naming it, and arrange never acts on an editor it has not confirmed.

What rendering found, fixed here:

  • Preview tabs. WebviewPanel.reveal(column) into another group lands the panel there as a preview tab (1.147.0's revealWebview does not pin; createWebviewPanel does). The next file opened in that group would have replaced it, closing the panel and its draft. Arrange now keeps a panel left as a preview (workbench.action.keepEditor, with the panel focused and confirmed active first).
  • A second Work panel after a reload (adjacent, Phase 7/8 code). VS Code revives a restored webview only when its tab is shown, so opening Work or Decisions before that created a second panel beside the restored tab. show() now opens the live panel in the restored tab's group (or the arrange placement) and then closes the restored tab, so there is only ever one. This also fixes Open Work / Open Decisions after a reload.

Other adjacent changes:

  • The availability text now says "Use it from the parent workspace's window" (it read wrong for a command); Work's and Decisions' wording changes with it.
  • readArchitectRoster is shared by Open Architect Terminal and arrange (moved out of the command, unchanged behaviour).
  • The menu-parity oracle (views/cockpit-menu-map.ts) has a fifth record kind, for menu entries that are the Cockpit's own (the title-bar Arrange Cockpit).

Rendered in the review phase (at the architect's direction): the namesake refusal, the automatic arrange with Tower down, and the empty-left-column branch had been unit-tested only. Each now has a verify arrange check, in the last three rows below. The waited-out closing namesake stays unit-tested: it is a race inside the extension host that the UI cannot time.

Screenshot privacy (review phase). VS Code opens a local shell in a visible terminal panel by itself. The harness HOME had no bash profile, so macOS's prompt host:dir user$ showed in 12 committed screenshots. The architect ruled:

  • start now writes PS1='$ ' into the harness HOME.
  • Every verify run ends with a check that OCRs its screenshots (tesseract) and fails on such a prompt. Over the 110 previously committed shots, it flagged exactly those 12.
  • The two in verification-phase9/ are gone with the rest of that folder's refresh.
  • The ten in verification-increment1/ (actions-*, reconnect-*) were replaced by runs on the final code.
  • The old files remain in this branch's history. No rewrite: that is the owner's call.

Rendered verification (isolated harness, VS Code 1.147.0 serve-web): verify arrange 19/19, the prompt check included, profile-seed 1/1, profile-existing 1/1 (at 2323785a6; the review phase's commits do not touch the activity bar). Evidence in verification-phase9/:

Check Result
First show (scenarios 7, 9) Over four groups holding two dirty files, a clean file and two untitled buffers: main | (Work over Decisions), each active in its group
Editors survive (scenario 13) Every editor is still open with its unsaved content (the dirty files and both untitled buffers read back). No new Tower terminal: the architect is the live session
Notice (scenario 7) Shown once, with Don't arrange automatically; dismissing it changes nothing
Re-run (scenario 13) From the title bar, then the palette: the groups do not change, neither webview reloads, a typed Decisions draft persists, no notice
The split, with a pending decision Light Modern and Dark Modern
Work's width in the split (architect, 14:00Z) 473 px: a typical 44-character title shows 42 characters (20+ required), no sideways scroll, each state on one line
Later shows Showing the Cockpit again leaves a collapsed layout alone; the command arranges it
Architect in the panel Brought back to the left group: the same session
Reload The restored Cockpit arranges again, the architect reopened on the left, one Work and one Decisions tab, neither a preview, no notice
main not live (scenario 14) The existing warning; no architect opened; Work and Decisions still arranged
Setting off (second fresh profile) Don't arrange automatically writes "codev.cockpit.autoArrange": false to user settings; a reload with the Cockpit showing does not arrange; the command still does
Windows (scenario 19) Builder-worktree and no-workspace windows: no arrange, no title-bar entry, the command explains
Activity bar, fresh profile The Cockpit button directly below Codev
Activity bar, existing profile A profile that used Codev before the Cockpit existed (seeded on an install whose activity bar is origin/main's, then loaded on this branch's): the Cockpit button is also directly below Codev. No caveat is needed
Namesake terminal (codex review) A panel shell renamed Codev: Architect: arrange stops with another terminal is also named "Codev: Architect"… before moving an editor. Once that shell is closed, it arranges, with no new Tower terminal
Tower down at the automatic arrange (claude review) A third fresh profile, the isolated Tower stopped, reloaded with the Cockpit showing: Work over Decisions, the architect skipped, no error toast
A restored, never-shown panel tab (claude review) Only Work and Decisions in one group, reloaded with the Cockpit hidden so that Work is restored but never shown. Arrange Cockpit keeps an empty left column with Work over Decisions, and says Not connected to Tower
No machine shell prompt Every screenshot of the run is read with OCR, and none shows a host:dir user$ prompt

Note on the layout spike

The layout spike, recorded in the plan, ran on VS Code 1.147.0. The extension's engine floor is 1.128.

VS Code 1.138.0 and 1.128.0

The integration review asked for the split to be verified on the owner's Codev IDE server (1.138.0) and on the engine floor (1.128). Both ran fenced, on the final code: the scripts that render the panels (arrange, work, decisions, and on 1.138.0 the webviews diagnostic).

Server arrange work decisions webviews
Codev IDE 1.138.0 (server commit 50cad256) 19/19 15/15 16/16 3/6, the three below
VS Code Server 1.128.0 (server commit fc3def67) 19/19 15/15 16/16 not run

"Fenced": the server runs inside the harness's sandbox-exec profile, which refuses outbound TCP to the owner's Tower port, and a canary proves the profile at every start. The tripwire watched every session and stayed clean, each server reported its commit before and after each session, and no browser request reached the owner's port.

Codev IDE 1.138.0 blanks every webview that loads its files by URL (cluesmith/codev-ide#67). Its product.json pins webviewContentExternalBaseUrlTemplate to an older build's webview host page (ef65ac1b), whose service worker cannot hand a webview's resources back (DataCloneError). A panel's HTML arrives; every file it loads by URL hangs. This is a defect in the IDE's packaging, and it also blanks the webviews already on main.

  • Owner ruling ide-3: Work and Decisions carry their code inside the page, on every version, with one code path, no IDE detection and no fallback. They render on 1.138.0.
    • single-panel.ts reads dist/webview/<bundle>.js and .css once per kind and fails loudly, naming the file, if either cannot be read. localResourceRoots: [].
    • The policy is default-src 'none'; script-src 'nonce-…'; style-src 'unsafe-inline'; img-src blob: http: https:, with no connect-src and no cspSource. style-src takes no nonce, because a nonce would switch 'unsafe-inline' off and refuse the style attributes a decision item's Markdown keeps (aligned table columns), which the dashboard renders.
    • The inlined text is escaped (</script, <!-- and </style). A test parses both production bundles with TypeScript's scanner and fails if a rewrite lands anywhere but a string, regex, untagged template or comment.
  • Still blank on 1.138.0, outside the ruling: VS Code's own Markdown preview, the contextual panel and the Codev Markdown preview. They are the three webviews failures, and render once the IDE is fixed.
  • The same old page's default styles differ. The first fenced 1.138.0 decisions run failed its theme check: in High Contrast Light the Decisions file path was white on white. That page gives code the theme's preformatted foreground (white there) without the dark blue background 1.128 and 1.147 pair with it, and its defaults are unlayered, where theirs sit in @layer vscode-default. At the architect's direction (7cdc24716), the panels' stylesheet now states 1.147's value for every default that differs on that page, for every element the panels render: code, a code, pre code, p > a, kbd (with the old page's .vscode-light kbd), video, and the body's overscroll-behavior-x. None of the differing rules was left out. Measured in headless Chromium, the panels' computed styles now match 1.147's under the old page's defaults and under 1.128's, and 1.147 renders exactly as before. Each rule has a theme test.

The first attempt: the tripwire incident

  • The attempt. The 1.138.0 run used the harness's ide-server mode, launching codev-ide-server directly on harness ports. It was that mode's first real run.
  • What went wrong. The harness wrote codev.towerPort under --user-data-dir. A VS Code server ignores that flag and reads <server-data-dir>/data/Machine/settings.json. So the extension host used port 4100, the owner's Tower.
  • What reached the owner's Tower (from its log, read by the architect):
    • requests from 16:56:19Z to 17:21:05Z, 25 minutes, about 9,100 in all, every one refused 401 by the isolated key;
    • GET /api/overview, /api/events, /api/worktree-config, /api/activity-hooks and /workspace/<enc>/api/state, plus about 1,500 POST /api/workspace/<enc>/activate;
    • nothing read or changed: no 2xx, no fixture workspace registered, and the Tower stayed healthy with the same 12 active workspaces.
  • Why it lasted 25 minutes. The tripwire detected the connection at 16:56:20Z, wrote its marker and exited. The run went on until the verify script finished.
  • Fixed in the harness (644a5eb49), with self-tests on throwaway listeners only (selftest tripwire settings sandbox: 17/17; no IDE server launched):
    • the tripwire now stops the run at first detection. It freezes and kills the whole harness tree, then reports. A stand-in tree, including a detached grandchild, was killed in under half a second;
    • ide-server mode writes the settings where the server's own code reads them. Gate 5 confirms that from the server's bundle, and refuses a server where it cannot. Both real servers were checked read-only;
    • ide-server mode runs the server inside a sandbox-exec profile that denies outbound TCP to :4100, so the connect itself fails. A launch canary on a throwaway port proves the profile applies.
  • Then. The owner allowed one fenced run on each version (ruling ide-2). Every start since has had the sandbox, its canary and the tripwire, and none has fired.

Rendered verification (increment 1, Phase 5, isolated harness)

The rendered verification ran in the isolated harness: VS Code 1.147.0 serve-web, its own Tower on
:18764, recording stubs for afx/porch/codev, and a tripwire on :4100. The results and
screenshots are in
verification-increment1/ on the evidence branch (browse).
Increment 1 ran 43 checks, 0 failed. In the review phase, actions and reconnect ran again on that phase's code, and their results and screenshots replaced the originals: actions 28/28, reconnect 4/4, each count including the new prompt check. The originals showed the machine's shell prompt, as described in Phase 9's privacy note. The other four scripts' files are from increment 1. The folder's README lists which files are which.

Script Result What it shows
render 5/5 The Cockpit button directly below Codev. The Codev container unchanged against origin/main. The hierarchy with N=2, 1 and 0 builders across three workspaces. Dormant (1). Dark theme, then a live switch to light
reveal 1/1 A builder diff reveals its file row, expanding the workspace and architect rows collapsed beforehand
windows 3/3 The worktree window's parent row offers only worktree-scoped actions. The no-workspace window's tooltip. Cockpit-only freshness: a gate change shows after 56.3 s, against the 60 s default
requests 4/4 Spec scenario 21, below
actions 28/28 (review-phase run) Every builder context action, with the menu matching Agents. Approve Gate inline. Every workspace-row action. Remove Architect. Other workspaces' rows navigate
reconnect 4/4 (review-phase run) Content kept with Tower down. A fresh window reads Not connected to Tower. Reconnect restores the tree

On the final code (35334efbf, VS Code 1.147.0): render 6/6, reveal 2/2, windows 4/4, requests 5/5, actions 28/28, reconnect 4/4, each count including the prompt check.

Request count (spec scenario 21), from the final run (35334efbf). Each layout is asserted on
screen before it is measured, in a freshly restarted VS Code server. Each count covers a 60 s idle
window, then a 15 s burst: a builder gate change and a codev-config-updated. Every row but the
Decisions one is the same as in increment 1.

Route Cockpit alone Workspace + Agents + Tower alone Both
GET /api/workspaces (idle / burst) 3 / 1 3 / 1 3 / 1
GET /api/overview alpha 4 / 2 4 / 2 4 / 2
GET /api/overview beta, gamma (each) 3 / 1 3 / 1 3 / 1
GET /api/worktree-config 0 / 2 0 / 2 0 / 3
GET /api/activity-hooks 0 / 1 0 / 1 0 / 1
GET /api/workspaces/:ws/status (Workspace view) 0 / 0 0 / 1 0 / 1
GET /workspace/<alpha>/api/decisions (the Decisions panel) 30 / 8 30 / 8 30 / 8
Event streams per window 1 1 1
  • The Cockpit adds no poll, stream or route.
  • With both sets visible, the only addition is one getWorktreeConfig, on the config change.
  • getWorktreeConfig never runs on a fleet tick.
  • The Decisions row is the panel's own 2 s poll (Phase 7), not the Cockpit's. Since Phase 9 the window arranges itself, so the panel is open in all three layouts and polls the same in each.

Flaky tests

Two pre-existing Windows tests are intermittent on Node 24, in run 45397300019. They are tracked in issue #1973 (pre-existing Windows test flakes, filed by the architect). This branch changes nothing in packages/codev except issue-id-parity.test.ts. Both are left running.

Test File What I saw
'npm-style shim': spawns, forwards a native ?folder path, and stops with nothing left running packages/codev/src/agent-farm/__tests__/ide-server-stub.windows.test.ts Failed in attempt 1 of run 45397300019 with "IDE server on port … was not stopped: the port query failed". Passed in attempt 2
resumes the spawn-pinned session after an unnatural exit, with the nudge, instead of replaying the prompt packages/codev/src/agent-farm/__tests__/pir-1233-session-launch-loop.test.ts Passed in attempt 1. Failed in attempt 2 ("Command failed: … start.sh"). The same file also failed on another branch's Windows run (45311869550)

Tests

  • apps/vscode unit suite on the final code: 134 files, 1981 passed, 1 skipped. Ruling ide-3 added the inline-bundle tests (the escape, checked with TypeScript's parser on both production bundles; the policy; a bundle that cannot be read), and 7cdc24716 a theme test per restated default. Phase 9 adds the arrange tests (a fake editor area that closes empty groups and renumbers, merges on the layout call, and opens a revealed panel as a preview), the auto-arrange and notice tests, the terminal-position override tests, and the restored-tab tests for both panels. Phase 8 added the Work panel host tests (open/reveal/restore, the refresh gate, the connection-state table, every action, real-filesystem containment, no key in any message), the WorkApp jsdom tests, a booted-bundle smoke test, and the type-scale and no-file theme tests. Phase 7 added:

    • host tests for messages, security, the bridge, the panel and the CSP;
    • jsdom tests of the webview;
    • a smoke test that builds and boots the real webview bundle;
    • the theme-token coverage test.
  • packages/workspace-views: 197 tests. packages/sdk: 431 tests. apps/web: 38 files, 462 passed, 1 skipped. Locally they need NODE_OPTIONS=--no-experimental-webstorage, because Node 26's experimental localStorage shadows jsdom's; CI's Node 20 does not.

  • The vscode-test Electron suite (apps/vscode/src/test/) was not run.

    The spec's "full apps/vscode suites" criterion is met by the vitest suite (architect ruling).

  • Type-check is clean for the host and webview configs. Lint is clean, apart from two existing curly warnings in issue-id.test.ts.

  • The harness self-test passes: 24 cases, including 7 cases for the guarded removal of the
    fixture directory.

…es → architects + Decisions → builders hierarchy
…ew fixes (config cache, db path, WorkView state, test deps)
…oundary, CJS esbuild options, status tokens, viewsWelcome)
…path and network sandbox

The 2026-11-24 incident: the ide-server mode's first run wrote codev.towerPort under
--user-data-dir, which a VS Code server ignores, so the extension host used :4100, the owner's
Tower (about 9,100 requests over 25 minutes, all refused 401). The tripwire detected it within
a second but only wrote a marker and exited; the run went on.

- tripwire: on a hit, write the marker, SIGSTOP the whole harness tree (rescanning until no new
  process appears), SIGKILL it, then report what it killed. A pid file counts only while its
  pid's command carries the file's markers; CLI pid files now record one. Sampling every 1 s.
- ide-server settings: written to <server-data-dir>/data/Machine/settings.json. Gate 5 confirms
  that from the server's own bundle (out/server-main.js) and refuses a server where it cannot,
  and refuses VSCODE_PORTABLE/VSCODE_APPDATA in the server env. No --user-data-dir is passed.
- prevention (sandbox.mjs): the ide-server runs under sandbox-exec with a profile that denies
  outbound TCP to :4100 on any host. A launch canary, a throwaway port the profile also denies,
  must be refused inside the sandbox before the server starts.
- selftest takes sections; tripwire/settings/sandbox use throwaway listeners only: 17/17.
@waleedkadous

Copy link
Copy Markdown
Contributor Author

Owner rulings at the PR gate (2026-11-24, relayed by the architect). The gate itself is not approved yet.

  • Dormant window: accepted as built. Stock VS Code on a folder without Codev stays inert (vscode: IDE-mode foundation: dual-mode activation, workspace/IDE context keys, empty-window surfaces #1144) and shows Not connected to Tower; it does not list the fleet. The spec's no-workspace criterion is amended to say so.
  • Wording and contrast: accepted — the reused Failed to load overview: Not connected to Tower. text, and the two Light Modern texts at 4.3:1.
  • History: scrub approved ("destructive is ok"). The old evidence files are to be removed from the history of builder/spir-1963 and evidence/spir-1963 before merge, by a path-only rewrite and force-push. Commit SHAs cited in earlier comments on this PR will no longer be on the branch; the CI runs they point to remain.
  • Still open: whether to run the layout check on VS Code 1.138 / 1.128 before merge, and the merge approval.

…at the PR gate

The no-workspace criterion, the scope's window list and both footprint lines now state that a
dormant window (the marketplace extension in plain VS Code, in a folder with no Codev project)
does not connect and shows Not connected to Tower, not Tower with the fleet (owner's ruling of
2026-11-24, recorded on PR #1971).
…index pinned to evidence 51e2bbf

Owner Decisions 1, 2 and 4 accepted as built, 3 (history scrub) approved; 5 stays open. The
evidence branch was rewound to a749cdd plus one clean commit (51e2bbf) holding the
c79b1c7 run; verification.md is regenerated against it (127/127).
… worker cap (#1965)

One conflict, packages/sdk/src/tower-client.ts: both sides added names to the
same codev-types import; resolved as the union.
…ay blank

Opens VS Code's own Markdown preview, the Codev contextual panel, the Codev
Markdown preview and Work, and for each records a screenshot, a probe of the
webview's content frame (root, text, scripts, stylesheets, resource timings),
and the console messages, page errors and webview requests with their outcome.
Harness only; no extension change.
…or after the trust step

1.128 opens the Workspace Trust editor as a modal (workbench.editor.useModal
defaults to "some") that Escape leaves up; on a fresh browser profile it took
the click on the Cockpit button. ensureTrusted now closes it with its own Close
action. Harness only.
…odev-ide#67)

Codev IDE 1.138 pins a webview host page that cannot deliver a webview's
resources (DataCloneError in its service worker), so a panel that loads its
code by URL stays blank there. Owner ruling ide-3: the Work and Decisions
panels put their script and stylesheet in the document, on every VS Code
version; no IDE detection, no URL fallback.

- The bundle is read from dist/webview once per kind. One that cannot be read
  fails the open, naming the file; a restored panel is closed.
- Policy: script-src and style-src are the nonce only (no 'unsafe-inline',
  no 'unsafe-eval', no source), img-src blob: http: https:, still no
  connect-src; localResourceRoots is empty. A style attribute parsed from
  markup (an aligned table column in a decision item) is now refused; React
  style props go through the CSSOM and still apply.
- The text is escaped so it cannot end its element: "</script" and "<!--"
  as \x3C in the script (valid in strings and regexes, u flag included),
  "</style" as \3C in the stylesheet.
- The bundles load nothing else by URL (no url(), @import, fonts, imports or
  workers); dev source maps are now inline.
- Tests: the template (inline form, policy, nonce on both elements, escaping
  of a hostile bundle with its meaning kept), both panels (inline, no roots,
  read once, unreadable bundle), and both real bundles booted in their
  escaped form.

The contextual panel, the Markdown preview and the backlog search are
unchanged and stay blank on 1.138 until the IDE is fixed.
Since Phase 9 the Cockpit arranges the window into three editor groups by
default (codev.cockpit.autoArrange), and every group has an active tab, so
the first .tab.active in the page was the left group's. The decisions
script, last run before Phase 9, timed out waiting for its own tab there.
…ndle tests on the production build

- style-src is 'unsafe-inline' alone: the reviewed policy minus cspSource. A
  nonce in the directive would switch 'unsafe-inline' off and refuse the style
  attributes a decision item's Markdown carries (aligned table columns, raw
  HTML), which the dashboard renders. The inline <style> drops its unused
  nonce; script-src stays the nonce only.
- The Work and Decisions bundle tests run every check on both builds,
  development and production (minified, what the vsix ships), each booted in
  the escaped form the panel inlines.
…ript's parser

The \x3C rewrite keeps a script's meaning only inside a string, a regex
literal, an untagged template or a comment. In code it is a syntax error
(caught by the bundle boot tests), and in a tagged template it silently
changes what the tag reads from .raw. escape-contexts.ts parses a script with
TypeScript (already a dev dependency) and classifies each rewritten position.
Both real bundles, development and production, must have only safe ones
(production today: Work 5, Decisions 6, all strings and regexes). Self-tests
show it flags String.raw`</script>`, a tag before a substitution, `0 </script/`
and `a<!--b`. The template comment names the limit. Codex second opinion via
the architect.
…its for the result

reveal (last run in increment 1) typed README.md into Go to File and pressed
Enter after 300 ms. In the window the Cockpit now arranges by default, with
Work and Decisions loading, the search had not returned yet, nothing opened,
and the check timed out waiting for README. quickOpenFile (Phase 9) waits for
Quick Open to offer the exact file, chooses it, and waits for its tab in the
focused group.
…st page lacks (cluesmith/codev-ide#67)

Codev IDE 1.138 serves an older webview host page (ef65ac1b) whose default styles are unlayered
and differ from VS Code 1.147's and 1.128's. It colours `code` with the theme's preformatted
foreground and no background; High Contrast Light pairs a white foreground with a dark blue
background, so the Decisions file path was white on a white page (contrast 1, verify decisions
scenario 18 on 1.138).

The default-styles blocks of the three host pages, diffed rule by rule (ef65ac1b against 1.147
and 1.128). Each differing rule, and what was done:

Handled: the panels render the element, so vscode-theme.css now states 1.147's value:
- body: overscroll-behavior-x: none (unset on the old page), in the panels' body rule.
- video: max-width/max-height 100% (the old page sizes only img); an item's Markdown may hold one.
- code: font-family, colour, background, padding, radius (the old page sets only the colour);
  the file path, the notices and Markdown.
- a code: preformatted colour and underline (the old page's `a, a code` gives the link colour);
  Markdown links. The same specificity as that rule, and later, so it wins there.
- pre code: transparent background, no padding (absent on the old page); Markdown code blocks.
- p > a: text-decoration from the link-underline setting (absent on the old page); Markdown links.
- kbd, and the old page's `.vscode-light kbd`: keybinding-label colours, border and shadow, in
  place of fixed greys; raw <kbd> in an item's Markdown. Stated as `:root kbd`, which ties
  `.vscode-light kbd` and comes later.

Did not apply: none. Every differing rule targets an element the panels can render. The rules
that do not differ (html, the body's other properties, img, a, a:hover, the focus outline,
blockquote, scrollbars, find highlights) need nothing. On the old page they are unlayered, but no
panel rule loses to one of them.

Measured in headless Chromium with the real production stylesheets, under each host page's
defaults, in light and dark, over every element type the panels render: before, the old page
differed from 1.147 in 34 computed properties on Decisions; after, 0 on the old page and 0 on
1.128, and 1.147 itself renders exactly as before. 1.128's one change is the underline on code in
a Markdown link, which its own defaults left off.

Tests: workspace-views-theme.test.ts states each rule as 1.147 does (one test per rule), the body
property, the specificity against the old page's competing rules, and that the option word keeps
its own colours.
…ds after the reload

After the reload Decisions is restored in a background tab, and the window arranges again only
once its first connection attempt has ended, which brings Decisions on screen to read. The check
counted its cards as soon as the frame existed: on Codev IDE 1.138 that was before the arrange,
so it read 0 cards before Tower went down, then 2 while down and 2 after (verify work, scenario
19, on 7cdc247). It now waits, bounded, for the cards, re-finding the frame on each try.
waleedkadous added a commit that referenced this pull request Nov 25, 2026
…t; 1.138.0 and 1.128.0 fenced)

The scripts that render the Work or Decisions panel ran on d31df3a; the nine
that render none, on 35334ef. Each folder's head.txt names its head. Replaces
the per-phase folders; layout-spike/ stays. Each folder holds a run's results
JSON and the screenshots it names.
verification.md now lists only the final runs, pinned to evidence commit 8b7def1:
1.147.0 serve-web 115/115, fenced 1.138.0 53/56 (the three webviews the IDE leaves
blank, cluesmith/codev-ide#67), fenced 1.128.0 50/50. The scripts that render a panel
ran on d31df3a (vsix built at 7cdc247); the nine that render none on 35334ef
(vsix built at 4ab7ed1). Between the two heads the vsix inputs changed only in
vscode-theme.css and workspace-views-theme.test.ts; the index gives the diff stat.

The review records the final runs and their stops (serve-web's update check, the 1.138
contrast finding, the harness race), the host-defaults deviation with its handled list,
that earlier counts were per phase, the final unit counts and the untested ranges.
arch.md and lessons-learned.md gain the inline bundle and the host page's defaults.
@waleedkadous
waleedkadous marked this pull request as ready for review November 25, 2026 00:24
@waleedkadous
waleedkadous merged commit 8455361 into main Nov 25, 2026
8 checks passed
waleedkadous added a commit that referenced this pull request Nov 25, 2026
waleedkadous added a commit that referenced this pull request Nov 25, 2026
waleedkadous added a commit that referenced this pull request Nov 25, 2026
…requestTimeoutMs

PR #1971 (merged from main) added requestBinary() with the module's fixed
REQUEST_TIMEOUT_MS. The requestTimeoutMs option this PR added is the
timeout for every request, and the other three request paths use it.
The default is unchanged (10 000 ms), so only a client that sets the
option sees a difference.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

vscode: alternative layout — second activity-bar button, combined Workspace/Tower/Agents panel, and an architect | Work + Decisions split

1 participant