5. modularize session coordination - #2194
Conversation
|
Macroscope skipped reviewing this pull request. Per-review cost limit exceeded (workspace setting). This review would cost an estimated $25.97, 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:
|
2d22a90 to
c36a7af
Compare
Prime Agent performance — partialPR Overall: 1 regressed · 0 improved · 15 no clear change · 1 incomplete.
Python runtime
Sandbox cost: ~$0.0935 — no inference calls. Methodology and samplesMain resolved at 2026-09-11T19:29:36.806220+00:00. Harness
Failures:
|
c36a7af to
9467804
Compare
Refs ENG-5938.
Refs ENG-5938.
Refs ENG-5938.
Refs ENG-5938
9467804 to
254666f
Compare
This is part of the stack giving Prime Agent session features explicit owners. This PR extracts input, turn, model, and history coordination and groups session modules by feature. AgentSession remains the public entry point and coordinates operations across those owners.
Goal state, command parsing, persistence, continuation, and contracts live together under src/session/goals. Owners keep state transitions, cancellation, and cleanup together and expose narrow dependencies. The architecture guide, source map, and AGENTS.md record these conventions. Public session APIs, goal payloads, and persisted formats remain unchanged.
The stack is rebased on main at 5255a6b, including withdrawal of background-command notices after their result is consumed. Repository checks pass on every PR head. Focused queue, kernel, refinement, side-question, and UI regressions pass; eight local background-bash integration cases require the missing Python runtime environment. GitHub checks and benchmarks must finish on the updated commits, and Macroscope's full correctness review remains blocked by its per-review cost limit.
Stacked on #2192; tracks ENG-5938.
Note
Low Risk
Documentation-only changes with no runtime or protocol impact; they document boundaries already reflected in the session module layout.
Overview
Adds source organization rules to
AGENTS.md, pointing contributors at the architecture guide andsrc/README.mdsource map and requiring ownership/API/dependency analysis before structural PRs.Introduces a new Source Ownership and Module Boundaries section in
architecture.md(where session features live undersession/<feature>/, single authoritative state, narrow dependencies, and how to review extractions).Rewrites
packages/coding-agent/src/README.mdto match the modular layout: goals and shared contracts undersession/goals/(includingcontinuation.tsandcontracts.tsinstead ofcore/goals.ts), plus updated paths and ownership tables forsession/input/,session/turns/,session/context/,session/children/,session/kernel/,session/models/,session/tools/, and related test locations (test/session/goals/).Reviewed by Cursor Bugbot for commit 254666f. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Modularize session coordination into dedicated service modules
Breaks the monolithic
AgentSessionclass into focused coordinator modules undersession/turns/,session/input/,session/goals/,session/context/,session/kernel/,session/models/,session/children/,session/compaction/,session/refinement/,session/tools/, andsession/extensions/.AgentSessionnow composes these services through host-contract interfaces and delegates via pass-through wrappers.SessionTurnPolicy,SessionTurnExecution,SessionEvents,SessionCommandExecution,SessionAutonomousContinuation,SessionGoalContinuation,SessionModelSelection,SessionInputAdmission,SessionActionQueue,SessionActionRecovery,SessionMessageDelivery,SessionPendingContext,SessionHistoryNavigation,SessionContextView,SessionExport, andSessionHarnessContext.AgentSessionprivate-state access paths moved to nested owner objects; out-of-tree code referencing direct session fields (e.g.session.eventQueue,session.autonomousState) will break. Tests updated to new shapes but no backward-compat shims remain.Macroscope summarized 254666f.