Skip to content

Add durable profile and proxy MCP contract parity - #140

Merged
IlyaasK merged 5 commits into
hypeship/mcp-browser-pool-contractfrom
hypeship/mcp-durable-contract-parity
Aug 7, 2026
Merged

Add durable profile and proxy MCP contract parity#140
IlyaasK merged 5 commits into
hypeship/mcp-browser-pool-contractfrom
hypeship/mcp-durable-contract-parity

Conversation

@IlyaasK

@IlyaasK IlyaasK commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Summary

  • make profile setup use exact-name filtering and reject ambiguity
  • add profile and proxy rename actions
  • preserve stable API error codes in MCP failures
  • bind profile setup browsers to the resolved profile ID

Why

Durable MCP operations should resolve stable identities and surface actionable API failures. Search-style profile matching and name reuse could otherwise select the wrong durable profile.

Implementation

Profile setup filters by exact name, rejects duplicate exact matches with an executable recovery path, and uses the resolved ID when opening the setup browser. Rename guidance warns before invocation about active profile sessions. Rename responses retain their direct SDK resource shape.

Verification

  • bun test (95 tests)
  • bunx tsc --noEmit
  • Prettier and git diff --check
  • 20 focused scenario tests covering exact lookup, ambiguity, missing resources, rename guards, stable profile identity, and coded API errors
  • targeted Stryker: profile/proxy rename and exact-lookup core paths reached 100%; expanded setup/error run killed 84/106 mutants, with remaining survivors in pre-existing presentation branches and equivalent API-error guards
  • crap4ts: changed registration paths 1.1; API error-code helper 5.0

Note

Medium Risk
Changes how durable profiles are resolved during setup (ID binding and ambiguity handling), which could alter agent behavior if duplicate names existed; production wiring stays on default dependencies.

Overview
Introduces McpDependencies so MCP registration and tools can inject createKernelClient (defaults unchanged in production), enabling contract tests without hitting the real API.

Profile setup now lists by exact name, fails on duplicate exact matches with recovery guidance, rejects update_existing when the profile is missing, and opens the setup browser with profile.id instead of name. manage_profiles gains a rename action (by name or ID) with shared identifier validation; tool docs warn against renaming while a browser session is attached.

manage_proxies gains rename via proxies.update. MCP throwToolError messages append [code: …] when the Kernel SDK returns a string API error code.

Adds durable-contracts.test.ts and extends responses.test.ts for coded errors and rename/schema behavior at the MCP boundary.

Reviewed by Cursor Bugbot for commit c7fa9aa. Bugbot is set up for automated code reviews on this repo. Configure here.

@vercel

vercel Bot commented Aug 6, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
mcp Ready Ready Preview Aug 7, 2026 6:50pm

@cursor cursor 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.

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 9c3e730. Configure here.

Comment thread src/lib/mcp/tools/profiles.ts

@masnwilliams masnwilliams left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The production behavior is correct and worth landing: exact profile resolution, ID-bound setup sessions, rename parity, and stable API error codes all close real gaps. I'm requesting changes for the test architecture, which introduces global/import-order coupling and does not exercise the MCP contract it claims to cover. Once the tests use an isolated client dependency and validate the real MCP boundary, this should be good to merge. As a smaller follow-up while touching this code, please also consider centralizing the repeated profile_name/profile_id XOR validation used by get, rename, and delete.

Comment thread src/lib/mcp/kernel-client.test-fixtures.ts Outdated
Comment thread src/lib/mcp/tools/durable-contracts.test.ts
IlyaasK added 4 commits August 7, 2026 14:37
Use exact profile-name lookup for setup, expose profile and proxy rename operations, and retain stable Kernel API error codes in tool output so agents can act on durable API contracts.
@IlyaasK
IlyaasK changed the base branch from main to hypeship/mcp-browser-pool-contract August 7, 2026 18:38
@IlyaasK
IlyaasK force-pushed the hypeship/mcp-durable-contract-parity branch from 5e61a10 to 056ed44 Compare August 7, 2026 18:38

@vercel vercel 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.

Additional Suggestion:

fill_rate_per_minute schema gained an .int() constraint that wrongly rejects the fractional percentage values the Kernel API accepts.

Fix on Vercel

@IlyaasK

IlyaasK commented Aug 7, 2026

Copy link
Copy Markdown
Contributor Author

Also completed the optional cleanup from the review summary in c7fa9aa: get, rename, and delete now share one profile identifier validator while preserving their existing action-specific diagnostics. Focused regressions cover both conflicting and missing identifiers for get and delete. Full suite: 109 tests passed; typecheck, managed-auth bundle check, and changed-file formatting passed.

@IlyaasK

IlyaasK commented Aug 7, 2026

Copy link
Copy Markdown
Contributor Author

Additional Suggestion:

fill_rate_per_minute schema gained an .int() constraint that wrongly rejects the fractional percentage values the Kernel API accepts.

Fix on Vercel

experimentally invalidated

@masnwilliams masnwilliams left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Rechecked c7fa9aa. Both requested structural changes are addressed: profile/proxy registrations now receive an isolated Kernel client dependency, and rename behavior is covered through a real MCP server/client boundary including discovery, validation, authentication propagation, SDK calls, and serialization. The repeated profile selector validation is also centralized. Local verification passes: 109 tests, TypeScript, changed-file Prettier, and diff checks. Approved.

@IlyaasK
IlyaasK merged commit 6385e49 into main Aug 7, 2026
10 checks passed
@IlyaasK
IlyaasK deleted the hypeship/mcp-durable-contract-parity branch August 7, 2026 19:44
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.

2 participants