Repository navigation
fix(mcp): accept structured initialization capabilities - #792
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
PR SummaryMedium Risk Overview Peekaboo drops its custom Separately, a watch capture session test is rewritten to assert cancellation of a pending transient ScreenCaptureKit retry via completion signals (two attempts, no fabricated transient warning), replacing a flaky elapsed-time bound—test-only, no production behavior change. Reviewed by Cursor Bugbot for commit 5ef2e63. Bugbot is set up for automated code reviews on this repo. Configure here. |
|
Codex review: needs maintainer review before merge. Reviewed September 24, 2026, 11:23 AM ET / 15:23 UTC (Revision 3). ClawSweeper reviewWhat this changesThe branch pins an upstream Swift MCP decoder repair, removes an overwritten initialize handler, adds wire and CI coverage and migration notes, and updates a watch-stop test to observe cancellation instead of elapsed time. Merge readiness✅ Ready for maintainer review Current main and v4.5.0 still pin the SDK version that rejects the reported handshake. This PR addresses that failure, the maintainer has accepted the documented Swift migration, and this review found no actionable patch defect. Priority: P1 Review scores
Verification
How this fits togetherPeekaboo exposes desktop tools to MCP clients through its CLI or a host-supplied transport. The Swift MCP SDK decodes a client's initialize request before Peekaboo can return its tool catalog. flowchart LR
A[MCP client] --> B[Initialize request]
B --> C[Swift SDK capability decoder]
C -->|valid| D[Protocol negotiation]
D --> E[Peekaboo tool catalog]
C -->|malformed| F[Initialization error]
Before mergeNone. Agent review detailsSecurityNone. Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Technical reviewBest possible solution: Land the upstream decoder repair with raw-wire regression coverage, then move the temporary SHA pin to a tagged SDK release containing it. Do we have a high-confidence way to reproduce the issue? Yes. The linked issue supplies a raw stdio payload and a reported 4.5.0 failure/control pair, while current main still pins the string-valued decoder; this read-only review did not execute the request. Is this the best way to solve the issue? Yes. Adopting the upstream JSON-value decoder fixes the failing boundary while the wire tests preserve rejection of malformed known capabilities; the removed handler was replaced by SDK startup. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 35c754e7ae88. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
History |
|
Taking maintainer qualification and landing ownership of this existing repair. The exact upstream I will preserve the decoder repair and tests, reconcile the release note with current main, and use exact-lease branch updates. Please coordinate any further branch changes with this qualification pass so we do not race or invalidate the tested head. No additional workaround or duplicate PR is needed. |
483b588 to
efc623a
Compare
Replace the whole-session 80 ms timing assertion with the real fallback runner cancellation result and exact attempt count. Reuse the existing bounded completion signals and preserve frame and warning assertions without changing production code or timeout values.
MCP clients sending structured experimental capabilities, including
{"codex/auth-change": {}}from Codex, could not initialize Peekaboo: the SDK decoded those values as strings and returned-32603. Fixes #745. Thanks @Wudib for the report.Pin the single upstream decoder repair from swift-sdk#276, commit
f7077e0d5cd57e0b2a497862017aa94ee344252f, directly atop the existing 0.12.1 dependency. Core, CLI, Mac, and Xcode select the same revision. The SDK retains arbitrary JSON capability values while malformed known capability shapes still fail. Remove the custom initialize handler that SDK startup always replaced, keeping negotiation and initialization state owned by the SDK.The temporary pin should move to a tagged SDK containing the repair when available. The SDK's Swift
experimentalproperty becomes[String: Value]?; integrations passing a typed string dictionary needmapValues(Value.string), as documented. A compile-only Swift 6 consumer check against the exact pinned MCP module verified that contextual legacy string literals compile, a typed[String: String]fails without conversion, andmapValues(MCP.Value.string)compiles. CLI and wire JSON syntax are unchanged. The public root Peekaboo package does not depend on MCP; this affects the Core/AgentRuntime consuming graph, not every public Swift product. The Tachikoma submodule and its standalone manifest remain unchanged.Original repair proof reproduced the failure and empty-capability control with the published 4.5.0 CLI. All 29 native wire/server/EOF tests passed, including seven initialization payload cases and real
tools/listresponses. Nineteen unchanged upstream request tests passed in an isolated Swift 6.3.3 Linux target; the broader upstream test target had unrelated HTTP/OAuth test-helper concurrency compile errors. Portable repository checks, focused format/lint, and the original independent review passed. CI now exercises structured initialization through the built CLI's stdio transport.Maintainer qualification at
efc623a6a1f7e220b1b0d903044f5d4646c9e2d1preserves the original repair and all nine non-changelog changed files byte-for-byte, rebased onto main at35c754e7ae88c9e8634f2b83ef02da08743a2c1e. The full rebased patch passed independent scoped P0 autoreview with no actionable findings. The affected Core suite passed 106 tests, including initialization, server lifecycle, argument validation, background policy, catalog filtering, and remote browser-session contracts. The complete non-automation CLI suite passed 1,459 tests (1,270 CoreCLI, 50 certification, 139 runtime). The exact-source CLI built successfully and passed Developer ID signature, Team ID, compatibility-library, and embedded source-stamp verification. Consumer source and module hashes remained unchanged through their type-check proof.The signed CLI also passed a read-only raw-stdio test against the unchanged signed 4.5.0 GUI host in 2.238 seconds: five accepted cases (structured and nested experimental values, scalars, extensions, and empty capabilities), two malformed cases rejected with the existing
-32603contract, successful catalogs and permission reads, and clean EOF for all seven clients. Two simultaneous clients retained independent disconnected browser scopes before and after the first client's cleanup. The default catalog did not expose browser connect; no browser attachment, UI input, AppleScript, host restart, or provider key was used.All five macOS CI jobs passed on that head. Supplemental Core validation then exposed one existing fixture failure among 3,268 tests: a watch-stop test measured full-session completion, including contact-sheet creation, metadata writes, and detached artifact validation, against an 80 ms cancellation bound. The test and production code were unchanged by the MCP repair. Commit
5ef2e6321babb2da6af98a20264b902dc9a8b395replaces only that test's timing guess with the real fallback runner's propagated cancellation, exactly two capture attempts (one successful frame and one transient failure), and the preserved frame/warning assertions. It accurately tests a pending retry, reuses the existing completion watchdog unchanged, and changes no production behavior or timeout values. The complete candidate passed fresh independent P0 autoreview, all 39 focused watch/fallback-runner tests, formatting/lint, and ten additional exact-case repeats.The maintainer accepts the documented Swift migration for this confirmed protocol defect. Final head
5ef2e6321babb2da6af98a20264b902dc9a8b395passed all five macOS jobs, all four supplemental suites including full-safe, and all CodeQL analyses, each on its first attempt. The exact-head ClawSweeper review is also ready with no actionable findings. Prior-head results are recorded above for attribution, not substituted for the final gates. This PR changes source only and does not publish a release.