Skip to content

Remove dead session-factory aggregation and composite mirrors#5625

Merged
tgrunnagle merged 2 commits into
mainfrom
vmcp-core-p3-2b-stage2_issue_5621
Jun 24, 2026
Merged

Remove dead session-factory aggregation and composite mirrors#5625
tgrunnagle merged 2 commits into
mainfrom
vmcp-core-p3-2b-stage2_issue_5621

Conversation

@tgrunnagle

Copy link
Copy Markdown
Contributor

Summary

With the core established as the single source of capability aggregation, composite-tool
execution, and workflow telemetry on the Serve path (#5445), the session factory's parallel
aggregation/composite/telemetry machinery is unreachable dead code. This is Stage 2 of the
#5621 dead-code removal.

  • Aggregation mirror (ce4dce6a): remove session.WithAggregator, the factory aggregator
    field + buildRoutingTableWithAggregator, and Aggregator.ProcessPreQueriedCapabilities
    (interface + impl + regenerated mock). makeBaseSession always builds the routing table from
    raw backend capabilities (the core owns overrides/conflict-resolution/filtering); its
    now-always-nil error return is dropped. cli/serve.go drops the WithAggregator(agg) wiring
    (agg still feeds the core via Config.Aggregator).
  • Composite/telemetry mirror (549caf74): remove compositeToolsDecorator and the
    workflowExecutorInstruments family from the session manager, plus the dead
    FactoryConfig.WorkflowDefs/ComposerFactory fields. The core owns composites
    (executeComposite) and workflow telemetry (telemetryComposer, Forward passthrough headers on the Serve path #5561). The optimizer
    decorator and its telemetry are untouched.

Verified dead: nothing sets FactoryConfig.WorkflowDefs/ComposerFactory (production and the
integration harness leave them unset), and ProcessPreQueriedCapabilities's only caller was the
removed factory aggregation.

Part of #5621.

Type of change

  • Refactoring (no behavior change)

Test plan

  • Unit tests (task test)
  • Linting (task lint)
  • Integration tests (go test ./test/integration/vmcp/...)

Build clean; pkg/vmcp/... + test/integration/vmcp/... pass; lint clean except the
pre-existing, unrelated G115. Pure deletion of unreachable code (10 files, +14/−809).

API Compatibility

session.WithAggregator and Aggregator.ProcessPreQueriedCapabilities are removed from the
exported surface; their only in-tree users were the factory aggregation path (removed here) and
cli/serve.go. server.New's signature is unchanged — the discoveryMgr-param change is
Stage 3 (#5621).

Does this introduce a user-facing change?

No.

Special notes for reviewers

Stage 2 of 3 in the #5621 dead-code removal (follows the merged Stage 1, #5622). The
optimizer decorator and its telemetry (monitorOptimizer/telemetryOptimizer) are intentionally
retained — out of scope here. Stage 3 removes the discovery middleware + context seam, untangles
default_router, and changes the server.New signature (7→6, dropping discoveryMgr).

Generated with Claude Code

tgrunnagle and others added 2 commits June 24, 2026 10:10
The core is the single source of capability aggregation on the Serve path
(AdvertiseFromCore), so the session factory's parallel aggregation is dead code. Part of the
#5621 Stage 2 dead-factory-mirror removal:

- session/factory.go: remove the `aggregator` field, `WithAggregator`,
  `buildRoutingTableWithAggregator`, and the `if f.aggregator != nil` branch — makeBaseSession
  always builds the routing table from raw backend capabilities (no overrides/conflict-
  resolution/filter; the core owns that). makeBaseSession's now-always-nil error return is
  dropped (+ its two callers).
- aggregator: remove `Aggregator.ProcessPreQueriedCapabilities` (interface + impl + regenerated
  mock) — its only caller was buildRoutingTableWithAggregator.
- cli/serve.go: inline the trivial createSessionFactory to NewSessionFactory and drop the
  WithAggregator(agg) wiring (agg still feeds the core via Config.Aggregator).

Part of #5621.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The core owns composite-tool execution (executeComposite) and workflow telemetry
(core_telemetry.go's telemetryComposer, #5561), and nothing sets FactoryConfig.WorkflowDefs/
ComposerFactory on the Serve path (server.New and the integration harness leave them unset),
so the session factory's composite-tool decorator and its workflow-executor telemetry never
run. Remove them — the second half of #5621 Stage 2:

- sessionmanager/factory.go: delete compositeToolsDecorator, composerWorkflowExecutor,
  workflowExecutorInstruments + newWorkflowExecutorInstruments + wrapExecutor, and
  telemetryWorkflowExecutor; drop the instruments param from buildDecoratingFactory. The
  optimizer decorator and its telemetry (monitorOptimizer/telemetryOptimizer) are untouched.
- FactoryConfig: drop the dead WorkflowDefs + ComposerFactory fields.
- session_manager.go: drop the workflow-instruments setup and the now-dead "ComposerFactory
  required when WorkflowDefs set" validation.

Part of #5621.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@github-actions github-actions Bot added the size/L Large PR: 600-999 lines changed label Jun 24, 2026
@codecov

codecov Bot commented Jun 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 70.13%. Comparing base (799b422) to head (549caf7).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5625      +/-   ##
==========================================
+ Coverage   69.93%   70.13%   +0.20%     
==========================================
  Files         650      652       +2     
  Lines       66289    66277      -12     
==========================================
+ Hits        46358    46484     +126     
+ Misses      16588    16434     -154     
- Partials     3343     3359      +16     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@tgrunnagle tgrunnagle merged commit 12fb161 into main Jun 24, 2026
46 checks passed
@tgrunnagle tgrunnagle deleted the vmcp-core-p3-2b-stage2_issue_5621 branch June 24, 2026 18:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/L Large PR: 600-999 lines changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants