Skip to content

version cut - #4571

Merged
akshaydeo merged 1 commit into
devfrom
06-20-version_cut
Jun 20, 2026
Merged

version cut#4571
akshaydeo merged 1 commit into
devfrom
06-20-version_cut

Conversation

@akshaydeo

@akshaydeo akshaydeo commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

Summary

MCP client connections are now deferred until after all plugins are registered, ensuring PreMCPConnectionHook runs against the complete plugin set. Previously, NewMCPManager dialed clients immediately during construction, which meant plugins registered after Init (e.g. enterprise plugins) were silently excluded from the hook and the client would only recover on a later health-monitor reconnect cycle.

Changes

  • Extracted the parallel client-dialing logic from NewMCPManager into a new ConnectConfiguredClients method on MCPManager. Construction now only stores the boot configs; callers must explicitly invoke ConnectConfiguredClients when ready.
  • Added ConnectConfiguredMCPClients on Bifrost as the public entry point, delegating to MCPManager.ConnectConfiguredClients when MCP is configured.
  • Added ConnectConfiguredClients to MCPManagerInterface to keep the interface consistent.
  • In the HTTP server's Bootstrap, ConnectConfiguredMCPClients is called after all inference routes (and therefore all plugins) are registered.
  • Updated the MCP test fixture helper setupMCPManager to call ConnectConfiguredClients explicitly after construction.
  • Renamed the logs_add_canonical_model_columns migration to logs_add_canonical_model_columns_v2 to fix a previously broken migration.

Type of change

  • Bug fix
  • Feature
  • Refactor
  • Documentation
  • Chore/CI

Affected areas

  • Core (Go)
  • Transports (HTTP)
  • Providers/Integrations
  • Plugins
  • UI (React)
  • Docs

How to test

# Core/Transports
go version
go test ./...
go test ./core/internal/mcptests/...
  1. Configure one or more MCP clients in MCPConfig.ClientConfigs alongside at least one plugin that implements PreMCPConnectionHook.
  2. Start the HTTP server and confirm the hook is invoked for each configured client during Bootstrap rather than during Init.
  3. Simulate a connection failure for a boot client and verify the client is retained in Disconnected state and the health monitor recovers it automatically.

Breaking changes

  • Yes
  • No

Callers that construct MCPManager directly via NewMCPManager must now call manager.ConnectConfiguredClients(ctx) explicitly after construction. The HTTP server transport handles this automatically. Any custom transport or embedding that relied on auto-connect during NewMCPManager will need to add this call.

Related issues

Closes #4556 (Anthropic duplicate message_start stream event, included in changelog)

Security considerations

No new auth surfaces or PII handling introduced. The change only affects the timing of MCP client connection establishment.

Checklist

  • I read docs/contributing/README.md and followed the guidelines
  • I added/updated tests where appropriate
  • I updated documentation where needed
  • I verified builds succeed (Go and UI)
  • I verified the CI pipeline passes locally if applicable

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@coderabbitai

coderabbitai Bot commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 0548e76d-88be-460f-9d62-93a91c59c92f

📥 Commits

Reviewing files that changed from the base of the PR and between 1f5aea6 and 51780e5.

📒 Files selected for processing (34)
  • core/bifrost.go
  • core/changelog.md
  • core/internal/mcptests/fixtures.go
  • core/mcp/interface.go
  • core/mcp/mcp.go
  • core/version
  • framework/changelog.md
  • framework/logstore/migrations.go
  • framework/version
  • plugins/compat/changelog.md
  • plugins/compat/version
  • plugins/governance/changelog.md
  • plugins/governance/version
  • plugins/jsonparser/changelog.md
  • plugins/jsonparser/version
  • plugins/logging/changelog.md
  • plugins/logging/version
  • plugins/maxim/changelog.md
  • plugins/maxim/version
  • plugins/mocker/changelog.md
  • plugins/mocker/version
  • plugins/modelcatalogresolver/changelog.md
  • plugins/modelcatalogresolver/version
  • plugins/otel/changelog.md
  • plugins/otel/version
  • plugins/prompts/changelog.md
  • plugins/prompts/version
  • plugins/semanticcache/changelog.md
  • plugins/semanticcache/version
  • plugins/telemetry/changelog.md
  • plugins/telemetry/version
  • transports/bifrost-http/server/server.go
  • transports/changelog.md
  • transports/version

📝 Walkthrough

Summary by CodeRabbit

  • New Features

    • Added dashboard export endpoint
    • Introduced Virtual Key Rankings dashboard tab
    • Enhanced tracing with business unit and user identification
    • Session-based trace grouping support
  • Bug Fixes

    • Resolved Anthropic streaming duplicate message handling
    • Fixed Bedrock model signature and handling issues
    • Corrected list-models request 403 errors
    • Improved OAuth governance behavior
    • Fixed conflict error HTTP status codes
    • Enhanced single-file serving with encoded filenames
  • Chores

    • Updated core, framework, and plugin dependencies to latest versions

Walkthrough

Defers MCP client dialing from NewMCPManager construction to a new explicit ConnectConfiguredClients lifecycle method. The method is added to MCPManagerInterface, implemented on MCPManager, wrapped as Bifrost.ConnectConfiguredMCPClients, and called in the HTTP server Bootstrap after plugin registration. A canonical-model migration step is renamed to v2. All module versions are bumped to the v1.5.22/v1.3.22 release.

Changes

MCP Deferred Client Connection

Layer / File(s) Summary
MCPManagerInterface and MCPManager struct extension
core/mcp/interface.go, core/mcp/mcp.go
Adds ConnectConfiguredClients(ctx) to MCPManagerInterface and adds bootClientConfigs and connectOnce fields to MCPManager to hold construction-time client configs for later dialing.
ConnectConfiguredClients implementation
core/mcp/mcp.go
NewMCPManager no longer dials clients; stores ClientConfigs into bootClientConfigs. ConnectConfiguredClients dials all stored configs in parallel via AddClient, retaining failed clients in Disconnected state and starting ClientHealthMonitor per failure.
Bifrost public entry point
core/bifrost.go
Adds Bifrost.ConnectConfiguredMCPClients that delegates to MCPManager.ConnectConfiguredClients when present, no-ops otherwise.
Bootstrap call site and test fixture
transports/bifrost-http/server/server.go, core/internal/mcptests/fixtures.go
HTTP server Bootstrap calls ConnectConfiguredMCPClients after plugins are registered. Test setupMCPManager adds an explicit ConnectConfiguredClients call to match the new lifecycle.

Canonical Model Migration Rename

Layer / File(s) Summary
Migration step ID renamed to v2
framework/logstore/migrations.go
logstoreMigrationSteps entry and migrationAddCanonicalModelColumns's internal ID both updated from logs_add_canonical_model_columns to logs_add_canonical_model_columns_v2.

v1.5.22 Release — Version Bumps and Changelogs

Layer / File(s) Summary
Version files and changelogs
core/version, framework/version, transports/version, plugins/*/version, core/changelog.md, framework/changelog.md, transports/changelog.md, plugins/*/changelog.md
All module version files increment to reflect the v1.5.22 core / v1.3.22 framework / v1.5.16 transports release. Changelogs document new features, fixes, and dependency upgrades.

Sequence Diagram(s)

sequenceDiagram
    participant Bootstrap
    participant Bifrost
    participant MCPManager

    Bootstrap->>Bifrost: Init(config) — plugins registered
    Note over Bifrost,MCPManager: NewMCPManager stores bootClientConfigs, does NOT dial
    Bootstrap->>Bootstrap: Register inference routes & plugins
    Bootstrap->>Bifrost: ConnectConfiguredMCPClients(ctx)
    Bifrost->>MCPManager: ConnectConfiguredClients(ctx)
    par for each ClientConfig
        MCPManager->>MCPManager: AddClient(cfg)
        alt success
            MCPManager-->>MCPManager: client Connected
        else failure
            MCPManager-->>MCPManager: client Disconnected + start ClientHealthMonitor
        end
    end
    MCPManager-->>Bifrost: all goroutines complete
    Bifrost-->>Bootstrap: return
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Suggested reviewers

  • danpiths

Poem

🐇 A rabbit once built all his tunnels at dawn,
Before the plugins had properly spawned.
Now connections wait, till the hooks are all set,
ConnectConfiguredClients — best lifecycle yet!
No more racing the clock, every hook gets its say,
The warren is wired in the right order today. 🌱

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning The code changes involve MCP client connection refactoring and version bumps across core/framework/plugins, which are unrelated to the linked issue #123 'Files API Support' covering OpenAI/Anthropic file upload functionality. Either link this PR to the appropriate issues tracking version releases and MCP refactoring, or remove the #123 Files API reference if this PR is purely a version cut unrelated to that feature.
Title check ❓ Inconclusive The title 'version cut' is vague and generic, lacking specific details about what version changes were made or their scope. Include specific version numbers or key components affected in the title, e.g., 'Bump core, framework, and plugin versions to v1.5.22/v1.3.22' or 'Cut release v1.5.22 with MCP client connection refactoring.'
✅ Passed checks (3 passed)
Check name Status Explanation
Out of Scope Changes check ✅ Passed All changes align with a version cut release: MCP client connection refactoring, version bumps across core/framework/plugins/transports, and corresponding changelog updates.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Description check ✅ Passed The pull request description is comprehensive and well-structured, covering all major template sections with specific technical details about MCP client connection deferral, changes made, affected areas, testing steps, breaking changes with migration guidance, and security considerations.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 06-20-version_cut

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 golangci-lint (2.12.2)

level=error msg="[linters_context] typechecking error: pattern ./...: directory prefix . does not contain main module or its selected dependencies"


Comment @coderabbitai help to get the list of available commands and usage tips.

@akshaydeo
akshaydeo marked this pull request as ready for review June 20, 2026 07:35

Copy link
Copy Markdown
Contributor Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@greptile-apps

greptile-apps Bot commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5

Safe to merge — the refactor is a clean extraction with no behavior change at runtime, and the migration rename is protected by idempotent column-existence checks.

The two-phase MCP construction is well-guarded: sync.Once prevents duplicate dials, the interface compile-time assertion keeps the contract enforced, and the HTTP server placement of ConnectConfiguredMCPClients is correct. The migration rename forces a re-run of a previously broken step but cannot double-add columns because the migration function checks HasColumn before acting. No logic regressions were found in any changed path.

No files require special attention.

Important Files Changed

Filename Overview
core/mcp/mcp.go Extracted client dialing from constructor into ConnectConfiguredClients, guarded by sync.Once; logic is unchanged from before, just deferred. Clean refactor.
core/mcp/interface.go Added ConnectConfiguredClients to MCPManagerInterface; compile-time assertion on line 107 keeps the interface and concrete type in sync.
transports/bifrost-http/server/server.go ConnectConfiguredMCPClients is called in Bootstrap after RegisterInferenceRoutes succeeds, ensuring the full plugin set is present. Placement and error-path handling are correct.
framework/logstore/migrations.go Migration ID renamed v1→v2 to force re-run; the migration function is idempotent via HasColumn guards, so databases that already have the columns see a safe no-op. Both the outer step ID and inner migrator ID are updated consistently.
core/bifrost.go Thin public wrapper ConnectConfiguredMCPClients added; nil-guards MCPManager correctly before delegating.
core/internal/mcptests/fixtures.go Test fixture correctly calls ConnectConfiguredClients explicitly after NewMCPManager to match the new two-phase construction pattern.

Sequence Diagram

%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
    participant Caller
    participant Bootstrap
    participant Bifrost
    participant MCPManager

    Caller->>Bootstrap: Bootstrap(ctx)
    Bootstrap->>Bifrost: Init(ctx, config)
    Note over Bifrost,MCPManager: NewMCPManager stores bootClientConfigs<br/>but does NOT dial clients
    Bifrost-->>Bootstrap: client ready (no MCP connections yet)
    Bootstrap->>Bootstrap: "RegisterInferenceRoutes()<br/>(registers all plugins incl. enterprise)"
    Bootstrap->>Bifrost: ConnectConfiguredMCPClients(ctx)
    Bifrost->>MCPManager: ConnectConfiguredClients(ctx)
    Note over MCPManager: sync.Once ensures single execution
    MCPManager->>MCPManager: connectConfiguredClients() — dials in parallel
    Note over MCPManager: PreMCPConnectionHook now sees<br/>the complete plugin set
    MCPManager-->>Bifrost: connections established (or Disconnected + health monitor)
    Bifrost-->>Bootstrap: done
    Bootstrap-->>Caller: nil (server ready)
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
    participant Caller
    participant Bootstrap
    participant Bifrost
    participant MCPManager

    Caller->>Bootstrap: Bootstrap(ctx)
    Bootstrap->>Bifrost: Init(ctx, config)
    Note over Bifrost,MCPManager: NewMCPManager stores bootClientConfigs<br/>but does NOT dial clients
    Bifrost-->>Bootstrap: client ready (no MCP connections yet)
    Bootstrap->>Bootstrap: "RegisterInferenceRoutes()<br/>(registers all plugins incl. enterprise)"
    Bootstrap->>Bifrost: ConnectConfiguredMCPClients(ctx)
    Bifrost->>MCPManager: ConnectConfiguredClients(ctx)
    Note over MCPManager: sync.Once ensures single execution
    MCPManager->>MCPManager: connectConfiguredClients() — dials in parallel
    Note over MCPManager: PreMCPConnectionHook now sees<br/>the complete plugin set
    MCPManager-->>Bifrost: connections established (or Disconnected + health monitor)
    Bifrost-->>Bootstrap: done
    Bootstrap-->>Caller: nil (server ready)
Loading

Reviews (2): Last reviewed commit: "version cut" | Re-trigger Greptile

Comment thread core/mcp/mcp.go

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
framework/logstore/migrations.go (1)

2941-2978: ⚡ Quick win

Add a comment documenting the migration ID version change.

The migration name was updated to logs_add_canonical_model_columns_v2, but there's no explanation for why the migration was versioned. Future maintainers reviewing this code won't understand whether:

  • The original migration had a bug that required re-running
  • The schema change was modified between versions
  • The versioning is purely for release tracking
📝 Suggested documentation addition
 func migrationAddCanonicalModelColumns(ctx context.Context, db *gorm.DB, logger schemas.Logger) error {
+	// Migration ID versioned to v2 in release 1.5.22 to [explain reason here, e.g.,
+	// "force re-application after fixing a bug in the original migration" or
+	// "track which release version applied this schema change"]
 	migrationName := "logs_add_canonical_model_columns_v2"
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@framework/logstore/migrations.go` around lines 2941 - 2978, The migration ID
in the migrationAddCanonicalModelColumns function was changed to include a v2
version suffix, but there is no explanatory comment documenting why this
versioning change was necessary. Add a comment above the migrationName variable
assignment that explains the reason for the version change, such as whether the
original migration had a bug that required re-running, the schema change was
modified between versions, or the versioning is for release tracking purposes.
This will help future maintainers understand the migration history and intent.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@framework/logstore/migrations.go`:
- Line 262: Add a comment above the migration registration line (where the IDs
array contains "logs_add_canonical_model_columns_v2") explaining that the v2
suffix indicates this is a bugfix re-run for the canonical_model_view migration
and reference the related fix commit or bug description. Additionally, update
the documentation comment for the migrationAddCanonicalModelColumns function
(currently at lines 2937-2940) to clarify that this is a bugfix migration that
forces re-execution on existing databases due to a bug in the original
migration, and explain that the column-existence guards prevent errors on
systems that already have the columns.

---

Nitpick comments:
In `@framework/logstore/migrations.go`:
- Around line 2941-2978: The migration ID in the
migrationAddCanonicalModelColumns function was changed to include a v2 version
suffix, but there is no explanatory comment documenting why this versioning
change was necessary. Add a comment above the migrationName variable assignment
that explains the reason for the version change, such as whether the original
migration had a bug that required re-running, the schema change was modified
between versions, or the versioning is for release tracking purposes. This will
help future maintainers understand the migration history and intent.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: b2d9823e-d09b-4a8d-8539-a914a6fe30bd

📥 Commits

Reviewing files that changed from the base of the PR and between 2cd95b5 and 1f5aea6.

📒 Files selected for processing (34)
  • core/bifrost.go
  • core/changelog.md
  • core/internal/mcptests/fixtures.go
  • core/mcp/interface.go
  • core/mcp/mcp.go
  • core/version
  • framework/changelog.md
  • framework/logstore/migrations.go
  • framework/version
  • plugins/compat/changelog.md
  • plugins/compat/version
  • plugins/governance/changelog.md
  • plugins/governance/version
  • plugins/jsonparser/changelog.md
  • plugins/jsonparser/version
  • plugins/logging/changelog.md
  • plugins/logging/version
  • plugins/maxim/changelog.md
  • plugins/maxim/version
  • plugins/mocker/changelog.md
  • plugins/mocker/version
  • plugins/modelcatalogresolver/changelog.md
  • plugins/modelcatalogresolver/version
  • plugins/otel/changelog.md
  • plugins/otel/version
  • plugins/prompts/changelog.md
  • plugins/prompts/version
  • plugins/semanticcache/changelog.md
  • plugins/semanticcache/version
  • plugins/telemetry/changelog.md
  • plugins/telemetry/version
  • transports/bifrost-http/server/server.go
  • transports/changelog.md
  • transports/version

Comment thread framework/logstore/migrations.go
coderabbitai[bot]
coderabbitai Bot previously approved these changes Jun 20, 2026

akshaydeo commented Jun 20, 2026

Copy link
Copy Markdown
Contributor Author

Merge activity

  • Jun 20, 7:54 AM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Jun 20, 7:54 AM UTC: @akshaydeo merged this pull request with Graphite.

@akshaydeo
akshaydeo merged commit 1dbcefc into dev Jun 20, 2026
14 of 16 checks passed
@akshaydeo
akshaydeo deleted the 06-20-version_cut branch June 20, 2026 07:54
akshaydeo added a commit that referenced this pull request Jun 21, 2026
## Summary

MCP client connections are now deferred until after all plugins are registered, ensuring `PreMCPConnectionHook` runs against the complete plugin set. Previously, `NewMCPManager` dialed clients immediately during construction, which meant plugins registered after `Init` (e.g. enterprise plugins) were silently excluded from the hook and the client would only recover on a later health-monitor reconnect cycle.

## Changes

- Extracted the parallel client-dialing logic from `NewMCPManager` into a new `ConnectConfiguredClients` method on `MCPManager`. Construction now only stores the boot configs; callers must explicitly invoke `ConnectConfiguredClients` when ready.
- Added `ConnectConfiguredMCPClients` on `Bifrost` as the public entry point, delegating to `MCPManager.ConnectConfiguredClients` when MCP is configured.
- Added `ConnectConfiguredClients` to `MCPManagerInterface` to keep the interface consistent.
- In the HTTP server's `Bootstrap`, `ConnectConfiguredMCPClients` is called after all inference routes (and therefore all plugins) are registered.
- Updated the MCP test fixture helper `setupMCPManager` to call `ConnectConfiguredClients` explicitly after construction.
- Renamed the `logs_add_canonical_model_columns` migration to `logs_add_canonical_model_columns_v2` to fix a previously broken migration.

## Type of change

- [ ] Bug fix
- [ ] Feature
- [x] Refactor
- [ ] Documentation
- [ ] Chore/CI

## Affected areas

- [x] Core (Go)
- [x] Transports (HTTP)
- [ ] Providers/Integrations
- [x] Plugins
- [ ] UI (React)
- [ ] Docs

## How to test

```sh
# Core/Transports
go version
go test ./...
go test ./core/internal/mcptests/...
```

1. Configure one or more MCP clients in `MCPConfig.ClientConfigs` alongside at least one plugin that implements `PreMCPConnectionHook`.
2. Start the HTTP server and confirm the hook is invoked for each configured client during `Bootstrap` rather than during `Init`.
3. Simulate a connection failure for a boot client and verify the client is retained in `Disconnected` state and the health monitor recovers it automatically.

## Breaking changes

- [x] Yes
- [ ] No

Callers that construct `MCPManager` directly via `NewMCPManager` must now call `manager.ConnectConfiguredClients(ctx)` explicitly after construction. The HTTP server transport handles this automatically. Any custom transport or embedding that relied on auto-connect during `NewMCPManager` will need to add this call.

## Related issues

Closes #4556 (Anthropic duplicate `message_start` stream event, included in changelog)

## Security considerations

No new auth surfaces or PII handling introduced. The change only affects the timing of MCP client connection establishment.

## Checklist

- [x] I read `docs/contributing/README.md` and followed the guidelines
- [x] I added/updated tests where appropriate
- [ ] I updated documentation where needed
- [x] I verified builds succeed (Go and UI)
- [x] I verified the CI pipeline passes locally if applicable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: duplicate message_start SSE frame on Anthropic passthrough (responses_stream)

2 participants