MCP diagnostics are process-global, so one project's discovery erases another's
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 55/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- typescript
Direzione di ricerca
Inizia dai record denominati in packages/opencode/src/mcp/discover.ts e packages/opencode/src/config/variable.ts, quindi segui i relativi chiamanti in cli/cmd/mcp.ts, session/prompt.ts e config/config.ts. Il lavoro è completato quando la diagnostica è delimitata da projectDir, la discovery di un progetto non cancella né sovrascrive più quella di un altro e la correzione delle entry obsolete di #1121 continua a essere valida.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Summary
The four MCP diagnostic records are module-level singletons keyed by server name alone, with no notion of which project they belong to. In a process serving more than one project — altimate serve, which is how the extension and every hosted user reach the agent — a second project's discovery erases the first's diagnostics, and two projects that reuse a server name overwrite each other.
| record | file |
|---|---|
_unresolvedEnv |
packages/opencode/src/mcp/discover.ts:53 |
_drift |
packages/opencode/src/mcp/discover.ts:83 |
_discoveredSource |
packages/opencode/src/mcp/discover.ts:156 |
_blankedEnv |
packages/opencode/src/config/variable.ts:37 |
Reproduction
Two temp projects, each with a .vscode/mcp.json whose server has one unresolved {env:VAR}. Run against d00931b5e6 (current main):
after A: unresolvedEnvVars('alpha') = ["ALTIMATE_REPRO_VAR_A"]
after B: unresolvedEnvVars('alpha') = [] ← erased
after B: unresolvedEnvVars('beta') = ["ALTIMATE_REPRO_VAR_B"]
And with both projects using the same server name:
shared name: unresolvedEnvVars('datamate') = ["ALTIMATE_REPRO_VAR_B"] ← A's answer gone
datamate is not a hypothetical collision — it is the name the extension sync writes into every project.
Why it happens
discoverExternalMcp(projectDir) clears all three of its records at the top of the run and repopulates them afterwards. That was deliberate — it is what stops a variable that has since been fixed from being reported forever (#1121) — but the clear is global, so it takes the other project's entries with it. _blankedEnv has the same shape: blankedEnvVars() returns every config source ever parsed in the process, not the active project's.
The clear also sits before the first await while the writes happen after several, so concurrent discovery can interleave one project's clear with another's writes.
Impact
mcp list, mcp status and /mcps are the surfaces people use when a server will not connect. Under altimate serve — the path users actually run, not a niche debugging mode — they can report:
- nothing, for a project whose diagnostics another project cleared
- another project's variable names, under a shared server name
- drift attributed to a file belonging to a different project
A wrong answer here is worse than none, because the whole point of #1121/#701/#790/#878 was to stop people guessing.
Suggested fix
Key each record by projectDir and take the project as a parameter:
export function unresolvedEnvVars(server: string, projectDir: string): string[]
export function configDrift(projectDir: string): { server: string; source: string; fields: string[] }[]
export function discoveredSource(server: string, projectDir: string): string | undefined
export function blankedEnvVars(projectDir: string): { source: string; names: string[] }[]
A discovery run then clears only its own project's entries, which keeps the staleness fix from #1121 while making the clear harmless to everyone else. This is the InstanceState convention the rest of the codebase already follows for per-directory state.
Call sites to update: cli/cmd/mcp.ts (reportConfigDiagnostics), session/prompt.ts (/mcps), and config/config.ts (drift recording).
Provenance
Flagged independently by cubic, kilo, and the harness bot across #1159 and #1160, and deliberately deferred from both as too broad for those PRs.
- Lingua principale
- TypeScript
- Stelle
- 815
- Fork
- 135
- Merge medio
- 1g 18h
- PR unite (30g)
- 59
Preparare l'ambiente
Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di AltimateAI/altimate-code
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
AltimateAI/altimate-code#1378 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
AltimateAI/altimate-code#1359 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
AltimateAI/altimate-code#1323 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
AltimateAI/altimate-code#1288 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 92/100
AltimateAI/altimate-code#1285 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di AltimateAI/altimate-code
Issue simili
-
priority: P2
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
prime-radiant-inc/evener#3291 ·
I maintainer di solito rispondono entro 1 giorno
-
accessibility bug revealjs
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
quarto-dev/quarto-cli#14961 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
supabase/agent-skills#614 ·
-
Content
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
RunestoneInteractive/rs#1559 · 1 commento ·
I maintainer di solito rispondono entro 2 giorni