Skip to content
This repository was archived by the owner on Oct 23, 2026. It is now read-only.

feat(mcp): capability generation convergence and automatic rebind - #134

Merged
James3014 merged 1 commit into
mainfrom
codex/issue-133-capability-generation-convergence
Sep 13, 2026
Merged

James3014 merged 1 commit into
mainfrom
codex/issue-133-capability-generation-convergence

Conversation

@James3014

Copy link
Copy Markdown
Owner

Summary

Addresses Issue #133 by resolving the 5-layer capability and generation divergence across:

  1. Desired source identity (canonical main)
  2. Installed package identity
  3. Loaded service identity (running serverInstanceId/commit/buildId)
  4. Service-role capability manifest (live manifestSha256)
  5. MCP client/session tool catalog (bound snapshot)

Changes

  • src/deployment-convergence.ts: Added SessionConvergenceState (CURRENT, STALE_SERVER, STALE_CAPABILITY_MANIFEST, STALE_SESSION_CATALOG, RECONNECT_REQUIRED, RECONCILIATION_REQUIRED), SessionGenerationSnapshot, SessionConvergenceEvaluation, evaluateSessionConvergence, and evaluateMultiRoleConvergence.
  • src/mcp-cutover.ts: Added "capability_convergence_status" to CUTOVER_SAFE_TOOLS so that drain / reconcile-only mode does not block convergence queries.
  • src/mcp-sessions.ts: McpSessionRegistry now records snapshot metadata and server instance references per session (getSnapshot, setSnapshot, getServer, setServer, getAllServers).
  • src/server.ts:
    • Exposed capability_convergence_status MCP tool.
    • Bound SessionGenerationSnapshot on MCP session initialization.
    • In tools/call, checks whether missing tools are due to session generation divergence, returning typed error disposition [STALE_MCP_SESSION:<STATE>] (code -32003).
    • Added broadcastToolListChanged to RunningServer to broadcast notifications/tools/list_changed to active clients supporting listChanged.
  • Comprehensive test coverage in src/deployment-convergence.test.ts, src/mcp-sessions.test.ts, and src/capability-generation-convergence.test.ts.

Fixes #133.

- Introduce SessionConvergenceState and evaluateSessionConvergence to track session vs runtime generation divergence
- Introduce evaluateMultiRoleConvergence to detect multi-service role (7677 dev2 vs 7678 dev-c) deployment drift
- Register capability_convergence_status in CUTOVER_SAFE_TOOLS and MCP tool registry
- Bind SessionGenerationSnapshot and McpServer reference to active transports in McpSessionRegistry
- Detect missing tools in tools/call against stale session snapshots and return structured STALE_MCP_SESSION disposition (-32003)
- Provide broadcastToolListChanged on running server to notify listChanged-capable MCP clients
- Add comprehensive test coverage in deployment-convergence.test.ts, mcp-sessions.test.ts, and capability-generation-convergence.test.ts

Closes #133
@James3014
James3014 merged commit e6f8a21 into main Sep 13, 2026
11 of 12 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(mcp): capability generation convergence and automatic rebind

1 participant