refactor(runtime): remove legacy child AgentRun control - #4173
Conversation
4ebdf3a to
cebbeff
Compare
|
This is a synthesis of the independent blind review by @Sol-404ARE at exact head What I checked myself:
Findings from Sol's sealed review: Standards — NO-GO — 1×P2 (worst P2)
Spec — NO-GO — 1×P2 (worst P2)
Verification: What I did not judge: detached worktree direct source suites were not executed (no Gate: Standards 1×P2 + Spec 1×P2 remain; despite terminal CI green, head
|
M4n5ter
left a comment
There was a problem hiding this comment.
Approved at exact head cebbeff14d3516f59951aaddf7b6b3076643daec with one non-blocking P2 documentation comment. The runtime refactor is internally consistent: live legacy child lineage is rejected before any Run or message write, linked child Sessions and Agent Graph execution retain their own authority, safe-boundary continuation uses its separate internal lineage, and the historical list/output projection remains readable. This is a genuine simplification: it removes the same-Session child execution authority and its control, replay, progress, and transcript-suppression paths without adding a replacement layer.
I did not retain the proposed recovery-immutability concern as a finding. Startup terminalization of interrupted legacy child Runs predates this PR, the updated Phase 3–4 contract explicitly preserves it as restart-close compatibility, and isSessionInlineRun continues to prevent those legacy Runs from writing TurnState.
All three exact-head hosted checks are successful. Local verification passed the complete build and typecheck, 279 affected tests, the complete Runtime suite (3,043 passed), the complete Runtime Host suite (1,355 passed), lint, format, stale checks, and git diff --check. Current main is still the reviewed base, and the synthetic merge tree is byte-identical to the reviewed head.
Automated review notice: This comment was posted by an automated review agent operated by M4n5ter. It is not an independent human review and does not replace one.
ARE404
left a comment
There was a problem hiding this comment.
Approving refactor(runtime): remove legacy child AgentRun control at head cebbeff1.
I reviewed the 19 changed files and verified the removal of the legacy child AgentRun control surface is reachable-clean:
prior-run-context.tsis trimmed, not deleted —agent-run.tsandruntime-ledger-repair.test.tsstill import the retainedbuildPriorRuntimeContext/PriorRuntimeContext, so those references stay valid.- The removed legacy surface in
session-manager.ts,runtime-kernel.ts,agent-run.ts,tool-runtime.ts,child-agent-progress.ts,ai-sdk-backend.ts, andprior-run-context.tsis not referenced by any retained producer or consumer at this head (grep across packages/scripts). testis green on this exact head (run33252607939, 11m14s).
No P0–P2 in the code. One open documentation thread (runtime-resume-extraction-ledger.zh-CN.md) should still be reconciled by the author for cross-document consistency, but it is non-blocking for this refactor.
简体中文
批准 refactor(runtime): remove legacy child AgentRun control,head cebbeff1。
审查 19 个改动文件,确认删除 legacy child AgentRun 控制面是可达性干净的:prior-run-context.ts 是精简而非删除——agent-run.ts 和 runtime-ledger-repair.test.ts 仍 import 保留的 buildPriorRuntimeContext/PriorRuntimeContext,这些引用有效。session-manager.ts/runtime-kernel.ts/agent-run.ts/tool-runtime.ts/child-agent-progress.ts/ai-sdk-backend.ts/prior-run-context.ts 中被删的旧面在本 head 无任何保留生产者/消费者引用(packages/scripts 全仓 grep)。test 在 exact head 绿(run 33252607939,11m14s)。代码无 P0–P2。一条开放文档线程(runtime-resume-extraction-ledger.zh-CN.md)建议作者另行统一文档间一致性,但对本次重构不构成阻塞。
jackwener
left a comment
There was a problem hiding this comment.
I reviewed this at cebbeff14d3516f59951aaddf7b6b3076643daec. No P0 or P1. One P3, inline on the extraction ledger.
P3. The table in docs/architecture/runtime-resume-extraction-ledger.zh-CN.md now says historical linked-child admissions are restart-close only. Later in the same file, the production-scope bullets still describe hosted child RateLimit retry as a live durable_continuation admission. This PR deletes resumeChildAgent / retryChildAgent, and the Phase 3–4 contract now says that entry is gone. Code wins if the two documents disagree, so this is not a merge blocker.
What I checked
- Live
sendMessage/startTurnrejectparentRunId,resumedFromRunId, andretriedFromRunIdbefore an AgentRun is written, including leftover fields on an untyped input object. The new test shows no Run is stored after that reject. - Linked
agent_spawnstill creates a child Session whose first AgentRun has noparentRunIdand is session-inline. Follow-up turns on that Session are ordinarysendMessage. - Same-session child spawn / resume / retry is gone from SessionManager, ToolRuntime, AiSdkBackend, RuntimeKernel, and Host composition. I found no remaining production callers.
agent_listandagent_outputstill project persisted legacy child runs. Safe-boundary continuation still sets runtime-ownedrunLineage.parentRunIdand stays session-inline because the continuation header hascontinuationSourceand noagentId.- Startup recovery still terminalizes interrupted non-terminal runs, including historical child AgentRuns. That is crash recovery, not a live control entry. Leaving those rows as
runningafter restart would be worse.
Hosted test, windows_recovery, and label are green on this head. The merge tree against current main is clean. This is a refactor; I am not merging it.
简体中文
我审的是 cebbeff14d3516f59951aaddf7b6b3076643daec。没有 P0/P1。一条 P3,写在 extraction ledger 对应行上。
P3. 这份文档前面的表格已经改成「历史 linked-child admission 只做重启关闭」,后面 production scope 仍把 hosted child RateLimit retry 写成活的 durable_continuation 准入。本 PR 删掉了 resumeChildAgent / retryChildAgent,Phase 3–4 合同也写明入口没了。文档打架时以代码为准,所以不挡合并。
我核对过:live 输入在写 AgentRun 之前就会拒绝那三个 lineage 字段;linked spawn 的第一跳仍是没有 parentRunId 的 session-inline Run;同会话 child 控制链没有残留调用方;历史 agent_list / agent_output 仍可读;continuation 仍走运行时自己的 parentRunId。重启时把中断的非终态 Run 收成失败,包括历史 child Run,这是崩溃恢复,不是新的执行入口。
这是重构,我不合入。
Automated review notice: This comment was posted by an automated review agent operated by WAWQAQ. It is not an independent human review and does not replace one.
Remove the obsolete same-session child execution and continuation capabilities now that agent_spawn uses durable linked child Sessions. Keep historical AgentRun projections readable through agent_list and agent_output, and leave linked Session and Agent Graph execution unchanged. Generated-by: Codex
cebbeff to
ce88181
Compare
|
Follow-up to the exact-head reviews and the synthesis above:
Verification: rebased onto current Thanks for the reviews. |
zhiiw
left a comment
There was a problem hiding this comment.
Reviewed at exact head ce88181e (verified unchanged at review time). Note on head movement: I began on cebbeff1; the PR was rebased onto current main with a docs-only rewording (the phase-3/4 design doc now describes the historical linked-child admission closure instead of the removed retry path). git range-diff and a direct tree diff confirm the production code is identical between the two heads; the results below were re-run on ce88181e.
Removal of the retired child-AgentRun control chain, verified rather than assumed:
- The deletion stops at the ownership boundary:
spawnChildAgent/prepareChildAgentResume/resumeChildAgent/retryChildAgent/ChildAgentTurnInput/AgentSpec/startChildTurn/startChildRetry/recordSessionMessageshave zero remaining references at this head. The survivinglegacy_child_runexecution kind appears only inlistChildAgents/readChildAgentOutput— the retained read-only projection of historical runs — andlinked_child_resume/linked_child_provider_retrysurvive only as read-side tags in hosted-execution recovery/projection/availability. No producer remains. - Live-turn rejection is a runtime gate, not just a type deletion:
assertNoRemovedChildAgentRunLineagethrows onparentRunId/resumedFromRunId/retriedFromRunIdatstartTurn, which catches untyped or older JavaScript callers too, and the newsession-managertest pins the rejection before any AgentRun is written. - Runtime-owned continuation lineage survives correctly: the safe-boundary continuation path now carries
parentRunIdthrough the internalrunLineagechannel (never accepted from live input), andcontinuationTargetRunHeaderForExecutionsets it fromcontinuation.sourceRunIddirectly. - Simplification is real: the child backend-generation map, the
routediscriminator, the transcript-suppression flag, and the resumed-child replay machinery (cycle-walking, replay-safety diagnostics, environment-match checks) are all gone with their only callers.
Executed on a real Windows machine at this head: clean forced rebuild of core/runtime/runtime-host, then the PR's focused set — session-manager 176/176 (including the new rejection test), subagent-tools 27/27, admission-limiter 8/8, runtime-ledger-repair 3/5 — the two failures are the pre-existing Windows flake class (EBUSY unlinking temp SQLite fixtures during teardown; unrelated to this PR's one-line touch of that file). The hosted test job is still running on this rebased head at approval time; it passed on the pre-rebase head with identical production code.
Automated review notice: This comment was posted by an automated review agent operated by zhiiw. It is not an independent human review and does not replace one.
简体中文
删除链端到端核实:被删符号全树零残留;legacy_child_run 只剩 agent_list/agent_output 只读投影,linked_child_resume/retry 只剩恢复/投影侧的历史记录解读,无生产者。活体拒绝是运行时断言(非仅类型删除),覆盖了非类型化 JS 调用方,新测试钉住「AgentRun 落盘前拒绝」。safe-boundary continuation 的 lineage 改走内部 runLineage 通道,不受活体拒绝影响。本机真 Windows 干净重建后四个靶向套件 214/216——2 个失败是既有 Windows EBUSY 临时库清理噪音(CI 同 head 的 test 在批时仍在跑,rebase 前同内容 head 已绿;两个 head 的生产代码逐字节一致)。
Summary
Remove the retired same-session child AgentRun execution, resume, and retry control chain now that
agent_spawncreates durable linked child Sessions.This deletes the unused capability plumbing from Core inputs through ToolRuntime, AiSdkBackend, Runtime Host composition, SessionManager, and RuntimeKernel. It also removes the child-only backend-generation, provider replay, and transcript-suppression branches that were reachable only from that chain. Live turns no longer accept child AgentRun lineage, including from untyped or older JavaScript callers.
Historical compatibility remains read-only: persisted legacy AgentRun/RuntimeEvent data is unchanged,
agent_listandagent_outputstill project legacy run ids, and linked child Sessions plus Agent Graph execution keep their existing session-inline authority. Safe-boundary continuation retains its separate runtime-owned lineage.Net change: 1,669 insertions and 6,462 deletions (4,793 lines removed).
Verification
parentRunId,resumedFromRunId, andretriedFromRunIdinputs are rejected before an AgentRun is writtennpm run format:checknpx biome linton all changed filesnpm --workspace @maka/core run typechecknpm --workspace @maka/runtime run typechecknpm --workspace @maka/runtime-host run typecheckgit merge-tree --write-tree HEAD origin/pr/4158completed without conflicts after rebasing onto currentmainReview focus
Please verify that the deletion stops at the ownership boundary: linked child Session and Agent Graph writes remain live, safe-boundary continuation remains isolated, while legacy same-session child AgentRuns remain readable but have no execution/control entry point.
AI use
Select exactly one:
Tool(s) and scope: Codex implemented the removal, adapted the safety-net tests, and performed internal adversarial reviews. A human contributor must review the final diff and owns the merge decision.
Checklist
Does this PR entail a change in behavior?