feat(workspace): turn workspaces on by default, with `ALTIMATE_DISABLE_WORKSPACE` as the kill switch

Merged
SA
2mo ago
+577-325

Issue for this PR

No tracking issue. Workspaces leave the opt-in pilot.

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Turns workspaces on by default. The opt-in flag ALTIMATE_WORKSPACE is retired (setting it now does nothing) and ALTIMATE_DISABLE_WORKSPACE=1 is the kill switch that turns every part of the feature off.

Because there is a kill switch, the old "pilot off" code is kept rather than deleted: every gate is inverted, so what used to run for non-pilot users now runs when the switch is set. That includes the hidden link / skill publish stubs, the 409 on the serve workspace routes, and the per-turn cleanup that takes already-synced workspace skills out of service. The five error messages that told users to "restart with ALTIMATE_WORKSPACE unset" to edit a workspace-managed MCP entry by hand now name the kill switch. The serve workspace routes' 409 now says "Workspaces are turned off on this server because ALTIMATE_DISABLE_WORKSPACE is set." instead of "Workspace mode is not enabled for this server."

What reaches every user signed in to Altimate with this change:

  • Binding lookups. Each process asks the backend whether the project is linked: 2 requests (by git remote, then by project path) for an unlinked project, 1 for a project linked by remote. They send the origin URL (credentials stripped) and the absolute project path. The "not linked" answer is cached for 5 minutes in memory, so a long-running TUI or serve repeats it at most every 5 minutes, but every separate altimate-code run looks up once. A failed lookup (backend unreachable) is not cached, so it is retried every turn; the turn waits at most 2s for it.
  • The post-scan workspace prompt during onboarding: after the first-launch scan gate's "Yes", a dialog offers to set up or link a workspace (Skip hides it for 7 days per project and account).
  • The /workspace menu, the sidebar tile, link, skill publish, and the memory_refresh tool.

Users not signed in to Altimate make no workspace requests.

Other changes:

  • test/preload.ts sets the kill switch for the whole suite, and the workspace tests clear it and restore it. This keeps the test environment as it was on main: with workspaces on by default, unrelated test files left background skill syncs running against the real network after their fetch stub was restored, which hung later tests. launch-resolve.test.ts now restores the switch instead of deleting it.
  • New test/altimate/workspace/kill-switch.test.ts checks the default (unset means on), the switch, and that the retired variable is ignored. It fails if the old opt-in check is put back.
  • Docs: usage/cli.md and configure/skills.md drop the pilot wording and document the switch.

Not in this PR: the CHANGELOG entry, which goes in the release PR as usual. It needs to say that workspaces are now on for everyone, including the lookup traffic above.

Known leftovers:

  • Synced skills keep alwaysApply / applyPaths from their frontmatter, as they did in the pilot. With default-on, anyone who can upload a skill to a workspace can add standing instructions to every linked member's prompt. This was approved for the pilot and has been re-approved for this change; the note in skill-sync.ts is unchanged.

How did you verify your code works?

  • Typecheck (packages/opencode, packages/core) and the strict altimate_change marker check pass.
  • The 24 affected test files pass (824 tests). The full packages/opencode suite was run twice on this branch and once on main: no failures unique to this branch. flushPendingSyncs waits for a sync… fails on main too, and the run subprocess tests are flaky on both.
  • End-to-end against a live account with a binary built from this branch, in both modes. Approach and results are in a comment below.

Updated for current main (5 Oct). main was merged in: 10 commits, including v0.12.4 and several workspace changes.

  • Conflict: only docs/usage/cli.md. Kept this PR's ALTIMATE_DISABLE_WORKSPACE row and main's new ALTIMATE_WORKSPACE_WEB_URL row, and dropped the old opt-in row.
  • Nothing new bypasses the off switch. This PR removes the Flag.ALTIMATE_WORKSPACE getter, so any new code still reading the old opt-in would fail to compile, and the typecheck is clean.
  • Stale test from main fixed. release-v0.12.4-adversarial.test.ts turned workspaces "off" by deleting ALTIMATE_WORKSPACE, which no longer does anything, and expected the old opt-in message. It now uses ALTIMATE_DISABLE_WORKSPACE, and checks that the message names the switch to unset (33 pass).
  • Changelog: historical entries mentioning ALTIMATE_WORKSPACE=1 describe past releases and are left as they are.

Smoke tests on a binary built from the merged branch, in a sandbox repo linked to a live test workspace with one custom skill:

Modelink / skill publishAgent: "which workspace, which skills?"
Default (no variables set)real commands; skill publish reaches the publish pathnames workspace id 35 and its one skill
ALTIMATE_DISABLE_WORKSPACE=1both refuse: "Workspaces are turned off because ALTIMATE_DISABLE_WORKSPACE is set…", exit 1no workspace known, and the synced workspace skill is not offered
ALTIMATE_WORKSPACE=0 only (old variable)on, so the old variable is ignoredworkspace and skill back
No Altimate account, unlinked repo, defaultn/arun answers normally; no workspace output on stderr and no workspace warnings in the log

Not covered by the smoke tests: the TUI link prompt. In code it appears only after project_scan, with an Altimate account configured and the switch unset, so users without an account never see it.

Full packages/opencode suite on the merged branch: 14,479 pass, 8 fail.

  • 6 are MCP tests reading the developer's real ~/.claude.json (#1386).
  • silent-turn.test.ts is flaky on main too (2 of 6 isolated runs fail there).
  • --trace writes a session trace artifact passes 4 of 4 when run alone, here and on main.

Screenshots / recordings

None; TUI checks were captured as text (see the E2E comment).

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

🤖 Generated with Claude Code

https://claude.ai/code/session_018fJ3X7pcGT4R9yzjsJnqsV

Summary by CodeRabbit

  • New Features
    • Workspace support is enabled by default, including project linking, skill publishing and syncing, memory syncing, and workspace tools.
    • Set ALTIMATE_DISABLE_WORKSPACE to a value other than empty, 0, or false to turn off workspace features. Existing project links are preserved but not applied while disabled; workspace-provided skills and agent context are unavailable. Unset the variable to restore workspace behavior.
    • Workspace skill synchronization can run in the background when no snapshot is available, allowing the current turn to proceed without waiting. Pending sync work is also included in the shutdown flush.
  • Documentation
    • Updated CLI and workspace guidance to explain the default-on behavior and how to disable workspace features.