Python
Pre-release fixes from the 0.2.0 walkthrough
Rohit C Prasaded75ab4b57ee
diff --git a/coworker/agent.py b/coworker/agent.pyindex 5ce35ba0..5aa53ac3 100644--- a/coworker/agent.py+++ b/coworker/agent.py@@ -119,6 +119,16 @@ you're doing and why (e.g. "Checking what merged since yesterday's digest."). Itto the user as live progress. Don't narrate trivial single-call follow-ups, don't repeat \the previous line, and never let narration replace your final answer."""+# A bare "hey" answered with a bare "hey" makes a specialist read as an empty chat box+# (owner catch 2026-08-24). First contact is the one moment to show what this coworker+# is for — after that, greetings stay lightweight.+_FIRST_CONTACT_GUIDANCE = """\+First contact: if the user's first message is a simple hello or open-ended ("hey", "what \+can you do?") rather than a task, don't just say hello back — say in one or two \+sentences what you do in this role, then offer two or three concrete things you could \+start on right now, phrased for this session's context (workspace, connected tools). \+Keep it short and skip the pitch when the user already gave you a task."""+def _enabled_connector_tools(secrets: SecretStore) -> tuple[set[str], set[str]]:connectors = {c["name"]: c for c in connector_list(secrets)}@@ -350,7 +360,7 @@ def build_engine(if wake_store is not None and session_id and agent.scheduling:registry.register_all(selfwake_tools(wake_store, session_id))- instructions = f"{agent.system_prompt}\n\n{_NARRATION_GUIDANCE}"+ instructions = f"{agent.system_prompt}\n\n{_NARRATION_GUIDANCE}\n\n{_FIRST_CONTACT_GUIDANCE}"if ws is not None:instructions = f"{instructions}\n\n{environment_context(ws)}"conventions = load_agents_md(ws)diff --git a/surfaces/gui/e2e/family-gate.spec.ts b/surfaces/gui/e2e/family-gate.spec.tsindex ccd0db01..3afe6841 100644--- a/surfaces/gui/e2e/family-gate.spec.ts+++ b/surfaces/gui/e2e/family-gate.spec.ts@@ -93,3 +93,38 @@ test("escape restores the draft instead of losing it", async ({ page }) => {await expect(page.getByTestId("send-folder-dialog")).toHaveCount(0);await expect(box).toHaveValue("precious draft");});++test("an explicit folder pick survives a coworker change; menu copy matches state", async ({+ page,+}) => {+ // Owner catch 2026-08-24 (v0.2.0 walkthrough): picking a folder and THEN picking the+ // coworker silently reset the folder. The user's own chip pick must survive; only+ // inherited folders (boot-resume, scratch) still clear on a coworker change.+ await page.goto("/");+ await page.getByText("New session").first().click();++ // No folder yet — the menu's browse action reads "Choose a folder…", not "another".+ await page.getByTestId("folder-chip").click();+ const browseBtn = page.locator(".setup-menu").getByRole("button", { name: /Choose a(nother)? folder…/ });+ await expect(browseBtn).toHaveText(/Choose a folder…/);+ await browseBtn.click(); // native pick is mocked server-side → /tmp/picked-folder+ await expect(page.getByTestId("folder-chip")).toContainText("picked-folder");++ // With a folder bound, the same action offers "another".+ await page.getByTestId("folder-chip").click();+ await expect(+ page.locator(".setup-menu").getByRole("button", { name: /Choose a(nother)? folder…/ }),+ ).toHaveText(/Choose another folder…/);+ await page.mouse.click(10, 10); // scrim click closes the menu++ // Re-target the draft to a folder-gated coworker — the pick survives…+ await page.getByTestId("coworker-chip").click();+ await page.locator(".setup-menu").getByRole("button", { name: /Security Coworker/ }).click();+ await expect(page.getByTestId("folder-chip")).toContainText("picked-folder");++ // …and the send goes straight through, no folder dialog.+ await page.getByPlaceholder(/Ask the coworker/).fill("scan here");+ await page.getByRole("button", { name: "Send" }).click();+ await expect(page.getByText(/Echo: scan here/)).toBeVisible();+ await expect(page.getByTestId("send-folder-dialog")).toHaveCount(0);+});diff --git a/surfaces/gui/e2e/usage-chip.spec.ts b/surfaces/gui/e2e/usage-chip.spec.tsindex 92a62ca2..bc98e0a5 100644--- a/surfaces/gui/e2e/usage-chip.spec.ts+++ b/surfaces/gui/e2e/usage-chip.spec.ts@@ -20,29 +20,24 @@ test("usage chip appears after a turn and opens the breakdown popover", async ({timeout: 10_000,});- // Default: no bar (owner ask 2026-07-30) — the chip states the session total- // (1k + 200 + 8k + 800 = 10k). The bar is opt-in via Settings.+ // Default: no bar — the chip states the in-context size (prompt side of the last+ // turn: 1k + 8k + 800 = 9.8k). Session totals are on release hold (owner call+ // 2026-08-24): context-window figures only, everywhere.const chip = page.getByTestId("usage-chip");- await expect(chip).toContainText("10k");+ await expect(chip).toContainText("9.8k");- // Popover: context fill (9.8k prompt-side of 200k = 5%) + per-model breakdown.+ // Popover: context fill only (9.8k prompt-side of 200k = 5%) — no totals breakdown.await chip.click();const pop = page.getByTestId("usage-popover");await expect(pop).toBeVisible();await expect(pop).toContainText("Context window");await expect(pop).toContainText("9.8k of 200k · 5%");- await expect(pop).toContainText("Session totals");- await expect(pop).toContainText("Claude Opus 4.8 · Anthropic");- // Cache split present → the input rows read as components of Total input.- await expect(pop).toContainText("Uncached input");- await expect(pop).toContainText("Cache reads");- await expect(pop).toContainText("Cache writes");- // Total input = fresh 1k + cache_read 8k + cache_write 800 (cumulative billed input).- await expect(pop).toContainText("Total input");- await expect(pop).toContainText("9.8k");- await expect(pop).toContainText("10k tokens");+ await expect(pop).not.toContainText("Session totals");+ await expect(pop).not.toContainText("Uncached input");+ await expect(pop).not.toContainText("tokens");- // Second turn accumulates (totals double), and the scrim click closes the popover.+ // Context is a level, not a sum — a second identical turn leaves the chip unchanged.+ // The scrim click closes the popover.await page.mouse.click(10, 10);await expect(pop).toHaveCount(0);await box.fill("again");@@ -50,7 +45,7 @@ test("usage chip appears after a turn and opens the breakdown popover", async ({await expect(page.getByText("Echo: again", { exact: false }).first()).toBeVisible({timeout: 10_000,});- await expect(chip).toContainText("20k");+ await expect(chip).toContainText("9.8k");});test("usage resets on a new session", async ({ page }) => {@@ -66,14 +61,14 @@ test("usage resets on a new session", async ({ page }) => {await expect(page.getByTestId("usage-chip")).toHaveCount(0);});-test("Settings toggle turns the context bar on; default is the session total", async ({ page }) => {+test("Settings toggle turns the context bar on; default is the in-context number", async ({ page }) => {await page.goto("/");await page.getByText("Draft the launch note").first().click();const box = page.getByPlaceholder(/Ask the coworker/);await box.fill("hello");await box.press("Enter");const chip = page.getByTestId("usage-chip");- await expect(chip).toContainText("10k", { timeout: 10_000 }); // default: total, no bar+ await expect(chip).toContainText("9.8k", { timeout: 10_000 }); // default: in-context size, no bar// Turn the bar ON in Settings -> General.await page.getByTestId("account-row").click();@@ -94,6 +89,6 @@ test("Settings toggle turns the context bar on; default is the session total", aawait page.getByPlaceholder(/Ask the coworker/).press("Enter");const bar = page.getByTestId("usage-chip");await expect(bar).toBeVisible({ timeout: 10_000 });- await expect(bar).not.toContainText("10k");+ await expect(bar).not.toContainText("9.8k");await expect(bar).toHaveAttribute("title", /Context window 5% full/);});diff --git a/surfaces/gui/src/App.tsx b/surfaces/gui/src/App.tsxindex 2954c044..8ec943fd 100644--- a/surfaces/gui/src/App.tsx+++ b/surfaces/gui/src/App.tsx@@ -178,6 +178,9 @@ export function App() {// the header says "Temporary folder" and offers Save as project…). Set locally when a// temp dir is created at send, corrected by every `ready` event (server truth).const [tempWorkspace, setTempWorkspace] = useState(false);+ // The draft folder came from the user's own chip pick (not boot-resume or scratch+ // adoption). Only such a pick survives a coworker change (owner catch 2026-08-24).+ const [draftFolderPicked, setDraftFolderPicked] = useState(false);// UX-029 send-time folder enforcement: the stashed message while the folder dialog is// up. The message goes out the moment the dialog resolves; Escape restores the draft.const [sendGate, setSendGate] = useState<{@@ -1207,6 +1210,7 @@ export function App() {setWorkspace(null);setBranch(null);}+ setDraftFolderPicked(false);setTempWorkspace(false);setSessionId(newId());};@@ -1217,8 +1221,13 @@ export function App() {const pickCoworker = (id: string) => {if (id === agent) return;setAgent(id);- setWorkspace(null);- setBranch(null);+ // An explicit draft folder pick survives a coworker change (owner catch+ // 2026-08-24). Anything inherited — boot-resume, scratch adoption, temp+ // dirs — still resets; the "never inherit" rule exists for those.+ if (!gatesWorkspace(id) || tempWorkspace || !draftFolderPicked || !workspace) {+ setWorkspace(null);+ setBranch(null);+ }setTempWorkspace(false);setShowGate(false);setSessionId(newId());@@ -1228,6 +1237,7 @@ export function App() {const pickDraftFolder = (path: string, b?: string | null) => {setWorkspace(path);setBranch(b ?? null);+ setDraftFolderPicked(true);setTempWorkspace(false);setSessionId(newId());getRecentWorkspaces().then(setProjects).catch(() => {});@@ -1349,6 +1359,7 @@ export function App() {setStreaming("");setRunning(false);if (ag) setAgent(ag);+ setDraftFolderPicked(false); // a resumed session's folder is inherited, not a picksetTempWorkspace(false); // the `ready` event restores the truth for temp sessionsif (!gatesWorkspace(ag)) setShowGate(false);if (ws && ws !== workspace) {@@ -1368,6 +1379,7 @@ export function App() {const switchAgent = async (name: string) => {setSurface("session");if (name === agent) return;+ setDraftFolderPicked(false); // leaving the draft — any pick belonged to itrememberLastSession(agent, sessionId, workspace);const knownSessions = sessions.length ? sessions : await getSessions().catch(() => []);const knownProjects = projects.length ? projects : await getRecentWorkspaces().catch(() => []);diff --git a/surfaces/gui/src/components/Composer.tsx b/surfaces/gui/src/components/Composer.tsxindex 8a837cd4..f7a8330e 100644--- a/surfaces/gui/src/components/Composer.tsx+++ b/surfaces/gui/src/components/Composer.tsx@@ -806,6 +806,10 @@ function UsageChip({: null;// Settings can hide the bar; without a known window there is nothing to fill either.const showBar = pct !== null && contextBar === true;+ // Release hold (owner call 2026-08-24): cumulative session totals need more vetting+ // before they ship — cache-read sums across turns read like a bill. Until then the+ // chip and popover speak context-window only. Flip this to restore the breakdown.+ const SHOW_SESSION_TOTALS = false;const labelFor = (id: string) =>id === "unknown" ? "Unknown model" : modelLabels?.[id] || shortModel(id);// One field per line, session-summed (owner ask 2026-07-28). Values are cumulative@@ -826,15 +830,15 @@ function UsageChip({aria-expanded={open}aria-label="Token usage"title={- showBar- ? `Context window ${pct}% full · ${formatTokens(total)} tokens this session`- : `Token usage this session: ${formatTokens(total)}`+ pct !== null+ ? `Context window ${pct}% full — ${formatTokens(usage.context)} of ${formatTokens(contextWindow as number)}`+ : `In context now: ${formatTokens(usage.context)} tokens`}data-testid="usage-chip">- {/* The bar is the context-window fill; pairing it with the session TOTAL read as- "total is N% of the window", which it never was. Bar alone when we have a- window, the session total only when we don't (so the chip is never empty). */}+ {/* The bar is the context-window fill. With totals on release hold, the numeric+ fallback is the in-context size — the one figure we trust — never the+ cumulative session total. */}{showBar ? (<span className="w-12 h-1.5 rounded-full bg-line overflow-hidden" aria-hidden="true"><span@@ -843,7 +847,9 @@ function UsageChip({/></span>) : (- <span className="tabular-nums">{formatTokens(total)}</span>+ <span className="tabular-nums">+ {SHOW_SESSION_TOTALS ? formatTokens(total) : formatTokens(usage.context)}+ </span>)}</button>{open && (@@ -874,6 +880,7 @@ function UsageChip({In context now: {formatTokens(usage.context)} tokens</div>) : null}+ {SHOW_SESSION_TOTALS && (<><div className="text-[11px] uppercase tracking-[0.06em] text-faint font-semibold mb-1">Session totals</div>@@ -907,6 +914,7 @@ function UsageChip({<span className="text-faint">Total</span><span className="text-ink tabular-nums">{formatTokens(total)} tokens</span></div>+ </>)}{model && !modelLabels?.[model] && contextWindow === undefined && (<div className="mt-1 text-[11px] text-faint leading-snug">Context meter unavailable for custom models.diff --git a/surfaces/gui/src/components/Onboarding.tsx b/surfaces/gui/src/components/Onboarding.tsxindex 816218e5..d0a98d7f 100644--- a/surfaces/gui/src/components/Onboarding.tsx+++ b/surfaces/gui/src/components/Onboarding.tsx@@ -44,8 +44,11 @@ export function Onboarding({ onDone }: { onDone: (next?: "work" | "gallery" | "aconst ps = useProviderSetup();const [skipConfirm, setSkipConfirm] = useState(false);+ // Ready = a saved key, a proven keyless runtime, or a completed OAuth sign-in+ // (subscription providers set signed_in, not configured+needs_key).const anyReady =- ps.providers.some((p) => p.configured && p.needs_key) || ps.keylessOk.size > 0;+ ps.providers.some((p) => (p.configured && p.needs_key) || (p.auth === "oauth" && p.signed_in)) ||+ ps.keylessOk.size > 0;// In the form with typed-but-untested input, Next verifies+saves first (tester// catch 2026-07-12: a manual Test-then-Continue two-step reads as a puzzle).const nextFromForm = !!ps.sel && ps.dirty && ps.secretFilled;diff --git a/surfaces/gui/src/components/SessionSetupRow.tsx b/surfaces/gui/src/components/SessionSetupRow.tsxindex 3fa8d3e3..0f698370 100644--- a/surfaces/gui/src/components/SessionSetupRow.tsx+++ b/surfaces/gui/src/components/SessionSetupRow.tsx@@ -148,7 +148,7 @@ export function SessionSetupRow(props: Props) {className="w-full text-left px-2.5 py-1.5 rounded-lg hover:bg-paper text-[12px] text-accent"onClick={() => void browse()}>- Choose another folder…+ {props.folderName ? "Choose another folder…" : "Choose a folder…"}</button></div>{error && <div className="px-2.5 py-1 text-[12px] text-warnInk">{error}</div>}diff --git a/surfaces/gui/src/components/SettingsView.tsx b/surfaces/gui/src/components/SettingsView.tsxindex 06d99330..000dc658 100644--- a/surfaces/gui/src/components/SettingsView.tsx+++ b/surfaces/gui/src/components/SettingsView.tsx@@ -831,8 +831,7 @@ function ContextBarCard() {<span className="block text-[13px] text-ink">Show the context window bar</span><span className="block text-[12px] text-muted">A small meter showing how full the model’s context window is. Turn it off- to show this session’s token total instead; either way the full breakdown- is one click away.+ to show the same thing as a number instead.</span></span></label>