Skip to content

feat(core): add WorkspaceContext#15409

Merged
jlongster merged 1 commit intodevfrom
jlonster/workspace-context
Mar 1, 2026
Merged

feat(core): add WorkspaceContext#15409
jlongster merged 1 commit intodevfrom
jlonster/workspace-context

Conversation

@jlongster
Copy link
Contributor

Breaking my latest work into small PRs. This one adds a new context that code that use to get the workspaceID

I didn't want to introduce a new concept initially, and tried to add a workspaceID getter to Instance instead. That turned out to cause all sorts of confusion though: sometimes only directory is available and no workspace id (that won't be the case long-term, but we will need a phase of migration), and the other way around too. In particular, it caused a lot of confusion due to caching of the context value internally; do we cache based on directory or workspace id? It should be workspace id, but sometimes that isn't available

Pulling it out into a new WorkspaceContext simplified everything. This is purely internal and publicly people won't be dealing with both instances and workspaces.

Similar to directory, this adds a new way to "route" requests: you can specify a workspace url param or use the x-opencode-workspace header to scope your action to a specific workspace. Eventually, everything will be a workspace, even your default local repo.

I have more work which builds on this to rework the router in control-plane to leverage it and will open more once this lands.

@jlongster jlongster requested a review from thdxr February 27, 2026 22:30
@jlongster jlongster merged commit cec16df into dev Mar 1, 2026
12 checks passed
@jlongster jlongster deleted the jlonster/workspace-context branch March 1, 2026 01:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant