feat(kernel): dispatch host requests as capabilities - #1243
Open
sethkarten wants to merge 12 commits into
Open
Conversation
7 tasks
sethkarten
marked this pull request as ready for review
August 11, 2026 19:04
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 3c3b0d2. Configure here.
sethkarten
marked this pull request as draft
August 11, 2026 19:08
sethkarten
marked this pull request as ready for review
August 11, 2026 20:00
sethkarten
force-pushed
the
core02-host-request-dispatcher
branch
from
August 12, 2026 17:49
c2f3e01 to
94e98f7
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
Validation
biome checkon all changed pathstsgo --noEmitNote
Dispatch host requests as revocable, provenance-checked capabilities in
KernelManagerHostRequestContext— a dispatcher-minted, revocable authority object passed alongside the payload to every host request handler. Only contexts created byKernelManagerare accepted; fabricated or copied objects are rejected via aWeakSetprovenance check.createHostRequestHandlerfactory that requires an explicitcontextAwareHostRequestHandlermarker; unary or unmarked handler registrations are rejected at registration time.KernelManagernow tracks active host-request controllers, closes admission on shutdown/dispose, and aborts in-flight requests before teardown. Stale or revoked requests are silently dropped rather than sending replies.enterTerminal/shutdownInternalsplit so disposal andkillmark terminal state immediately while restart can reopen host-request admission without forcing terminal.mcp,agent-messages,agent-observe,rlm-runtime,agent-session) are updated to use the newcreateHostRequestHandlerwrapper.contextargument and must be registered with thecontextAwareHostRequestHandlermarker; any unregistered or legacy unary handler will throw at call time.Macroscope summarized d56f609.
Note
High Risk
Touches kernel security boundaries (handler registration, context forgery, lifecycle revocation) across many host entry points; incorrect migration or admission logic could break Python skills or admit stale work after shutdown.
Overview
Host requests from the IPython kernel are no longer plain
(payload) => …callbacks. Handlers must be registered throughcreateHostRequestHandlerwith the explicitcontextAwareHostRequestHandlermarker; dispatch proves handler provenance and passes a dispatcher-mintedHostRequestContext(identity in aWeakSet, not structural checks on the payload).KernelManagertracks per-comm **AbortController**s, ahostRequestsClosedgate, and a one-wayterminalstate. Authority is revoked on comm close, handler settlement, cleanup, and shutdown/dispose/kill;restartuses non-terminalshutdownInternaland can reopen admission. Revoked or superseded requests skip stale comm replies.Session registrations (agent messages, observe, goals, compact/refine, RLM, MCP,
model.info, etc.) and tests are migrated to the factory; test helpers route through the real dispatcher orcreateTestHostHandlers. Startup/dispose edge cases and terminal snapshot flush are covered by added tests.Reviewed by Cursor Bugbot for commit d56f609. Bugbot is set up for automated code reviews on this repo. Configure here.