Repository navigation
Refactor/runtime kernel split - #1675
Merged
likun666661 merged 4 commits intoAug 1, 2026
Merged
Conversation
likun666661
approved these changes
Aug 1, 2026
Member
|
Excellent work. This is a clean, carefully scoped refactor that materially improves the RuntimeKernel boundaries without changing behavior. Extracting |
…umented contract (apache#1406)
…ecorder hook builder (apache#1406)
…1406) Remove the test that pinned runAgentTurn's structure by slicing runtime-kernel.ts source text and asserting on string matches ('new AiSdkFlow' present, 'mapSessionEventToRuntimeEvent'/ 'createSessionEventMapMemory' absent). This is exactly the source-regex contract pattern apache#1403 forbids. The invariant it protected — a backend-forged queue_update is dropped at the AiSdkFlow ingress, never reaching observers or the ledger — is already covered more robustly by the behavioral test 'a backend-forged queue_update never reaches the ledger or observers', which drives a real forging backend through runAgentTurn and asserts on the observed event stream and persisted ledger. The behavioral test is strictly stronger: it fails on actual regressions (forged events leaking through) and does not false-positive on an equivalent reimplementation. Also drops the now-unused readFile import.
likun666661
force-pushed
the
refactor/runtime-kernel-split
branch
from
August 1, 2026 08:25
b6a320a to
f1aea8d
Compare
likun666661
approved these changes
Aug 1, 2026
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
AsyncEventQueuefamily out of the kernel intodelivery-ack-queue.ts, renaming it toDeliveryAckQueue; document its backpressure contract (push(): Promise<void>awaits ack) against the fire-and-forget publicasync-queue.tsload/record/scheduleCleanupcoordination (4 concurrency maps + 3 private methods) into a self-containedHistoryCompactCheckpointCoordinatorthat depends only on injected stores, never touchingthis.active/this.childActive; moveHistoryCompactCleanupRequestwith it and keep public imports stable via a type-only re-export, whilesession-manager.tsnow imports the type directly from the coordinatorensureActiveandensureChildActiveinto a sharedbuildBackendRecorderHookshelper, parameterizing the only divergence (parent resolves fromthis.active, child fromthis.childActive) via aresolveActivecallback; keep the intentionally divergent fields (allowMidTurnHistoryCompaction,shellRunContextSummary, system prompt/tools source) at their call sitessession-manager.test.tssource-regex contract test (forbidden by test: replace source-regex extraction contracts with behavioral assertions #1403) that pinnedrunAgentTurn's structure by slicing source text; its invariant — a backend-forgedqueue_updateis dropped at the AiSdkFlow ingress, never reaching observers or the ledger — is already covered more robustly by the behavioral test "a backend-forged queue_update never reaches the ledger or observers" (session-manager.test.ts:17641), which passes under AiSdkFlow and would crash the turn if the code regressed to the inlinemapSessionEventToRuntimeEventpathRefs #1406 .
Verification
npm run format:checknpm run lintnpm run typechecknpm --workspace @maka/runtime run typecheck— passednpm --workspace @maka/runtime test (2823 passed, 9 skipped)