-
Notifications
You must be signed in to change notification settings - Fork 3k
feat(cli): Add Phase 2a workspace foundation #6410
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
cf3a0e6
feat(cli): Add Phase 2a workspace foundation
doudouOUC 9bda837
test(cli): Clarify registry reload capability
doudouOUC 1eb2b32
fix(cli): Reject valueless repeated workspace args
doudouOUC 814d0c7
fix(cli): Fallback for empty workspace fast path
doudouOUC 7d82381
test(cli): Address workspace foundation suggestions
doudouOUC bb8c51b
test(cli): Cover registry injection happy paths
doudouOUC 8b7d8fd
fix(cli): Tighten workspace foundation guardrails
doudouOUC 1fd84a9
test(cli): Cover injected client MCP registry path
doudouOUC File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
116 changes: 116 additions & 0 deletions
116
.qwen/design/daemon-multi-workspace-phase2a-sessions.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,116 @@ | ||
| # Phase 2a Multi-Workspace Sessions Foundation | ||
|
|
||
| ## Summary | ||
|
|
||
| This document records the Phase 2a foundation contract for issue #6378 after | ||
| the Phase 1 `WorkspaceRegistry` PR. The current implementation batch combines | ||
| the Phase 1 repeated `--workspace` follow-up, the Phase 2a prep guardrails, and | ||
| the first internal registry/runtime contract needed by later multi-workspace | ||
| session work. | ||
|
|
||
| Phase 2a remains sessions-only. It does not add plural routes, a | ||
| `WorkspaceDaemonClient`, workspace-qualified ACP/WebSocket, file, memory, MCP, | ||
| settings, voice, channel-worker migration, env overlays, total-session | ||
| admission, capabilities `workspaces[]`, `multi_workspace_sessions`, route | ||
| dispatch, or non-primary runtime construction in this foundation batch. | ||
|
|
||
| ## Foundation Contract | ||
|
|
||
| - `--workspace` is repeatable at the CLI parser layer so yargs preserves array | ||
| input instead of collapsing it. | ||
| - The serve fast path falls back to the full parser when repeated workspace | ||
| values are present. | ||
| - A single-item workspace array is treated as the primary workspace and keeps | ||
| the existing single-workspace behavior. | ||
| - Multiple explicit workspaces remain gated and fail before runtime boot. | ||
| - Duplicate canonical workspace inputs fail explicitly. | ||
| - Nested workspace inputs fail explicitly. | ||
| - Distinct non-nested multiple workspace inputs fail with the generic | ||
| "multi-workspace serve is not enabled" boot error. | ||
| - The first explicit workspace is the future primary workspace once the gate is | ||
| removed; this foundation batch does not expose that list publicly. | ||
|
|
||
| The internal `WorkspaceRuntime` contract now carries stable metadata for later | ||
| Phase 2a work: | ||
|
|
||
| - `workspaceId`: stable hash of the canonical workspace cwd. | ||
| - `workspaceCwd`: canonical workspace cwd. | ||
| - `primary`: true for the primary runtime. | ||
| - `trusted`: boot-time trust metadata; direct `createServeApp` fallback remains | ||
| false unless production passes an explicit trusted value. | ||
| - `env`: metadata only. This foundation batch records parent-process mode and | ||
| empty overlay keys; it does not compute runtime-local env overlays. | ||
|
|
||
| The internal `WorkspaceRegistry` supports exact cwd lookup, exact id lookup, | ||
| `resolveWorkspaceCwd(undefined)` primary fallback, and live session owner | ||
| resolution. Live owner resolution scans runtime bridge summaries only; it does | ||
| not scan persisted storage, create children, or route any request yet. Duplicate | ||
| live owners fail closed as an ambiguous result. | ||
|
|
||
| `createServeApp` may accept an injected registry for tests and future assembly, | ||
| but route modules still receive the primary runtime only. Existing legacy | ||
| `app.locals.boundWorkspace` and `app.locals.fsFactory` remain primary-only | ||
| compatibility locals. | ||
|
|
||
| ## Phase 2a Route Classification | ||
|
|
||
| The first ungated Phase 2a milestone must classify all `/session/:id/*` routes | ||
| before enabling multiple explicit workspaces. | ||
|
|
||
| Phase 2a-dispatched routes: | ||
|
|
||
| - `POST /session` | ||
| - `GET /session/:id/events` | ||
| - `POST /session/:id/prompt` | ||
| - `POST /session/:id/cancel` | ||
| - `POST /session/:id/permission/:requestId` | ||
| - `POST /session/:id/heartbeat` | ||
| - `POST /session/:id/detach` | ||
| - `GET /session/:id/pending-prompts` | ||
| - `DELETE /session/:id/pending-prompts/:promptId` | ||
| - `DELETE /session/:id` | ||
| - `GET /session/:id/status` | ||
|
|
||
| Later or primary-only routes: | ||
|
|
||
| - non-primary `POST /session/:id/load` | ||
| - non-primary `POST /session/:id/resume` | ||
| - `GET /session/:id/export` | ||
| - `POST /sessions/delete` | ||
| - `POST /sessions/archive` | ||
| - `POST /sessions/unarchive` | ||
| - `PATCH /session/:id/organization` | ||
| - session-group mutations | ||
| - branch, fork, cd, rewind, shell, model, and language session mutations | ||
| - non-session `POST /permission/:requestId` | ||
| - `/acp` | ||
|
|
||
| Additional live read routes may be owner-routed in a later Phase 2a slice only | ||
| after tests prove they depend solely on the owning live bridge. | ||
|
|
||
| ## Later Phase 2a Requirements | ||
|
|
||
| - Keep scan misses as `404 session_not_found`; never fall back to primary. | ||
| - Fail closed if more than one runtime reports the same live session id. | ||
| - Keep non-primary session listing live-only unless persisted entries are | ||
| explicitly marked non-resumable. | ||
| - Add runtime-local env overlays before non-primary child spawn. | ||
| - Add `maxTotalSessions` at the bridge fresh-creation seam so REST and primary | ||
| `/acp` cannot bypass it, while attach still bypasses admission. | ||
| - Publish `workspaces[]`, total limits, and `multi_workspace_sessions` only in | ||
| the final ungate PR. | ||
| - Update SDK capability types when the additive capabilities schema ships, but | ||
| do not add a workspace client in Phase 2a. | ||
|
|
||
| ## Audit Decisions | ||
|
|
||
| - The foundation PR must not create non-primary runtimes or relax any REST | ||
| route. | ||
| - Existing `app.locals.boundWorkspace` and `app.locals.fsFactory` remain | ||
| primary-only compatibility locals. | ||
| - The REST `routeFileSystemFactory` remains distinct from bridge filesystem | ||
| factories; it must not be used to represent non-primary bridge boundaries. | ||
| - IDE secondary filesystem roots must not be promoted into explicit workspace | ||
| runtimes. | ||
| - Single-workspace parent-env behavior remains compatible until true | ||
| multi-workspace mode is ungated. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.