Agent host: consolidate Claude SDK query build (Tier 0 + C1)#326256
Draft
TylerLeonhardt wants to merge 3 commits into
Draft
Agent host: consolidate Claude SDK query build (Tier 0 + C1)#326256TylerLeonhardt wants to merge 3 commits into
TylerLeonhardt wants to merge 3 commits into
Conversation
Tier 0 - remove dead code (grep-confirmed zero production callers): ClaudeAgentSession.{seedBijectiveState,attachRematerializer,rebindForClientTools}, ClaudeSdkPipeline.{setClientToolOwner,reloadPlugins}, ClaudeSdkMessageRouter.setClientToolOwner.
C1 - unify the two duplicated SDK-Options build sites (materialize + the rematerializer closure, ~50% copy-paste) into one ClaudeAgentSession._startSdkQuery, with a thin _rebuildSdkQuery wrapper. The pipeline's rebuild hook moves from a post-construction attachRematerializer to a required constructor param, removing the two-phase init and the throw-if-unattached. The closure-captured ctx becomes an explicit _sdkStart field (de-closured). buildOptions now has one caller; model/effort no longer derived a third time.
Review cleanups: _clientToolOwner is now readonly; _startSdkQuery reuses the resolveCurrentPermissionMode helper.
Validated: typecheck-client + eslint clean; 213 unit tests pass; live E2E in the authenticated Agents window confirmed materialize (startup isResume=false), pipeline reuse, and recover-rebind (startup isResume=true) end to end.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…ate model Add architecture-analysis/ - the /improve-codebase-architecture output: coupling, lifecycle, rematerializer-duplication, responsibility-overlap and test-surface reports; a synthesis with visual aids; a sequenced consolidation roadmap (Tier 0 + C1 done; C2-C9 proposed, with C9 = immutable pipeline / session-orchestrated rebind as the end-state that removes the rematerializer); and the C1 E2E scenarios. CONTEXT.md M5: record the settled two-state config model (Desired on the session, Applied on the pipeline; no host-side staging) with per-axis timing (model/effort = next turn per SDK docs; permissionMode = immediate; agent = re-verify) and the permissions != permissionMode distinction. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Consolidates Claude SDK query construction and removes unused APIs.
Changes:
- Centralizes initial and rebuilt SDK query startup.
- Requires rematerialization during pipeline construction.
- Updates tests and adds architecture planning documentation.
Show a summary per file
| File | Description |
|---|---|
claudeSdkPipeline.test.ts |
Updates rematerializer test wiring. |
claudeAgent.test.ts |
Corrects state-seeding terminology. |
CONTEXT.md |
Documents config ownership and timing. |
claudeSdkPipeline.ts |
Requires rebuild callback; removes dead APIs. |
claudeSdkMessageRouter.ts |
Makes tool-owner resolver immutable. |
claudeAgentSession.ts |
Centralizes SDK query startup and rebuilding. |
architecture-analysis/ROADMAP.md |
Defines the consolidation roadmap. |
architecture-analysis/README.md |
Indexes architecture reports. |
architecture-analysis/C1-e2e-scenarios.md |
Documents C1 validation scenarios. |
architecture-analysis/05-test-surface.md |
Analyzes testability. |
architecture-analysis/04-responsibility-overlap.md |
Analyzes responsibility boundaries. |
architecture-analysis/03-rematerializer-and-duplication.md |
Analyzes query-build duplication. |
architecture-analysis/02-lifecycle-and-ownership.md |
Audits lifecycle ownership. |
architecture-analysis/01-call-graph-and-closures.md |
Maps dependencies and callbacks. |
architecture-analysis/00-SYNTHESIS.md |
Synthesizes architecture findings. |
Review details
- Files reviewed: 15/15 changed files
- Comments generated: 6
- Review effort level: Medium
Trim verbose JSDoc/comments to the VS Code 1-2 sentence guideline (_sdkStart, _startSdkQuery, _rebuildSdkQuery, the test-harness comment). Label CONTEXT.md M5 config-state as the C9 target and document today's interim _current* cache on the pipeline. Update the analysis README roadmap range to C1-C9. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Member
Author
|
Thanks — all 6 addressed in 1950d05:
|
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.
What
First step of a planned consolidation of the Claude agent-host runtime (full plan in
src/vs/platform/agentHost/node/claude/architecture-analysis/ROADMAP.md). Two low-risk, self-contained changes:Tier 0 — remove dead code (grep-confirmed zero production callers):
ClaudeAgentSession.{seedBijectiveState, attachRematerializer, rebindForClientTools}ClaudeSdkPipeline.{setClientToolOwner, reloadPlugins}ClaudeSdkMessageRouter.setClientToolOwnerC1 — unify the SDK-Options build. The two near-identical
buildOptionssites (initialmaterialize+ the rematerializer closure, ~50% copy-paste) collapse into oneClaudeAgentSession._startSdkQuery, with a thin_rebuildSdkQuerywrapper. The pipeline's rebuild hook moves from a post-constructionattachRematerializerto a required constructor param — removing the two-phase init and the throw-if-unattached. The closure-capturedctxbecomes an explicit_sdkStartfield (de-closured). Net:buildOptionshas a single caller; model/effort no longer derived a third time; −85 lines.Why
Reduces the "rematerializer" duplication + two-phase-init smell without changing behavior. It's the enabling step for the bigger reshape — C9: immutable pipeline / session-orchestrated rebind (stacked next) — that removes the passed-in rematerializer entirely. The
architecture-analysis/dir has the coupling/lifecycle/duplication analysis, a synthesis with diagrams, and the sequenced roadmap.Validation
typecheck-client+eslintclean; 213 unit tests pass._clientToolOwner→readonly; reuseresolveCurrentPermissionMode).startup isResume=false), pipeline reuse (1 startup / 4 turns), abort→cancellation, and recover-rebind (startup isResume=true→ result) all confirmed end-to-end; no "no rematerializer attached" errors.Not in this PR
C2folds into it.CONTEXT.mdM5 (Desired-on-session / Applied-on-pipeline; per-axis timing).Review note
Draft — opened early for directional feedback ahead of the stacked C9 PR. The
architecture-analysis/docs are working notes/analysis (candid by design); happy to trim if reviewers prefer a leaner tree.🤖 Generated with Claude Code