Repository navigation
Open
Labels
Description
Problem
An audit of every vscode.window.show*Message call in packages/vscode/src/** surfaced 112 notification sites with four pervasive anti-patterns:
- The string
'Codev: Not connected to Tower'appears as an error toast in 17+ places across nearly every command. - The same
'No builders available'/'No data'info toast appears ~8 times for what's almost always a silent no-op situation. - Success info toasts (
Approved gate,Cleaned up builder X,Message sent,Dev server started/stopped,Tunnel connecting/disconnected,Copied #X,Running afx …,Cron: action — name) interrupt the user with information they could just glance at. ~10 sites. - Technical error toasts dump raw
${err.message}content into a notification (Failed to ${action} — ${err.message}). ~13 sites. Notifications truncate and disappear; the actual exception detail is lost.
The cumulative effect is toast spam — most notifications are either redundant, ignorable, or unparseable in a hurry.
Scope (single PR consolidating T1–T4)
This issue groups four sub-refactors that share infrastructure and a theme. They're tracked together so the PR can land them atomically with one set of helpers / one Output channel.
T1 — Centralize the "Not connected to Tower" guard
- Add a shared helper (e.g.
requireConnected(connectionManager): boolean) used by every command instead of inlineif (!connected) { showErrorMessage('Codev: Not connected to Tower'); return; }. - Add a persistent status-bar item (
$(debug-disconnect) Codev) that's visible only when Tower is disconnected. Click → invokescodev.reconnect. Replaces the per-command toasts. - All 17+ inline "Not connected" toasts removed; commands invoke the helper, which renders a single transient toast on first invocation per disconnect (or no toast — relies on status-bar).
T2 — Centralize "No builders" / "No data" handling
- Add
pickBuilderOrNotify(builders, opts)shared helper that returns a builder orundefined. Whenbuilders.length === 0, it does not show a toast — it's a silent no-op for picker flows. - For tree-/sidebar-driven flows (Builders view), surface the "no builders" state as an inline placeholder row in the tree (
(no active builders — spawn one to begin)) rather than a toast. - All 8 inline "No builders" / "No data" toasts removed.
T3 — Demote success info toasts to status-bar transients
- Convert success notifications to
vscode.window.setStatusBarMessage(msg, 3000). - Affects approximately:
approve.ts:167,cleanup.ts:57,send.ts:40,dev-shared.ts:143,dev-shared.ts:165,stop-worktree-dev.ts:39,tunnel.ts:11,tunnel.ts:21,extension.ts:491,spawn.ts:48,cron.ts:37. - Two exceptions kept as toasts because they carry actionable buttons:
builder-spawn-handler.ts:63("Builder X spawned" with "Open Terminal" action) — keep.notifications/gate-toast.tswrapper (gate-blocked actions) — keep.
T4 — Add a Codev OutputChannel + central error reporter
- Create a single
vscode.OutputChannelnamedCodevon activation (likely already partly present —outputChannelis constructed inextension.ts:118; verify and consolidate). - Add a central
reportError(action: string, err: unknown)helper that:- Appends a timestamped entry to the Output channel with the full stack/message.
- Shows a single concise toast:
Codev: <action> failed — see Outputwith aShow Outputbutton (focuses the channel).
- Replace all ~13 raw "Failed to ___ — ${err.message}" toasts with calls to
reportError(...). - Affects approximately:
extension.ts:415,extension.ts:440,extension.ts:457,terminal-manager.ts:182,approve.ts:164,cleanup.ts:53,dev-shared.ts:121,dev-shared.ts:138,send.ts:36,view-diff.ts:339,view-issue.ts:155,connection-manager.ts:211,connection-manager.ts:216.
Acceptance criteria
- Shared
requireConnected()helper exists; every command that previously inlined the "Not connected" toast now calls it. - Status-bar item visible only when disconnected; click invokes
codev.reconnect. - Shared
pickBuilderOrNotify()helper used by every "pick a builder" flow; no per-command "No builders" toasts remain. - Builders tree shows an inline placeholder when no builders exist instead of a toast.
- Success info toasts demoted to
setStatusBarMessage(msg, 3000)per the T3 list; two actionable exceptions preserved. - Codev OutputChannel exists;
reportError()helper appends full detail and shows a concise toast +Show Outputaction. - All ~13 raw "Failed to ___" toasts go through
reportError(). - Pickers (
showQuickPick,showInputBox) and explicit confirmation modals are untouched.
Out of scope
- Restructuring how errors propagate from
connectionManager/terminalManager(intentionally — boundary only, not core). - Auto-reconnect logic (T1 is about surfacing state, not changing reconnect policy).
- Removing the
gate-toast.tswrapper or its action-button toasts.
Source
Derived from the toast audit run on 2026-05-21 across packages/vscode/src/**. 112 notification call sites inventoried; this issue covers the four recurring anti-patterns (T1–T4 in the audit synthesis).
Activity
amrmelsayed commentedon Aug 14, 2026
Rescope (architect, 2026-08-14): the numbers are stale, and the problem has grown
Re-counted against
apps/vscode/src(the extension moved frompackages/vscode, so every path in this issue needs re-resolving):window.show*Messagecall sitesCodev: Not connected to ToweroccurrencesSo the case for this refactor is stronger than when it was written, not weaker.
What already exists: a single
CodevOutputChannel is created atapps/vscode/src/extension.ts:201, which T4 anticipated ("likely already partly present, verify and consolidate"). That part is done.What does not exist: no
requireConnected()helper, nopickBuilderOrNotify()helper, and no centralreportError(). All three sub-refactors still have their full scope.Two notes for whoever plans this:
file:lineinventories in T3 and T4 were accurate in May and will not survive the directory move plus three months of churn. Treat them as a description of the pattern, not a work list.area/vscodebacklog. It should run in a quiet lane rather than beside other vscode work.