Repository navigation
mcpx: fingerprint generated operations and reject stale plugin tables - #5320
Conversation
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 36 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4b458563e6
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| */ | ||
| readonly ops: DaemonOps = new DaemonOps((path, init) => this.raw(path, init)); | ||
| private async operationFetch(path: string, init: RequestInit): Promise<Response> { | ||
| await this.assertOperationCompatibility(); |
There was a problem hiding this comment.
Update existing operation-test fakes for the health handshake
The shared fake in plugin/opencode/mcpx/ops.test.ts forwards every request to the operation-specific reply callback, so the new /v1/health request receives responses without a fingerprint, non-JSON text, or an error status. Consequently, the existing generated-operation and DaemonClient.exec tests reject before reaching the operations they exercise. Their seen[0] assertions also assume there is no preceding health request. Update that fake to answer fingerprinted health requests separately from operation recording; otherwise the full plugin suite invoked by .github/workflows/mcpx.yml fails despite the new compatibility tests passing.
Useful? React with 👍 / 👎.
| constructor(readonly target: Target) { | ||
| this.ops = new DaemonOps((path, init) => this.operationFetch(path, init)); |
There was a problem hiding this comment.
Synchronize the dogfood plugin with the updated client
The repository's active .opencode/plugin/mcpx-session.ts imports ./mcpx/daemon.ts, but this commit updates only the packaged copy. The two client files were identical before this commit; the dogfood copy still sends generated operations directly through raw() and has no fingerprint check, so the repository's own plugin does not receive the stale-table protection introduced here. Synchronize the changed client, generated table, and tests into .opencode/plugin/mcpx; the existing copy-synchronization step in .github/workflows/mcpx.yml also rejects this divergence.
Useful? React with 👍 / 👎.
The generated-operation fakes in ops.test.ts forwarded /v1/health to the operation reply callback, so every client.ops and exec test stopped at the new fingerprint check. Answer the handshake separately and keep it out of the recorded requests. Sync the dogfood copy under .opencode/plugin/mcpx, which the mcpx workflow's plugin-sync guard diffs against the packaged plugin.
Summary
api.OperationFingerprint()hashes a canonical projection of the /v1 operation table;PluginTS()embeds the same stamp inops.gen.ts, and daemon health/status publish it. The generated OpenCode client fails closed before invoking stale operations.Evidence
go test ./internal/api -count=1— PASS after merging currentorigin/main(includes generated-file guard).bun test plugin/opencode/mcpx/daemon.test.ts— PASS, 27 tests / 76 assertions after merge.go test ./internal/daemon -count=1— PASS before merging current main (63s); after merge, two attempts were terminated by the host (signal: terminated, no test assertion output). CI should verify this suite on the pushed head.git diff --check— PASS before merge.Merge Danger
Door: two-way — revert restores the previous behavior.
Blast Radius: bounded — generated OpenCode plugin operations fail closed when the daemon's API table cannot be verified or differs; compatible daemon/plugin pairs continue as before.
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.