Skip to content

fix(http): preserve workspace IDs across MCP sessions - #96

Open
aiforlove wants to merge 1 commit into
rebel0789:mainfrom
aiforlove:codex/fix-cross-session-workspace-registry-pr
Open

fix(http): preserve workspace IDs across MCP sessions#96
aiforlove wants to merge 1 commit into
rebel0789:mainfrom
aiforlove:codex/fix-cross-session-workspace-registry-pr

Conversation

@aiforlove

@aiforlove aiforlove commented Aug 18, 2026

Copy link
Copy Markdown

What

Share the HTTP server workspace registry across MCP sessions. An explicitly supplied workspace_id opened by one HTTP session can now be adopted by another session, while implicit selected-workspace state remains session-local. The regression smoke covers two descendant worktrees in parallel sessions.

Why

ChatGPT and other MCP clients can keep a workspace_id from an earlier tool call and send it through a later MCP session. Without this change, valid descendant repository or worktree IDs fail with Unknown workspace_id or fall back to a default root.

Root cause

Each Streamable HTTP initialize created a new CodexPro server and WorkspaceManager. The workspace map was therefore session-local, and the old fallback only recognized exact configured roots rather than descendants that had been opened previously.

Impact

Explicit workspace IDs are resolved through a process-lifetime registry and then adopted into the current session. Implicit selection is unchanged and remains isolated per session. The registry is intentionally in-memory; after a process restart, clients must call open_workspace again.

Security

This does not expand allowedRoots, authentication, or path permissions. The registry only records canonical roots already accepted by PathGuard, and explicit IDs still go through the existing validation. No credentials, tokens, local paths, or tunnel configuration are included.

Tests

  • npm ci
  • npm run build
  • npm run smoke
  • git diff --check

Related to #91.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant