4. modularize child and kernel lifecycle - #2192
Conversation
|
Macroscope skipped reviewing this pull request. Per-review cost limit exceeded (workspace setting). This review would cost an estimated $14.22, which exceeds your per-review limit of $10.00. The top 3 files driving up this estimate:
Tip To get this pull request reviewed, you can:
|
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 f43cc8e. Configure here.
94a0e5d to
826f138
Compare
Prime Agent performance — completedPR Overall: 0 regressed · 0 improved · 17 no clear change.
Python runtime
Sandbox cost: ~$0.0912 — no inference calls. Methodology and samplesMain resolved at 2026-09-11T19:29:33.488906+00:00. Harness
|
826f138 to
1e14ffc
Compare
Refs ENG-5939, ENG-5938
Refs ENG-5939, ENG-5938
Refs ENG-5939, ENG-5938
Refs ENG-5939, ENG-5938
Refs ENG-5939
Refs ENG-5939, ENG-5938
1e14ffc to
b7a44e8
Compare

Note
Medium Risk
Large refactor of session teardown, child cancellation/publication ordering, and kernel replacement gates; regressions would affect orchestration and billing attribution even though behavior is intended to be preserved.
Overview
AgentSession is slimmed down by delegating RLM child orchestration, IPython kernel provisioning, tool registry/ACP MCP handling, and extension reload/bindings to dedicated
session/*owners (SessionChildren,SessionChildState,SessionChildUsage,SessionKernel,KernelEnvironment,SessionTools,SessionExtensions, pluschild-run,child-projection, andkernel-host-handlers).Public entry points (
runRlmChild,listRlmSubagents,dispose/disposeAsync, tool APIs,reload, ACP MCP replace/release) stay on AgentSession but forward to those owners with the same teardown ordering called out in the README (children complete before kernel disposal; usage flushes at the parent event boundary).Child spawn/admission, deletion retries, quiescence waits, usage attribution, and snapshot/list projections move out of the monolith into
launchChildTaskandSessionChildren, while depth/max-depth, parent-reply state, and recap updates live inSessionChildState. Kernel host handlers are composed viacreateSessionKernelHostHandlersinstead of a large inline map in AgentSession.The package README gains Child agent lifecycle and Tools, extensions, and kernel resources sections documenting file responsibilities and invariants, plus pointers to new
test/session/and regression coverage.Reviewed by Cursor Bugbot for commit b7a44e8. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Modularize child and kernel lifecycle into dedicated session modules
AgentSession's child lifecycle, kernel, tool, extension, and usage management into dedicated facade classes underpackages/coding-agent/src/session/.AgentSessionnow delegates runtime building, disposal, child orchestration, and prompt rebuilding toSessionKernel,SessionTools,SessionExtensions,SessionChildren,SessionChildState, andSessionChildUsage.SessionChildState.parseDepthnow throws a named validation error for invalid non-negative-integer depth configurations instead of accepting them.KernelEnvironmentconditionally injects a Serper API key only when the websearch skill is loaded and no inherited environment variable exists.Macroscope summarized b7a44e8.