4. modularize child and kernel lifecycle - #2192
Open
kevinjosethomas wants to merge 9 commits into
Open
Conversation
Contributor
|
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:
|
kevinjosethomas
added this pull request to stack #2198
September 10, 2026 08:11
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.
kevinjosethomas
force-pushed
the
refactor/session-resources
branch
from
September 10, 2026 23:42
94a0e5d to
826f138
Compare
Prime Agent performance — runningPR Benchmarking the latest PR commit. Results will appear here when this run finishes. |
kevinjosethomas
force-pushed
the
refactor/session-resources
branch
from
September 11, 2026 19:13
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
kevinjosethomas
force-pushed
the
refactor/session-resources
branch
from
September 11, 2026 19:29
1e14ffc to
b7a44e8
Compare
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.

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.