Skip to content

fix(test): MCP sandbox 断言对齐 #917 的 _meta 回显 - #949

Merged
deepcoldy merged 1 commit into
masterfrom
fix/test-mcp-sandbox-meta-assert
Aug 20, 2026
Merged

fix(test): MCP sandbox 断言对齐 #917 的 _meta 回显#949
deepcoldy merged 1 commit into
masterfrom
fix/test-mcp-sandbox-meta-assert

Conversation

@LucasIcarus

@LucasIcarus LucasIcarus commented Aug 20, 2026

Copy link
Copy Markdown
Collaborator

优先级:P1(master build 当前红灯,本 PR 转绿)

根因

#917 给 MCP fixture 的 echo 加上 meta=${JSON.stringify(_meta ?? {})},用来验证 _meta.botmuxTrustedCallerplugin-mcp-gateway 已改成只断言 session= / token=plugin-mcp-sandboxtoContain('alpha:echo:{"value":1}:session=...')

无宿主身份时实际回显是 alpha:echo:{"value":1}:meta={}:session=...,连续子串断裂。该文件 skipIf Linux + 可用 bwrap,macOS 本机会 skip,合入后 Linux CI 才红。

改动

  • test/plugin-mcp-sandbox.test.ts:分段断言 alpha:echo:{"value":1}session=${id}:token=host-only-token,与 gateway 测试对齐。
  • 不改 Gateway / worker / sandbox 运行时,也不放宽「token 不进沙箱」的隔离断言。

影响面

  • 仅测试断言。覆盖的是 Linux bwrap 下 session MCP 经 trusted host 转发;其它 CLI、后端、会话类型无行为变化。
  • 跨平台:该文件本就只在 Linux + bwrap 跑;macOS / 无 bwrap 继续 skip。
  • 跨 CLI / 跨后端 / 跨会话类型:不触及 adapters/worker.tsdaemon.ts

验证

  • pnpm build 通过。
  • pnpm exec vitest run test/plugin-mcp-sandbox.test.ts test/plugin-mcp-gateway.test.ts --reporter=dot:gateway 20 通过;sandbox 3 skip(本机非 Linux/bwrap,与改前相同)。sandbox 两条失败用例需 Linux CI 实跑确认。

Co-authored-by: Cursor <cursoragent@cursor.com>

#917 给 fixture 加上 meta= 字段后,旧的连续子串不再成立;session/token 转发本身没坏。
@LucasIcarus
LucasIcarus requested a review from deepcoldy as a code owner August 20, 2026 02:33
@deepcoldy
deepcoldy merged commit bd5d5b9 into master Aug 20, 2026
6 checks passed
@github-actions

Copy link
Copy Markdown

🚀 Released in v3.16.0

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.

2 participants