← Back to Pull requests

feat(mcp): make the gateway operable by agents end-to-end #158

Closed
unknown closed this pull request without merging on Aug 04, 2026 17:10 UTC
View on GitHub
unknown unknown commented on Aug 04, 2026 16:23 UTC
Author

What

An audit of every agent-facing surface (43 tool descriptions, 4 doc resources, 3 prompts, annotations, error envelopes) found ten evidence-backed friction points. This PR fixes all ten, including three behavior changes called out below.

Boundary flow was unusable over flat tools (behavior change)

The Boundary gate requires a pre-saved checkpoint naming the exact commandId/attemptId of the command — but flat tools minted both internally and never surfaced them, so intent_submit_and_verify / boundary click could never pass it over MCP (only command_execute with hand-built envelopes worked).

  • intent_* tools and click accept optional commandId/attemptId, threaded through unchanged.

  • Every outcome now echoes attemptId alongside workflowId/commandId.

  • fill_and_submit_form prompt rewritten to the only working order — snapshot → fill → pin ids → checkpoint → submit — and states the exact CompleteFormField/ExtractField shapes (verbatim compliance previously earned a schemaViolation).
  • isError mirrors outcome status (behavior change)

    Failed commands returned isError: false, so any host pattern of "check isError, else continue" silently walked past failures. Now isError: true for retryableFailure/needsReconciliation/policyDenied/resourceExhausted/failed; restarted/resumed stay success (recovery decisions). The one test pinning the old behavior updated.

    Repair docs ungated (behavior change)

    bobby://capabilities|failure-taxonomy|intents|primitives were behind artifact:read — an agent that just got missingCapability couldn't read why. Static docs are now readable by any authenticated principal; artifact:// entries stay gated; revoked/expired principals are still denied (distinguished by error code, test-pinned).

    Schema/annotation accuracy

  • failure-taxonomy gains the RPC-layer InterfaceErrorCode table (all 14 codes with repairs).

  • Advertised errorCode enum: +targetObscured/targetOutOfBounds (29/29), pinned by a schemars parity test so it can't drift again.

  • readOnlyHint: +wait_for, intent_locate, intent_wait_for_state, intent_extract. openWorldHint: +page_open, click, intent_follow, intent_submit_and_verify.

  • network_log description names both real failure codes.

  • checkpoint_save/intent_submit_and_verify descriptions teach the pin mechanism; SKILL.md rules updated; docs guides synced (incl. regenerated v0.5.0 tree).
  • tools/list budget

    New schema fields pushed the list over the 128 KiB connect budget; id() is now a ` ref, netting 125,224 bytes with 5,848 headroom (was 167).

    Verification

  • cargo test -p mcp-gateway: all 11 suites green, incl. new tests for pinned-id threading/echo, doc access without artifact:read (+ denial on artifact://), and errorCode wire parity.

  • clippy, cargo fmt --check, cargo check --workspace --all-targets: clean.

  • npm run docs:verify + docs:test`: 17/0.
  • Diff: 372 lines (+279 / -93) across 4 files Reviewer: sasan1200 Review duration: 47m
    All Vouch review confidence checks passed
    Residual risk 0.17 = Change Risk (0.43) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.43 · 372 lines diff across 4 files
    0.43
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.354
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #158"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 42.8% (MEDIUM) · Higher = larger blast radius
    42.8%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 16.9% · Safe to merge
    16.9%