Skip to content

fix(opencode): isolate workspace config state - #41945

Open
Nath-Vikky wants to merge 1 commit into
anomalyco:devfrom
Nath-Vikky:config-workspace-isolation
Open

fix(opencode): isolate workspace config state#41945
Nath-Vikky wants to merge 1 commit into
anomalyco:devfrom
Nath-Vikky:config-workspace-isolation

Conversation

@Nath-Vikky

Copy link
Copy Markdown

Issue for this PR

Closes #41916

Type of change

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

What does this PR do?

Nested values merged from the global config cache could retain shared references. A plugin config hook mutating one workspace could therefore leak MCP configuration into workspaces loaded later by the same process.

This returns a structured clone from Config.getGlobal() before workspace merging. Plugin hooks can still mutate their workspace config, while the global cache and other workspaces remain isolated.

A regression test covers two workspaces loaded in the same process.

How did you verify your code works?

  • bun test test/config/config.test.ts --timeout 30000 — 97 passed
  • bun x prettier --check src/config/config.ts test/config/config.test.ts
  • git diff --check

Screenshots / recordings

Not applicable.

Checklist

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

@Nath-Vikky
Nath-Vikky marked this pull request as ready for review August 12, 2026 04:17
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.

Plugin config hooks can mutate process-shared config state via shallow-merged nested objects

1 participant