Skip to content

fix: remove resolution parameter from image generation and add MCP client config fields#2041

Merged
Pratham-Mishra04 merged 1 commit intomainfrom
03-12-fix_minor_fixes
Mar 13, 2026
Merged

fix: remove resolution parameter from image generation and add MCP client config fields#2041
Pratham-Mishra04 merged 1 commit intomainfrom
03-12-fix_minor_fixes

Conversation

@Pratham-Mishra04
Copy link
Copy Markdown
Collaborator

Summary

Removes the Resolution parameter from image generation functionality across the Replicate provider and core schemas, while adding support for ping availability and tool sync interval configuration in MCP client setup.

Changes

  • Removed Resolution field from ImageGenerationParameters in core schemas
  • Removed Resolution field from ReplicatePredictionRequestInput struct and its JSON unmarshaling logic
  • Eliminated resolution parameter mapping in ToReplicateImageGenerationInput function
  • Added IsPingAvailable and ToolSyncInterval configuration support in MCP client handler with proper defaults

Type of change

  • Refactor
  • Feature

Affected areas

  • Core (Go)
  • Transports (HTTP)
  • Providers/Integrations

How to test

Validate image generation still works without resolution parameter and MCP client configuration accepts new parameters:

# Core/Transports
go version
go test ./...

Test image generation requests to ensure they work without the resolution parameter. Test MCP client creation with and without the new IsPingAvailable and ToolSyncInterval parameters to verify proper defaults are applied.

Screenshots/Recordings

N/A

Breaking changes

  • Yes

The removal of the Resolution parameter from image generation requests is a breaking change. Any clients currently sending this parameter will need to remove it from their requests. The parameter will be ignored if sent.

Related issues

N/A

Security considerations

No security implications identified. The changes involve parameter removal and configuration additions without affecting authentication or sensitive data handling.

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.

Copy link
Copy Markdown
Collaborator Author

Pratham-Mishra04 commented Mar 12, 2026

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Mar 12, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 9cca80e1-d31d-4bcb-bfa3-7def3c72eccd

📥 Commits

Reviewing files that changed from the base of the PR and between 5120bd4 and e6da1e0.

📒 Files selected for processing (4)
  • core/providers/replicate/images.go
  • core/providers/replicate/types.go
  • core/schemas/images.go
  • transports/bifrost-http/handlers/mcp.go

📝 Walkthrough

Summary by CodeRabbit

  • Bug Fixes

    • Removed the Resolution parameter from image-generation requests to prevent unintended resolution overrides.
  • New Features

    • MCP client configuration now supports ToolSyncInterval and IsPingAvailable, enabling finer control of sync timing and ping behavior during client creation, updates, and OAuth flows. Defaults are derived when not provided.

Walkthrough

Removed the Resolution parameter from image generation schemas and Replicate provider types and mapping; updated MCP HTTP handler to derive and propagate ToolSyncInterval and IsPingAvailable into pending and final MCP client configs across OAuth and non-OAuth flows.

Changes

Cohort / File(s) Summary
Image generation parameter removal
core/schemas/images.go, core/providers/replicate/types.go, core/providers/replicate/images.go
Deleted Resolution field from ImageGenerationParameters and removed the resolution field from ReplicatePredictionRequestInput and its mapping; no other parameter mappings changed.
MCP client configuration enhancement
transports/bifrost-http/handlers/mcp.go
Added mcp import and updated add/update MCP client flows to derive/use ToolSyncInterval (prefer request → stored config → mcp.DefaultToolSyncInterval) and IsPingAvailable, storing them in pending and final MCPClientConfig for OAuth and non-OAuth paths.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant HTTP_Handler as "Bifrost HTTP Handler"
    participant ConfigStore
    participant MCP_Runtime as "mcp Runtime"

    Client->>HTTP_Handler: Create MCP client request (OAuth or direct)
    alt OAuth flow
        HTTP_Handler->>ConfigStore: create pending MCPClientConfig (ToolSyncInterval, IsPingAvailable)
        HTTP_Handler-->>Client: return OAuth redirect
        Client->>HTTP_Handler: OAuth callback
        HTTP_Handler->>ConfigStore: finalize pending -> store final MCPClientConfig
        HTTP_Handler->>MCP_Runtime: start/connect with final MCPClientConfig
    else Non-OAuth flow
        HTTP_Handler->>ConfigStore: derive ToolSyncInterval (request or stored or mcp.DefaultToolSyncInterval)
        HTTP_Handler->>ConfigStore: store MCPClientConfig (ToolSyncInterval, IsPingAvailable)
        HTTP_Handler->>MCP_Runtime: start/connect with MCPClientConfig
    end
    MCP_Runtime->>HTTP_Handler: optional ping/health checks (if IsPingAvailable)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 I hopped through code with tiny paws,
Nibbled out the resolution clause.
I set the sync ticks, let pings take flight,
OAuth and direct now hum just right,
A rabbit cheers the config's light.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main changes: removal of the Resolution parameter from image generation and addition of MCP client config fields.
Description check ✅ Passed The description is comprehensive and covers all required template sections with appropriate detail, though some checklist items remain unchecked.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch 03-12-fix_minor_fixes
📝 Coding Plan
  • Generate coding plan for human review comments

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

@Pratham-Mishra04 Pratham-Mishra04 force-pushed the 02-26-refactor_pricing_module_refactor branch from 5e6a6b8 to c017629 Compare March 12, 2026 13:20
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@transports/bifrost-http/handlers/mcp.go`:
- Around line 243-255: The default for IsPingAvailable in the OAuth branch is
currently set to false, causing pending OAuth-created clients to skip pings;
change the default to true and only override it when req.IsPingAvailable is
non-nil (i.e., set isPingAvailable := true then if req.IsPingAvailable != nil {
isPingAvailable = *req.IsPingAvailable }), so the pendingConfig
(schemas.MCPClientConfig with field IsPingAvailable) matches the direct-create
default behavior.
- Around line 238-241: The OAuth create path currently sets toolSyncInterval to
mcp.DefaultToolSyncInterval whenever req.ToolSyncInterval == 0, ignoring any
instance override; change the logic in the block that assigns toolSyncInterval
so that if req.ToolSyncInterval == 0 you first check
instance.MCPToolSyncInterval (and use it if non-zero, converting to
time.Duration * time.Minute), otherwise fall back to
mcp.DefaultToolSyncInterval; update the assignment that uses
req.ToolSyncInterval to only multiply by time.Minute when req.ToolSyncInterval
is non-zero and ensure the final toolSyncInterval variable reflects the instance
override when present.
🪄 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: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 6406fcd8-2dc1-4b9c-ab65-e6d39f3d147b

📥 Commits

Reviewing files that changed from the base of the PR and between c017629 and bb7602f.

📒 Files selected for processing (4)
  • core/providers/replicate/images.go
  • core/providers/replicate/types.go
  • core/schemas/images.go
  • transports/bifrost-http/handlers/mcp.go
💤 Files with no reviewable changes (3)
  • core/providers/replicate/images.go
  • core/schemas/images.go
  • core/providers/replicate/types.go

Comment thread transports/bifrost-http/handlers/mcp.go Outdated
@TejasGhatte TejasGhatte mentioned this pull request Mar 12, 2026
10 tasks
@Pratham-Mishra04 Pratham-Mishra04 force-pushed the 02-26-refactor_pricing_module_refactor branch from c017629 to dbf2248 Compare March 12, 2026 17:20
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
transports/bifrost-http/handlers/mcp.go (1)

423-441: ⚠️ Potential issue | 🟠 Major

Resolve toolSyncInterval before the DB write, or rollback on lookup failure.

UpdateMCPClientConfig now commits the DB change before the new GetClientConfig call. If that lookup fails on Line 435, the handler returns with the DB updated and the in-memory MCP client still on the old config; the existing rollback only covers h.mcpManager.UpdateMCPClient failures. This new error path can leave storage and runtime out of sync.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@transports/bifrost-http/handlers/mcp.go` around lines 423 - 441, The handler
currently updates the DB (h.store.ConfigStore.UpdateMCPClientConfig) before
resolving toolSyncInterval via h.store.ConfigStore.GetClientConfig, which can
leave DB and in-memory MCP out of sync if GetClientConfig fails; either compute
toolSyncInterval first (use req.ToolSyncInterval if set, otherwise call
GetClientConfig before calling UpdateMCPClientConfig) or, if you must keep the
DB-write-first order, perform a compensating rollback on lookup failure by
re-writing the previous client config back to the store (capture the old config
via GetClientConfig at the start) and return the error; update the flow around
UpdateMCPClientConfig, GetClientConfig, toolSyncInterval and
h.mcpManager.UpdateMCPClient to ensure the DB write and in-memory update remain
consistent.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@transports/bifrost-http/handlers/mcp.go`:
- Around line 238-250: The handler currently replaces a missing
req.ToolSyncInterval (0) with the resolved instance default and writes that
concrete value into the stored client config, which pins the client; instead,
preserve 0 in stored config while still resolving a runtime duration for
in-memory use. Concretely: keep the stored field (e.g.,
schemas.MCPClientConfig.ToolSyncInterval / pendingConfig) set to
req.ToolSyncInterval (leave as 0 when omitted), and introduce a separate runtime
variable (e.g., toolSyncIntervalResolved or reuse local toolSyncInterval only
for runtime) that, when req.ToolSyncInterval == 0, fetches
h.store.ConfigStore.GetClientConfig(ctx) and sets the runtime duration from
config.MCPToolSyncInterval; only use the resolved duration for runtime logic but
do not write it back into pendingConfig/ schemasConfig. Apply this change in the
tool_sync_interval handling blocks referenced (around the toolSyncInterval,
req.ToolSyncInterval, h.store.ConfigStore.GetClientConfig usage at the shown
ranges).

---

Outside diff comments:
In `@transports/bifrost-http/handlers/mcp.go`:
- Around line 423-441: The handler currently updates the DB
(h.store.ConfigStore.UpdateMCPClientConfig) before resolving toolSyncInterval
via h.store.ConfigStore.GetClientConfig, which can leave DB and in-memory MCP
out of sync if GetClientConfig fails; either compute toolSyncInterval first (use
req.ToolSyncInterval if set, otherwise call GetClientConfig before calling
UpdateMCPClientConfig) or, if you must keep the DB-write-first order, perform a
compensating rollback on lookup failure by re-writing the previous client config
back to the store (capture the old config via GetClientConfig at the start) and
return the error; update the flow around UpdateMCPClientConfig, GetClientConfig,
toolSyncInterval and h.mcpManager.UpdateMCPClient to ensure the DB write and
in-memory update remain consistent.
🪄 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: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 9b1adbda-d7cb-44e5-8810-4416d18789f3

📥 Commits

Reviewing files that changed from the base of the PR and between bb7602f and 546b43d.

📒 Files selected for processing (4)
  • core/providers/replicate/images.go
  • core/providers/replicate/types.go
  • core/schemas/images.go
  • transports/bifrost-http/handlers/mcp.go
💤 Files with no reviewable changes (3)
  • core/providers/replicate/images.go
  • core/providers/replicate/types.go
  • core/schemas/images.go

Comment thread transports/bifrost-http/handlers/mcp.go
@TejasGhatte TejasGhatte changed the base branch from 02-26-refactor_pricing_module_refactor to graphite-base/2041 March 12, 2026 17:54
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@transports/bifrost-http/handlers/mcp.go`:
- Around line 238-250: The code currently overwrites toolSyncInterval with zero
when config.MCPToolSyncInterval is unset; change the assignment logic in the
handler so you only set toolSyncInterval =
time.Duration(config.MCPToolSyncInterval) * time.Minute when config != nil &&
config.MCPToolSyncInterval != 0, keeping the default
(mcp.DefaultToolSyncInterval) otherwise; apply this same non-zero check pattern
wherever toolSyncInterval is computed from config (the branch that checks
req.ToolSyncInterval and the non-OAuth and update paths) so that a zero config
value does not replace the default.
🪄 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: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 35e0ff3f-8a36-4f6a-b3af-145d37549c13

📥 Commits

Reviewing files that changed from the base of the PR and between 546b43d and 3ce8729.

📒 Files selected for processing (4)
  • core/providers/replicate/images.go
  • core/providers/replicate/types.go
  • core/schemas/images.go
  • transports/bifrost-http/handlers/mcp.go
💤 Files with no reviewable changes (3)
  • core/providers/replicate/types.go
  • core/providers/replicate/images.go
  • core/schemas/images.go

Comment thread transports/bifrost-http/handlers/mcp.go
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

♻️ Duplicate comments (1)
transports/bifrost-http/handlers/mcp.go (1)

238-249: ⚠️ Potential issue | 🟠 Major

Keep tool_sync_interval split into stored override vs runtime-resolved value (and guard zero global defaults).

Create flows still persist the resolved interval into config (pendingConfig / schemasConfig), which pins clients to today’s global default instead of preserving 0 as “inherit global default.” Also, config.MCPToolSyncInterval == 0 currently overwrites mcp.DefaultToolSyncInterval to 0.

Proposed fix pattern
- toolSyncInterval := mcp.DefaultToolSyncInterval
+ toolSyncIntervalRuntime := mcp.DefaultToolSyncInterval
+ storedToolSyncInterval := time.Duration(req.ToolSyncInterval) * time.Minute

  if req.ToolSyncInterval != 0 {
-   toolSyncInterval = time.Duration(req.ToolSyncInterval) * time.Minute
+   toolSyncIntervalRuntime = storedToolSyncInterval
  } else {
    config, err := h.store.ConfigStore.GetClientConfig(ctx)
    if err != nil { ... }
-   if config != nil {
-     toolSyncInterval = time.Duration(config.MCPToolSyncInterval) * time.Minute
+   if config != nil && config.MCPToolSyncInterval != 0 {
+     toolSyncIntervalRuntime = time.Duration(config.MCPToolSyncInterval) * time.Minute
    }
  }

  // persisted config (DB/pending): preserve override semantics
- ToolSyncInterval: toolSyncInterval,
+ ToolSyncInterval: storedToolSyncInterval,

  // runtime add/update call: use resolved runtime value
- ToolSyncInterval: toolSyncInterval,
+ ToolSyncInterval: toolSyncIntervalRuntime,

Also applies to: 259-265, 294-327, 429-441

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@transports/bifrost-http/handlers/mcp.go` around lines 238 - 249, The code is
resolving a runtime toolSyncInterval and then writing that resolved value into
stored configs (pendingConfig/schemasConfig), which loses the distinction
between an explicit stored override and "inherit global default" (0) and also
allows config.MCPToolSyncInterval == 0 to overwrite mcp.DefaultToolSyncInterval;
fix by keeping two values: (1) the stored override field (leave
req.ToolSyncInterval or config.MCPToolSyncInterval as-is, preserving 0 to mean
inherit) and (2) a separately computed runtimeToolSyncInterval used for behavior
(compute runtimeToolSyncInterval = req.ToolSyncInterval != 0 ?
req.ToolSyncInterval : (config != nil && config.MCPToolSyncInterval != 0 ?
config.MCPToolSyncInterval : mcp.DefaultToolSyncInterval)); update code paths
that persist pendingConfig/schemasConfig to write the stored override variable
(not runtimeToolSyncInterval) and ensure comparisons/guards check for zero
before substituting DefaultToolSyncInterval; refer to toolSyncInterval,
req.ToolSyncInterval, config.MCPToolSyncInterval, pendingConfig, schemasConfig,
and mcp.DefaultToolSyncInterval when applying this change.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In `@transports/bifrost-http/handlers/mcp.go`:
- Around line 238-249: The code is resolving a runtime toolSyncInterval and then
writing that resolved value into stored configs (pendingConfig/schemasConfig),
which loses the distinction between an explicit stored override and "inherit
global default" (0) and also allows config.MCPToolSyncInterval == 0 to overwrite
mcp.DefaultToolSyncInterval; fix by keeping two values: (1) the stored override
field (leave req.ToolSyncInterval or config.MCPToolSyncInterval as-is,
preserving 0 to mean inherit) and (2) a separately computed
runtimeToolSyncInterval used for behavior (compute runtimeToolSyncInterval =
req.ToolSyncInterval != 0 ? req.ToolSyncInterval : (config != nil &&
config.MCPToolSyncInterval != 0 ? config.MCPToolSyncInterval :
mcp.DefaultToolSyncInterval)); update code paths that persist
pendingConfig/schemasConfig to write the stored override variable (not
runtimeToolSyncInterval) and ensure comparisons/guards check for zero before
substituting DefaultToolSyncInterval; refer to toolSyncInterval,
req.ToolSyncInterval, config.MCPToolSyncInterval, pendingConfig, schemasConfig,
and mcp.DefaultToolSyncInterval when applying this change.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 548ef5a0-0a98-4736-84fb-686dc3e80dd4

📥 Commits

Reviewing files that changed from the base of the PR and between 3ce8729 and 5120bd4.

📒 Files selected for processing (4)
  • core/providers/replicate/images.go
  • core/providers/replicate/types.go
  • core/schemas/images.go
  • transports/bifrost-http/handlers/mcp.go
💤 Files with no reviewable changes (3)
  • core/providers/replicate/types.go
  • core/schemas/images.go
  • core/providers/replicate/images.go

Copy link
Copy Markdown
Collaborator Author

Pratham-Mishra04 commented Mar 13, 2026

Merge activity

  • Mar 13, 4:57 AM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Mar 13, 5:01 AM UTC: Graphite rebased this pull request as part of a merge.
  • Mar 13, 5:02 AM UTC: @Pratham-Mishra04 merged this pull request with Graphite.

@Pratham-Mishra04 Pratham-Mishra04 changed the base branch from graphite-base/2041 to main March 13, 2026 04:59
@Pratham-Mishra04 Pratham-Mishra04 merged commit 811bd8c into main Mar 13, 2026
8 of 10 checks passed
@Pratham-Mishra04 Pratham-Mishra04 deleted the 03-12-fix_minor_fixes branch March 13, 2026 05:02
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.

3 participants