Repository navigation
refactor(runtime): collapse runner shell into kernel - #3718
Conversation
xxhZs
left a comment
There was a problem hiding this comment.
The direct-dispatch path drops the request-snapshot boundary that RuntimeRunner previously enforced.
AgentRun.begin() places the original mutable attachments and quotes arrays into both backendInput and the initial user RuntimeEvent. RuntimeKernel then forwards that input alongside the same event as headAnchorRuntimeEvent. Because these values are aliased, mutating the retained caller input or BackendSendInput after the user event is committed can also change the live provider input or in-memory head anchor, leaving them inconsistent with the durable ledger. This is particularly risky when mid-turn compaction relies on the head anchor as the persisted coverage boundary.
Please clone/freeze the mutable request content and head anchor before backend dispatch, preserving separate immutable snapshots, and add a regression test that mutates the original arrays/backend input while asserting that the stored user event, head anchor, and provider input remain stable.
Separately, this PR currently conflicts with main; please rebase and rerun the suite with the repository's declared Node 24.18.1 toolchain after addressing the snapshot regression.
Generated-by: OpenAI Codex
39cae10 to
46bed45
Compare
|
Addressed the requested changes in 46bed45:
Verification used Node 24.18.1 and npm 11.19.0: runtime suite 3046 tests / 3033 passed / 13 skipped / 0 failed; full repository build and typecheck passed; lint, format check, ASF header check, and git diff check passed. |
Summary
RuntimeRunner,AgentFlow, andInvocationContextshell soRuntimeKerneldirectly owns backend dispatch, stop/drain, terminal coalescing, and missing-terminal convergence.SessionEventtoRuntimeEventconversion as a pure mapper and move initial user-event construction intoAgentRun.Refs #3618
Verification
npm run buildnpm run typechecknpm run lintnpm run format:check@maka/runtimesuite: 2,948 passed and 13 skipped; one unrelated existing macOS sandbox executable-root assertion failed inbuiltin-tools.test.tsReview focus
This intentionally removes public Runtime subpaths for the retired Invocation/Flow shell. Please focus on direct
RuntimeKernelstream ownership and the continuation proof-consumption boundary.AI use
Select exactly one:
Tool(s) and scope: OpenAI Codex traced the Runtime ownership graph, implemented the collapse, migrated tests and documentation, and ran verification. The commit includes the required
Generated-bytrailer.Checklist
The change is a behavior-preserving ownership refactor, so its regression tests protect the existing invariants rather than intentionally failing against the previous shell structure.
Does this PR entail a change in behavior?