Skip to content

Commit becd03b

Browse files
fix(mcp): keep createAndStore's state lookup inside its marker block
The previous change shifted the diff, so Marker Guard read the upstream lookup as unmarked. The race test now also asserts that a superseded `authenticate()` returns `disabled`. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_0172qrhMa5TQgETASi5hxMqD
1 parent a2b0ad8 commit becd03b

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

‎packages/opencode/src/mcp/index.ts‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1022,11 +1022,10 @@ export const layer = Layer.effect(
10221022
mcp: ConfigMCPV1.Info,
10231023
token: number,
10241024
) {
1025-
// altimate_change end
10261025
const s = yield* InstanceState.get(state)
1027-
// altimate_change start — a remove, disconnect or newer add/connect that runs while
1028-
// this one is connecting supersedes it: committing then would bring a removed server
1029-
// back or overwrite the newer config, so this attempt closes its own client instead.
1026+
// A remove, disconnect or newer add/connect that runs while this one is connecting
1027+
// supersedes it: committing then would bring a removed server back or overwrite the
1028+
// newer config, so this attempt closes its own client instead.
10301029
if (!isCurrent(s, name, token)) return s.status[name] ?? ({ status: "disabled" } satisfies Status)
10311030
const result = yield* create(name, mcp)
10321031
if (!isCurrent(s, name, token)) {

‎packages/opencode/test/mcp/oauth-auto-connect.test.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,8 +316,9 @@ mcpTest.instance(
316316
yield* Effect.promise(() => wasTaken)
317317
yield* mcp.remove("test-oauth-removed")
318318
release()
319-
yield* Fiber.join(authenticating)
319+
const result = yield* Fiber.join(authenticating)
320320

321+
expect(result.status).toBe("disabled")
321322
expect((yield* mcp.status())["test-oauth-removed"]?.status).not.toBe("connected")
322323
expect((yield* mcp.clients())["test-oauth-removed"]).toBeUndefined()
323324
expect(closedClients).toBe(closedBefore + 1)

0 commit comments

Comments
 (0)