Skip to content

Fix MCP Runner invocation and close-chain settlement - #218

Merged
KimGLee merged 5 commits into
mainfrom
fix/mcp-nested-invocation-closure
Sep 9, 2026
Merged

KimGLee merged 5 commits into
mainfrom
fix/mcp-nested-invocation-closure

Conversation

@KimGLee

@KimGLee KimGLee commented Sep 9, 2026 •

Copy link
Copy Markdown
Owner

Owner Issue

Closes #217

Change

Restore the complete MCP → Runner → Tool → evidence/publication → authoritative read-back chain without adding governance rules.

  • MCP and Runner now project one complete invocation schema from the existing compiled contract. Types, effective defaults and all declared path constraints/consumption modes travel together. Remove the duplicate MCP property/input projection.
  • Validated independent child scopes settle only actual matching snapshot reads back to their parents. Keep identity and mode narrowing, reject invalid ACKs, and retain existing same-scope writer/after-image handling. Retire inherited_records rather than keeping an alias.
  • Share mechanical invocation observation between MCP and Runner. Preserve raw process codes, output reliability, consumption reliability and committed child facts separately; failed outer confirmation never implies that a retry is safe.
  • Validate a complete checker process before selecting a Gate. Registered scans and close reuse this mechanical owner while retaining their own acceptance/currentness/authorization rules and legitimate multi-Gate behavior.
  • Replace direct-leaf bypasses in the existing Required Queue E2E with real MCP run_task actions through close. Keep its existing Terminal Proof scenario; remove redundant correction replay and unused E2E branches.
  • Regenerate module/interface/Host/catalog projections and the eight existing integration checkpoint bundles with their original generators. Checkpoint identity churn is generated test data, not adopter history migration.
  • Share one read-only evidence observation across each Runner decision. The existing capability owner validates a retained registry once and serves detached ID lookups; the producer-chain owner reuses mechanical joins through the evidence owner's existing memo. Remove raw-document query parameters, the superseded chain memo and its redundant test. Explicit fresh observations, producer admission, lock-time currentness, writes and after-image read-back remain separate.
  • Flush completed test-cost scopes to private per-process diagnostic files and upload them alongside the final report. Incomplete runs cannot claim success. Keep the existing CI selection, Python matrix, timeout and required gate unchanged.

No Kernel, Profile, Card, Read Set, CI policy or actual adopter runtime changes. No compatibility chain, new persisted Receipt format or automatic retry/recovery protocol.

Verification

  • make check and git diff --check: passed.
  • Existing focused fast selection: 187 distinct cases passed. Following the complete-schema correction, the affected four-file subset of 79 cases passed again in 2.429 seconds.
  • Existing adjacent integration selection initially passed 10/10 in 25.117 seconds. After final dependency/checkpoint regeneration, the actual Queue, Delta and close consumer selection passed 16/16 in 47.680 seconds; both closed checkpoint dependency/runtime validations also passed.
  • Existing path-capability isolation selection: 13/13 passed in 4.278 seconds, including three real nested processes and same-scope append after-images.
  • Schema closure expectations are derived independently from all 68 CLI contracts: 493 arguments and 117 path declarations. Counterexamples failed before the shared projection fix and passed afterwards.
  • Negative boundaries cover unread inputs, replaced identities, narrowing/subtree/transaction distinctions, foreign/partial ACKs, abnormal exits, inconsistent complete Receipt arrays and valid sibling Gate fail/HOLD results.
  • Final-source real MCP Runner E2E: passed in 390.962 seconds (391.097 seconds including the catalog runner). Both batches reached closed, then the existing real MCP Terminal Proof chain completed the Task. All 68 batch actions used run_task; the scenario made 81 real MCP calls, including 71 Runner calls and one semantic withdrawal. No direct-leaf batch bypass.
  • Following read-observation consolidation, 18 adjacent consumer checks passed against freshly generated static checkpoints: Queue, Delta, close, rollback, Structure projection and Profile rendering admission. They do not replay earlier Task lifecycles.
  • A bounded same-input query with mechanical reuse disabled/enabled returned identical full next_action objects and changed no files. Full capability validations fell from 112 to 32 and producer registrations from 170 to 18; profiled time was 1.913 / 1.138 seconds. These compare modes of the new implementation, not an end-to-end CI speedup claim.
  • The scope, chain, capability and test-meter owner cases cover fresh observations, canonical tampering, detached results and interrupted diagnostics. An additional 73 focused fast cases and 11 existing README cases passed. Subset rechecks overlap and are not added to inflate unique coverage.

Test ownership remains 134 files and three E2E scenarios (1,290 → 1,298 cases). All new cases live in existing owner files; the former single-snapshot test was subsumed and removed. No local full or repeated cache-state full suite was run. Required CI retains its existing fail-closed impact selection.

CI follow-up

The first CI run detected stale generated checkpoint dependencies following the last shared-schema source change. Runtime validity alone did not establish that pre-merge evidence remained current; a hash-only refresh was rejected by the actual Queue consumer tests and was not retained. All eight checkpoint bundles were regenerated through their existing scenario owners against the frozen final source and replaced completely, including retired generated paths, followed by the bounded consumer verification above. No validator, acceptance predicate or test assertion was relaxed.

The Tool guide was shortened to satisfy its existing navigation-size budget, not by relaxing the budget test. Its 11 owner tests passed in 0.400 seconds; all eight checkpoint dependency hashes remained unchanged.

The first Py3.14 real Runner E2E passed in 657.456 seconds. Its Py3.10 counterpart reached the existing 15-minute job limit without a completion result; this is not reported as a pass.

Earlier protected CI, at 21bd88884dc1c19d3f2d6f39d311e01a203d6486, passed 21 jobs but reached the existing 15-minute limit in the real Runner E2E on both Python versions. Those cancelled runs are not counted as passes. The subsequent bounded diagnosis identified repeated registry validation and producer-chain reconstruction inside a single decision, leading to the owner-scoped consolidation above. All eight checkpoint bundles were regenerated again after source freeze and validated by actual adjacent consumers. Publication still requires the new head's protected CI; no previous/local result substitutes for it.

The next CI exposed one missed test-only consumer of the retired document= argument. AST inspection covered all 27 related call sites and found that single residue in the existing action-entrypoint closure test. It now uses CapabilityLookup, removes its private ID map, and retains all route/entrypoint/consumer assertions. The existing file's 14 cases pass; the remaining 26 query calls have no retired argument. No production source, fixture, acceptance contract or E2E changed in this correction, and no additional local lifecycle replay was run.

Final protected result

CI 34334517116 passed all 24 jobs at head 6f0ad6d4b289aa718251a21e2f7686b4776675bd; ci-required succeeded. Both Python 3.10.21 and 3.14.7 passed all 1,298 tests across 134 files, with no duplicate methods/files between shards in either matrix. The unchanged real MCP E2E retained 81 calls and 68 Runner actions in both versions. Its module time was 840.096 seconds on Python 3.10 and 574.490 seconds on Python 3.14; total job time was 14m19s / 9m50s, within the unchanged 15-minute limit. Python 3.10 still has limited budget margin; this is not a claim that all performance cost has disappeared.

Merged normally as 150f3d985a88e295e09777756636d4edea460b73, closing #217. No protection bypass, timeout increase or selection reduction was used.

@KimGLee KimGLee added bug Something isn't working agent-interface Host-neutral agent interface: contract, projection, MCP server, per-host configs labels Sep 9, 2026
@KimGLee
KimGLee marked this pull request as ready for review September 9, 2026 06:00
@KimGLee
KimGLee merged commit 150f3d9 into main Sep 9, 2026
24 checks passed
@KimGLee
KimGLee deleted the fix/mcp-nested-invocation-closure branch September 9, 2026 09:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent-interface Host-neutral agent interface: contract, projection, MCP server, per-host configs bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Close nested invocation and receipt observation gaps in the MCP Runner lifecycle

1 participant