Skip to content

feat(id-caps): MCP bridge translator + end-to-end world session (#7914 criterion 1) - #13161

Merged
dezren39 merged 1 commit into
mainfrom
lane-lb-7914
Nov 23, 2026
Merged

dezren39 merged 1 commit into
mainfrom
lane-lb-7914

Conversation

@dezren39

@dezren39 dezren39 commented Nov 23, 2026 •

Copy link
Copy Markdown
Member

For #7914 — this lands criterion 1, the last open acceptance criterion. (The PR body deliberately carries the closing reference below: criteria 2 and 3 landed with PR #12917, and criterion 1 is proven by the new end-to-end test in this PR.)

What lands

The bridge translator (id_caps::mcp_bridge, design #6300 sections 3 and 4.4). BridgeSession now translates each of the seven pinned v1 tool calls into the bridge driver's next step:

  • world.join → the agent-profile join frame (mirrors the native shell's agent_join_frame shape)
  • screen.subscribe → the screen_subscribe frame (region and/or event classes, validated)
  • chat.post → the chat frame, with the caller's stale-decision token when supplied (section 4.3)
  • screen.read → answered locally from the observed frames: latest full view text plus the semantic-diff changes since the previous read (reading drains them; patch views never blank the screen)
  • object.inspect → answered locally from the object_changed changes observed so far
  • world.leave → ToolAction::Close (presence in the F13.1 contract is connection-scoped; there is no leave frame)
  • presence.set → refused with the typed BridgeError::NoFrameMapping — the contract carries presence only as the join itself, so there is no presence frame to send

Session state is enforced bridge-side: session tools refuse before a join (NotJoined), a second join is refused (AlreadyJoined), unknown tools are refused (UnknownTool), and a definition mismatch terminates translation (Terminated).

The end-to-end proof (pkgs/id/tests/mcp_bridge_e2e.rs, covered by the facade test glob in the suite registry — no registry edit needed): a live WorldService host (tic-tac-toe installed) served over iroh on loopback. The agent side is driven purely by tool calls through the translator; a second participant joins raw and posts chat. The test proves: join delivers a view the bridge renders; the subscription is acked; the other participant's chat arrives as a pushed semantic_diff and surfaces through screen.read exactly once; the agent's chat.post lands as the durable event at sequence 3; world.leave closes; and the host journal (admin fixture record) holds both chats in order with current_sequence 3.

The facade gains an iroh-blobs dev-dependency (already in the lock as a normal dependency; Cargo.lock unchanged) for the test host's in-memory blob store.

Verification

  • cargo test -p id-caps — 216 lib tests (10 new translator unit tests) + 3 surface tests, all green; the surface suite gains a coverage test: every surface tool translates or names its missing mapping, and the five forbidden non-tools never translate.
  • cargo test --test mcp_bridge_e2e — 1 passed (2.11s).
  • cargo fmt — the changed files are fmt-clean (the workspace has 49 pre-existing fmt diffs in unrelated files on main; untouched here).
  • cargo clippy -p id-caps --all-targets — no findings in the new code; the run still fails on 26 pre-existing deny-lint errors in library_attach.rs test code and one pre-existing warning in definition_hash, both untouched by this PR and present on main.

Closes #7914


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

…7914

BridgeSession now translates the seven v1 tool calls into F13.1
client frames, local answers rendered from the server frames observed
so far, or a session close, and tracks the screen state (latest full
view, pending semantic-diff changes, observed objects) that
screen.read and object.inspect are answered from. presence.set is
refused with a typed NoFrameMapping: the F13.1 contract carries
presence only as the join itself, so there is no presence frame.

pkgs/id/tests/mcp_bridge_e2e.rs proves criterion 1 of #7914 over iroh
on loopback against a live world host: the agent joins, subscribes to
chat_posted, reads the other participant's chat from the pushed
semantic diff through screen.read (drained by the read), posts chat
that lands durably in the host journal, and leaves. The facade gains
an iroh-blobs dev-dependency for the test host's blob store.
@chatgpt-codex-connector

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

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-23T09:31:30.544222Z 66528cc PR opened
ℹ️ 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.

@coderabbitai

coderabbitai Bot commented Nov 23, 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 42 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: 65803b14-16c1-43ba-a2eb-5ce83251a59a
Commits

Reviewing files that changed from the base of the PR and between 175de3c and 66528cc.

Files selected for processing: 4

  • pkgs/id/Cargo.toml
  • pkgs/id/crates/id-caps/src/mcp_bridge.rs
  • pkgs/id/crates/id-caps/tests/mcp_bridge_surface.rs
  • pkgs/id/tests/mcp_bridge_e2e.rs
  • 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

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.

id(phase-14): spike 2/5 — MCP bridge: join, read screens, post chat

1 participant