Repository navigation
fix(oni-mcp): preserve legacy routing over future request metadata - #40
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
There was a problem hiding this comment.
Sorry @LIghtJUNction, you've used your own review budget of 250,000 diff characters for the last 7 days.
You can request another review in 3 days and 5 hours by commenting @sourcery-ai review. Upgrade to get a review now.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
审查者指南更新现代 POST 路由逻辑:将受支持的旧版标头和已建立的旧版会话视为高于未来预留元数据的权威来源,同时允许显式现代标头优先,并保留无标头现代验证。新增覆盖两种兼容方向的线路级回归测试,并确认不会意外更改旧版会话状态。 保留旧版行为的 MCP POST 路由流程图flowchart TD
A[HTTP POST request] --> B[TryHandleModernPost]
B --> C{IsSupportedProtocolVersion protocolVersion}
C -->|yes| L[Legacy initialize or session path]
C -->|no| D{explicitModern header}
D -->|no| E{IsSessionActive sessionId}
E -->|yes| L
E -->|no| F{modern metadata signal}
D -->|yes| M[Modern handling]
F -->|yes| M
F -->|no| N[Request not handled as modern]
M --> O[Strict modern header validation]
文件级变更
可能相关的问题
提示和命令与 Sourcery 交互
自定义使用体验访问你的控制面板以:
获取帮助Original review guide in EnglishReviewer's GuideUpdates modern POST routing to treat supported legacy headers and established legacy sessions as authoritative over future reserved metadata, while allowing explicit modern headers to win and preserving headerless modern validation. Adds wire-level regressions covering both compatibility directions and confirms no unintended legacy session state changes. Flow diagram for legacy-preserving MCP POST routingflowchart TD
A[HTTP POST request] --> B[TryHandleModernPost]
B --> C{IsSupportedProtocolVersion protocolVersion}
C -->|yes| L[Legacy initialize or session path]
C -->|no| D{explicitModern header}
D -->|no| E{IsSessionActive sessionId}
E -->|yes| L
E -->|no| F{modern metadata signal}
D -->|yes| M[Modern handling]
F -->|yes| M
F -->|no| N[Request not handled as modern]
M --> O[Strict modern header validation]
File-Level Changes
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Root cause / external basis
Official MCP C# SDK PR modelcontextprotocol/csharp-sdk#1852 (merged 2026-09-13, commit
324ccd83c357acf611e1cf3a6935a945ee600442) fixes a P1 interoperability problem where ChatGPT negotiated the legacy2025-11-25era but later sent reserved_metafields introduced by2026-07-28. The SDK now treats an established legacy session or an explicit supported legacy transport version as authoritative; future reserved metadata stays opaque and must not silently switch the request into the modern era.OniMcp's
TryHandleModernPostpreviously selected the modern path when either the HTTP protocol header or body_meta.io.modelcontextprotocol/protocolVersionwas2026-07-28. That could divert a valid legacy-session request into modern header validation and return-32020 HeaderMismatch.Design
Mcp-Protocol-Versionvalues stay on the existing initialize/session path even if the body carries future metadata.Mcp-Session-Idstays on the legacy path when there is no explicit modern transport header.2026-07-28header still wins over a legacy session id; this avoids accidental downgrade of an authoritatively modern request._meta.Files
mods/OniMcp/Server/McpHttpServerModernProtocol.cstests/OniMcp.ModernProtocol.Tests/Program.csRegression coverage
Raw HTTP tests now cover:
initializefollowed bytools/listwith explicit2025-11-25plus future 2026_meta=> remains legacy and succeeds;_meta=> remains legacy and succeeds;2026-07-28plus a legacy session id => remains modern and returns the expected moderntools/listmethod-not-found result;-32020for the missing modern protocol header;Compatibility / risk
This is transport routing only. It does not change game state, tools, world-editor behavior, save data, Tasks, or the modern capability advertisement. Legacy
2025-11-25/2025-06-18behavior is preserved; strict modern validation is preserved once the request is authoritatively modern.No actual ONI runtime is required to validate the routing logic, but the pinned ONI reference build should still compile this change before merge.
Refs #24
Sourcery 摘要
在混合时代的请求元数据中,保留权威的旧版和现代 MCP 传输路由。
错误修复:
增强功能:
测试:
Original summary in English
Summary by Sourcery
Preserve authoritative legacy and modern MCP transport routing across mixed-era request metadata.
Bug Fixes:
Enhancements:
Tests: