Repository navigation
Simplify MCP content handling in the payload fast path - #16615
Conversation
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
There was a problem hiding this comment.
🟢 Approval recommended
There are no active review issues for the middleware payload fast-path simplification.
No open issues 🎉
What changed in this PR
Simplifies the middleware’s payload fast path by removing duplicate content-slice handling while preserving single-item checks and leaving strict SDK conversion unchanged.
Changes:
- Replaces the dual-shape switch with a raw
[]anylength guard so normalization cannot hide extra entries. - Adds regression coverage confirming oversized non-map entries before or after text trigger storage and remain in the stored payload.
| File | Description |
|---|---|
internal/middleware/jqschema.go |
Simplifies the fast-path guard while preserving raw entry counts. |
internal/middleware/jqschema_test.go |
Tests payload preservation with non-map entries in both positions. |
Review effort: Balanced (dynamic)
🔒 mcpg Read-Only Stress — defaultSurface coverage: MCP tool calls + proxied CLI (REST) + GraphQL mutations
Overall: INCONCLUSIVE Details:
No write leaked on any surface that was reachable. Gaps (absent write tools, unauthenticated gh) prevent full confirmation of gateway-level write blocking for this run; this is a known methodology limitation for the tools.github: wrapper, not a detected regression.
|
The payload fast path duplicates slice-shape handling after normalization. Because normalization skips non-map entries, normalized length alone cannot establish a single-item envelope.
[]anyraw-length guard.