Skip to content

mcpx: fingerprint generated operations and reject stale plugin tables - #5320

Merged
dezren39 merged 5 commits into
mainfrom
queue/8772-4811-plugin-table-hash
Nov 5, 2026
Merged

dezren39 merged 5 commits into
mainfrom
queue/8772-4811-plugin-table-hash

Conversation

@dezren39

@dezren39 dezren39 commented Nov 4, 2026 •

Copy link
Copy Markdown
Member

Summary

DaemonClient.ops
  verify /v1/health operationFingerprint
  reject unavailable, missing, or mismatched fingerprints with remediation
  send generated operation only when the table matches

api.OperationFingerprint() hashes a canonical projection of the /v1 operation table; PluginTS() embeds the same stamp in ops.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 current origin/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.


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

@dezren39
dezren39 requested a review from a team as a code owner November 4, 2026 06:26
@coderabbitai

coderabbitai Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You'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.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 1df839d1-8310-41fb-9306-1b37eefd3185
Commits

Reviewing files that changed from the base of the PR and between 864ed8a and 3e75780.

Files selected for processing: 11
  • .opencode/plugin/mcpx/daemon.test.ts
  • .opencode/plugin/mcpx/daemon.ts
  • .opencode/plugin/mcpx/ops.gen.ts
  • .opencode/plugin/mcpx/ops.test.ts
  • pkgs/mcpx/internal/api/ops_test.go
  • pkgs/mcpx/internal/api/plugin_ts.go
  • pkgs/mcpx/internal/daemon/server.go
  • pkgs/mcpx/plugin/opencode/mcpx/daemon.test.ts
  • pkgs/mcpx/plugin/opencode/mcpx/daemon.ts
  • pkgs/mcpx/plugin/opencode/mcpx/ops.gen.ts
  • pkgs/mcpx/plugin/opencode/mcpx/ops.test.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-04T14:45:31.660239Z 3e75780 New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Comment on lines +400 to +401
constructor(readonly target: Target) {
this.ops = new DaemonOps((path, init) => this.operationFetch(path, init));

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

developing-today[bot] added 2 commits November 4, 2026 08:38
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.
@dezren39
dezren39 merged commit cee31ad into main Nov 5, 2026
1 check passed
@dezren39
dezren39 deleted the queue/8772-4811-plugin-table-hash branch November 5, 2026 01:54
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.

1 participant