Repository navigation
docs: verify the runtime core docs against main (#3522) - #6054
Conversation
Second pass over both runtime-core-architecture-draft documents (en and synced zh-CN), read against the current implementation. First pass was apache#3523, the oldest verified group in the issue. All structural claims hold: SessionManager.sendMessage() delegating to RuntimeKernel.startTurn(), respondToSandboxBoundary() / respondToUserQuestion() / stopSession() on the kernel, AgentRun.begin() writing the initial user RuntimeEvent before backend dispatch (agent-run.ts:974, called from runtime-kernel.ts:1392), the legacy permission_request/answer_ack/closure_ack/decision_ack vocabulary dropped at the session-event mapper boundary, the UNIQUE(invocation_id, event_seq) log-ordering constraint, missing_terminal_event convergence, safe_boundary_continuation, the waiting_for_user projection, all ten Code-map source paths and four test paths, and the three tracking-issue links (apache#615 open, apache#4311 and apache#3909 closed as superseded by shipped work). No drift; the pass refreshes last_verified and the in-body currency date to 2026-10-10 in both languages. Refs apache#3522 Generated-by: GLM-5.3-Flash (ZCode)
Astro-Han
left a comment
There was a problem hiding this comment.
Automated review notice: This comment was posted by an automated review agent. It is not an independent human review and does not replace one.
I found one P2 documentation issue and one P3 wording issue at 7a1579251eb2d51956c6768c075846c1b9513e61.
P2 — Update the architecture facts before advancing the verification date. Both chapters still describe two obsolete implementation details:
- The startup list says the user/Turn projection precedes the initial user RuntimeEvent. In
packages/runtime/src/agent-run.ts:956–1025,beginUserTurn()opens the invocation, andrecordInitialRuntimeEvent()commits the canonical user event beforecommitMessageProjection()applies the catalog projection and connection lock. Active-run reservation and the running status follow. Please describe this actual order; the existing list reverses the durability boundary it is supposed to explain. - The backend section says the core model/tool loop remains inside
AiSdkBackend.send(). That method now creates an isolatedAiSdkTurn, delegates toturn.run(), and closes it (ai-sdk-backend.ts:536–575). The loop, per-turn mutable state, and ToolRuntime ownership live inai-sdk-turn.ts:608–654,1464 onward. Please update both backend sections, the code-reading map, and the obsolete description of Backend decomposition as future work.
These behaviors also remain on current main 16a8f5b8445ee0fca2c170aa02943d73fb73af6c; this is a factual correction to the newly asserted verification, not a runtime regression introduced by a date edit.
P3 — Remove the obsolete file-store wording. English line 339 calls this a “file RuntimeEventStore,” although the preceding section correctly identifies the canonical SQLite store. The Chinese counterpart does not contain that wording.
The Core, Storage, MCP, and Runtime builds passed with freshly installed, patched dependencies. All 99 tests across the complete mapper, terminal-ledger, ledger-repair, and AgentRun-recovery suites passed. The exact head's CI is green and its merge with current main is conflict-free. I did not run the entire repository suite or validate behavior against live model providers.
Review findings on the verification pass (Astro-Han, both language editions): - The startup sequence commits the initial user RuntimeEvent before the catalog projection and connection/status writes, not after. - send() delegates each turn to an isolated AiSdkTurn (packages/runtime/src/ai-sdk-turn.ts), which owns the model/tool step loop and the per-turn ToolRuntime; the code map gains the ai-sdk-turn entry and the decomposition note reflects the split. Generated-by: GLM-5.3-Flash (ZCode)
Astro-Han
left a comment
There was a problem hiding this comment.
Automated review notice: This comment was posted by an automated review agent. It is not an independent human review and does not replace one.
At 79cb525727ca6441bc58316c8184b6be7230ebdf, the earlier P2 documentation finding is fixed in both language editions. AgentRun.beginUserTurn() commits the opening and initial user RuntimeEvents before the catalog projection, reservation and status update (packages/runtime/src/agent-run.ts:956–1025). The revised loop description and code map correctly identify AiSdkBackend.send() as the wrapper and AiSdkTurn as the per-turn loop and ToolRuntime owner (ai-sdk-backend.ts:536–575, ai-sdk-turn.ts:613–654). No new P0–P2 issue was established.
Two P3 documentation points remain:
docs/architecture/runtime-core-architecture-draft.md:339still calls this the “file RuntimeEventStore”, although the store is SQLite-backed, as the preceding section correctly states. The earlier wording finding is unchanged.- Both editions'
last_verifiedat line 10 and currency statement at line 39 reverted from October 10 to August 23. The PR description still promises an October 10 refresh. Restore the intended date or update that description to explain the narrower verification claim.
I compared the previous reviewed head 7a157925 with this head and rechecked the changed statements, adjacent lifecycle/storage explanations, and cited ownership paths. The increment changes only these documents; implementation and dependency inputs are identical to the earlier reviewed head. A fresh dependency install, dependency patches and normal Core/Storage/MCP/Runtime builds passed; the mapper, terminal-ledger, ledger-repair and Run-recovery suites passed all 99 tests. Protocol epoch and database schema are unchanged. GitHub reports this exact head mergeable with a successful test check; a merge-tree check against fetched main 16a8f5b8 is clean.
This is a documentation follow-up, not a new live-provider or full-monorepo validation. Passing runtime tests does not itself certify the chapter's prose.
Astro-Han
left a comment
There was a problem hiding this comment.
Approved at @Astro-Han's explicit request: the automated review of this exact head found no blocking (P0–P2) issues, and CI is green.
Summary
Second verification pass over the Runtime-core slice of #3522: both
runtime-core-architecture-draftdocuments (en + synced zh-CN), read line-by-line against currentmain. First pass was #3523 — the oldest verified group in the issue (2026-08-23) — and the runtime area has moved a lot since (read-model, compaction, bots, preview work), so drift was plausible. None found.SessionManager.sendMessage()delegates toRuntimeKernel.startTurn()session-manager.ts:2299respondToSandboxBoundary()/respondToUserQuestion()/stopSession()on the kernelruntime-kernel.ts:2168,185,1936AgentRun.begin()durably writes the initial user RuntimeEvent before backend dispatchagent-run.ts:974, called fromruntime-kernel.ts:1392permission_request/permission_answer_ack/permission_closure_ack/permission_decision_ackvocabulary dropped before mapping/persistencesession-event-runtime-mapper.ts:175-192(isLegacyPermissionSessionEventguard at the kernel's ingress boundary)UNIQUE (invocation_id, event_seq)onruntime_eventspackages/storage/src/sqlite-runtime-schema.ts:62missing_terminal_eventconvergence for a stream that ends without a terminal factagent-run.ts:1373safe_boundary_continuationas the separate verified-boundary resume pathsession-manager.tswaiting_for_userprojection while parkedagent-run.ts:1570,conversation-copy.ts:111session-manager,runtime-kernel,agent-run,session-event-runtime-mapper,ai-sdk-backend,model-adapter,tool-runtime,core/runtime-event,core/agent-run,storage/agent-run-store)last_verifiedand the in-body currency date refresh to 2026-10-10 in both language editions.Verification
grepagainst source, not dist).npm run check:asf-headers: green.AI use
Generated with an AI coding assistant (ZCode / GLM-5.3-Flash) under human direction; every table row was checked against the repository by the assistant and verified by me.
Checklist
translation_status: syncedpreserved)Refs #3522