Skip to content

Remove legacy optimizer decorator path - #6119

Open
kocaemre wants to merge 2 commits into
stacklok:mainfrom
kocaemre:chore/remove-legacy-optimizer-decorator
Open

Remove legacy optimizer decorator path#6119
kocaemre wants to merge 2 commits into
stacklok:mainfrom
kocaemre:chore/remove-legacy-optimizer-decorator

Conversation

@kocaemre

Copy link
Copy Markdown

Summary

  • The optimizer-without-AdvertiseFromCore path is now rejected by sessionmanager.New, so the old factory-level optimizer decorator branch can no longer run.
  • Remove the unreachable legacy optimizer decorator path and its private tool-adaptation helper.
  • Wire the session manager directly to the undecorated base factory; the resolved optimizer factory continues to be surfaced to the Serve layer via Manager.OptimizerFactory().

Fixes #6103

Type of change

  • Bug fix
  • New feature
  • Refactoring (no behavior change)
  • Dependency update
  • Documentation
  • Other (describe):

Test plan

  • Unit tests (task test)
  • E2E tests (task test-e2e)
  • Linting (task lint-fix)
  • Manual testing (describe below)

Manual testing:

  • PATH=/usr/local/go/bin:/root/go/bin:$PATH go test ./pkg/vmcp/server/sessionmanager
  • PATH=/usr/local/go/bin:/root/go/bin:$PATH go test ./pkg/vmcp/server/sessionmanager ./pkg/vmcp/server
  • PATH=/usr/local/go/bin:/root/go/bin:$PATH go test -race ./pkg/vmcp/server/sessionmanager
  • PATH=/usr/local/go/bin:/root/go/bin:$PATH task lint
  • git diff --check

API Compatibility

  • This PR does not break the v1beta1 API, OR the api-break-allowed label is applied and the migration guidance is described above.

Does this introduce a user-facing change?

No.

Special notes for reviewers

This is intentionally a deletion-only follow-up to the constructor guard merged in #6033. The optimizer is still resolved, cleaned up by the manager, and consumed by the Serve layer when enabled; the removed path was unreachable because New rejects an optimizer unless AdvertiseFromCore is set.

Signed-off-by: Emre K <110906681+kocaemre@users.noreply.github.com>
@github-actions github-actions Bot added the size/S Small PR: 100-299 lines changed label Aug 7, 2026
@codecov

codecov Bot commented Aug 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 72.77%. Comparing base (acc6df3) to head (eaad88c).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6119      +/-   ##
==========================================
+ Coverage   72.69%   72.77%   +0.08%     
==========================================
  Files         741      741              
  Lines       77212    77147      -65     
==========================================
+ Hits        56127    56142      +15     
+ Misses      17127    17050      -77     
+ Partials     3958     3955       -3     

☔ 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.

@ChrisJBurns ChrisJBurns left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two stale doc comments elsewhere in this file describe the removed decorator path — not required for this PR, but worth a quick follow-up.

)

sm.factory = buildDecoratingFactory(cfg, optimizerFactory, sm.Terminate)
sm.factory = vmcpsession.NewDecoratingFactory(cfg.Base)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New()'s doc comment at lines 95-96 still says: "It builds the decorating session factory from cfg, wiring the optimizer and composite tool layers internally." That's no longer accurate — the factory is now just cfg.Base with no decorators, and the optimizer is surfaced solely via sm.optimizerFactory/OptimizerFactory() for the Serve layer to consume. Worth rewording.

)

sm.factory = buildDecoratingFactory(cfg, optimizerFactory, sm.Terminate)
sm.factory = vmcpsession.NewDecoratingFactory(cfg.Base)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment at lines 132-133 above sm := &Manager{...} says "Build the Manager first so we can reference sm.Terminate and sm.sessions directly in closures..." — with buildDecoratingFactory (and its sm.Terminate param) gone, nothing built in New() references sm.Terminate anymore, only sm.loadSession/sm.checkSession/sm.sessions. The comment should drop the sm.Terminate mention.

@github-actions github-actions Bot added size/S Small PR: 100-299 lines changed and removed size/S Small PR: 100-299 lines changed labels Aug 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/S Small PR: 100-299 lines changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Delete the unreachable legacy optimizer decorator path in sessionmanager

2 participants