fix(workspace): relink memory, consent before seeding, pin skills, clearer link and /workspace
Issue for this PR
Closes #1372
Type of change
- Bug fix
- New feature
- Refactor / code improvement
- Documentation
What does this PR do?
Fixes from dogfooding the Workspaces pilot as two teammates (SSH and HTTPS clones, pilot on and off, backend down).
- Relink keeps old memory. Session memory hydrates once and a relink never invalidated it, so workspace A's memory kept being injected after relinking to B. The memory overlay now resets on every binding change, and a Refresh that was in flight during a relink drops its result.
- Memory uploaded before consent. The TUI pre-check recorded a discovered (often a teammate's) link before showing Attach / Skip, which started the memory backfill on TUI open. It now warms the cache without seeding; the seed runs on "Attach and continue".
- Wrong skills under a bad IDE pin. A valid pin that can't be honoured resolved as unknown and kept the project link's skill snapshot. Inside the pinned folder, a snapshot of a different workspace is now taken out of service.
- link hides a failed seed. It always printed "will sync if memory is enabled". It now reports sent / N not synced (retry with Sync) / memory off.
- False race error. A 409 that withholds the workspace name (a teammate's private workspace) printed "Another workspace, "another workspace", claimed this project while you were choosing". The CLI and TUI now say it is likely a teammate's private workspace and to ask the owner to share it. Quick create also warns that the new workspace is private.
- Pilot off.
altimate-code linkfailed with "Failed to change directory to …/link" and exit 0. Hidden stubs for link and skill publish now explain the opt-in and exit 1; the workspace launch flag is hidden from help. - /workspace dead end. When unlinked it now offers "Link to a workspace"; when linked it adds "Open in browser" and "Switch workspace".
- Prompt copy. The "unknown" answer no longer sends CLI users to an IDE extension and says when no account is connected. Prompt and docs no longer claim routing ignores the pin (#1357).
Also fixes a test that reset the process exit code with undefined, which Bun ignores, leaking a 1 into later test files.
How did you verify your code works?
- Unit: a regression test for each fix, each confirmed to fail with its fix removed. The workspace, plugin, server-route, CLI and skill suites give 1784 pass, 1 fail (a skill-sync flush test that fails identically on main). Typecheck clean; marker guard ok.
- Built binary, real CLI flows as two sandboxed users against a local contract-faithful fake of the Workspace API (ported from the backend's current routes; the real backend could not run locally). Before (v0.12.2) and after outputs captured for link, the private-workspace conflict, pilot-off and the identity answer (claude-haiku-4-5).
- Independent Codex review found a refresh-vs-relink race and a pin-outside-root case; both are fixed here.
- Not run: interactive TUI screenshot of the new /workspace rows (typecheck and code review only), the VS Code extension pin end to end, and the real SaaS backend.
Screenshots / recordings
Terminal captures (before and after) are attached to the internal tracker.
Checklist
- I have tested my changes locally
- I have not included unrelated changes in this PR
🤖 Generated with Claude Code
Summary by CodeRabbit
- New Features
- Added workspace switching, browser access, and workspace linking to the workspace menu, including for unlinked projects.
- IDE-selected workspaces now guide skills, memory, and warehouse tool routing by default; local integrations remain available.
- Linking reports memory sync status and notes when a workspace is private.
- Bug Fixes
- Improved workspace and account status guidance, including prompts to connect when no account is configured.
- Prevented stale memory or skills from appearing after workspace changes or uncertain bindings.
- Clarified hidden-workspace conflict messages without exposing workspace names.
- Memory sync now warns when workspace settings cannot be checked or account changes prevent saved memory from being sent.
- Disabled workspace commands now explain that the feature is unavailable.
[!NOTE]
Medium Risk
Changes workspace binding, memory upload timing, and cross-account pinning—areas where wrong behavior leaks data or confuses teammates—but the changes are mostly fail-closed fixes with broad regression tests.
Overview
Fixes several workspace pilot issues from two-teammate dogfooding: stale memory and skills after relinks or bad IDE pins, memory uploaded before the user consents, misleading link errors, and a thin /workspace menu when pilot is off.
Binding and memory correctness. Workspace memory overlays now track per-project binding epochs: relink, unlink, or reset hides the previous workspace’s memory immediately (including mid-turn tool reads) and reloads on the next hydrate; in-flight refreshes that lose a race with a relink are dropped. Memory backfill on bind returns structured SeedOutcome with explicit gate reasons (memory off vs enablement lookup failure → setting-unavailable in Sync). onBindingChanged is directory-scoped so linking project B does not invalidate project A’s overlay in the same process.
Consent and account safety. TUI discovery warm-up calls recordApprovedBinding with seed: false; memory seeds only on explicit Attach, pinned to accountDigest() so account switches mid-flow do not record links or upload memory. CLI link uses the same guard and prints seedMessage() instead of a generic “will sync” line.
Pins, skills, and prompts. Unresolvable or malformed IDE pins deactivate managed skill snapshots (scoped to the pin root). Agent identity copy now says pinned sessions follow the extension for skills, memory, and warehouse routing (unless local integrations), with separate “no account” / pinned vs CLI guidance on unknown link status. Hidden 409 conflicts (private teammate workspace, no name) get HIDDEN_BINDING_MESSAGE instead of a false “race” loop.
CLI and TUI. With ALTIMATE_WORKSPACE off, hidden stubs for link and skill publish explain the opt-in and exit 1. /workspace adds Open in browser, Switch workspace / Link to a workspace, and pin-aware hiding of unlink/switch. Docs updated to match.
Reviewed by Cursor Bugbot for commit b3cf963cdf5a21c39384aa8ebb918a5a4238ee03. Bugbot is set up for automated code reviews on this repo. Configure here.