Skip to content

build fix - #4583

Merged
akshaydeo merged 1 commit into
devfrom
06-21-build_fix
Jun 21, 2026
Merged

build fix#4583
akshaydeo merged 1 commit into
devfrom
06-21-build_fix

Conversation

@akshaydeo

Copy link
Copy Markdown
Contributor

Summary

Briefly explain the purpose of this PR and the problem it solves.

Changes

  • What was changed and why
  • Any notable design decisions or trade-offs

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

Describe the steps to validate this change. Include commands and expected outcomes.

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

# UI
cd ui
pnpm i || npm i
pnpm test || npm test
pnpm build || npm run build

If adding new configs or environment variables, document them here.

Screenshots/Recordings

If UI changes, add before/after screenshots or short clips.

Breaking changes

  • Yes
  • No

If yes, describe impact and migration instructions.

Related issues

Link related issues and discussions. Example: Closes #123

Security considerations

Note any security implications (auth, secrets, PII, sandboxing, etc.).

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

@coderabbitai

coderabbitai Bot commented Jun 21, 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: 4b8d7846-b1c5-4a0f-af57-3c987c79b063

📥 Commits

Reviewing files that changed from the base of the PR and between ca190fc and 41b6ffc.

📒 Files selected for processing (2)
  • transports/bifrost-http/handlers/list_models_vk.go
  • transports/bifrost-http/handlers/list_models_vk_test.go

📝 Walkthrough

Summary by CodeRabbit

  • Bug Fixes
    • Fixed virtual key status evaluation to correctly handle both explicitly disabled and uninitialized states, ensuring consistent behavior in model list operations.

Walkthrough

The applyListModelsVirtualKeyProviderFilter condition is updated to treat IsActive as inactive when it is nil in addition to when it is explicitly false. Two unit tests are updated to initialize the IsActive field as a *bool pointer (new(true) / new(false)) instead of bool literals.

Changes

Virtual Key IsActive nil-check fix

Layer / File(s) Summary
IsActive nil-check fix and test updates
transports/bifrost-http/handlers/list_models_vk.go, transports/bifrost-http/handlers/list_models_vk_test.go
The filter condition ORs vk.IsActive == nil with the existing false check so that an unset IsActive pointer triggers the default provider fan-out. Test fixtures change IsActive from bool literals to *bool pointer values to match the updated field type.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Possibly related PRs

  • maximhq/bifrost#3187: Overlaps with the same list_models_vk.go virtual-key provider filtering logic and inactive-VK test coverage.
  • maximhq/bifrost#3796: Introduced the virtual-key-driven provider fan-out filtering that this PR refines with the nil IsActive handling.
  • maximhq/bifrost#4074: Touches the same active/inactive VK scoping behavior for /v1/models in the governance pre-hook.

Suggested reviewers

  • danpiths
  • roroghost17

Poem

🐇 A pointer to nil once slipped through the gate,
Pretending it's active — oh, what a mistake!
Now nil means inactive, as clearly it should,
The fan-out restored to the path that it could.
Hop hop, little bug, you're fixed with one line! 🌿

✨ 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-21-build_fix

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.

@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
Contributor Author

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

@akshaydeo
akshaydeo marked this pull request as ready for review June 21, 2026 12:04

akshaydeo commented Jun 21, 2026

Copy link
Copy Markdown
Contributor Author

Merge activity

  • Jun 21, 12:04 PM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Jun 21, 12:04 PM UTC: @akshaydeo merged this pull request with Graphite.

@akshaydeo
akshaydeo merged commit a39c598 into dev Jun 21, 2026
14 of 16 checks passed
@akshaydeo
akshaydeo deleted the 06-21-build_fix branch June 21, 2026 12:04
@coderabbitai
coderabbitai Bot requested review from danpiths and roroghost17 June 21, 2026 12:05
@greptile-apps

greptile-apps Bot commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

Confidence Score: 3/5

The handler change introduces a logic inversion for the common DB-default case of nil IsActive, meaning provider filtering is silently skipped for the majority of active virtual keys.

The nil-guard added to handle the *bool field has the wrong effect: nil IsActive means the key is active (per the DB default and the existing IsActiveValue() helper), but the new clause treats nil as inactive and bypasses ProviderConfigs filtering. This would expose all providers to any VK that was created without an explicit IsActive value, defeating the purpose of the filter.

transports/bifrost-http/handlers/list_models_vk.go — the IsActive nil-check condition needs to be corrected before merging.

Important Files Changed

Filename Overview
transports/bifrost-http/handlers/list_models_vk.go Adapts IsActive field from bool to *bool — the nil-guard added to the condition has backwards semantics: nil means active per the DB schema, but the new clause causes provider-filtering to be skipped for any VK with nil IsActive.
transports/bifrost-http/handlers/list_models_vk_test.go Test fixtures updated from bool literals to pointer values via new(true)/new(false) — correct Go syntax, but the nil-IsActive case (DB default active) is not covered.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Request with VK header] --> B{VK header present?}
    B -- No --> C[return true, no filter]
    B -- Yes --> D{ConfigStore available?}
    D -- No --> E[return false, 503]
    D -- Yes --> F{GetVirtualKeyByValue}
    F -- ErrNotFound --> C
    F -- other error --> G[return false, 500]
    F -- found --> H{vk == nil?}
    H -- Yes --> C
    H -- No --> I{vk.IsActive == nil?}
    I -- Yes --> C["❌ BUG: return true (nil = active, should filter)"]
    I -- No --> J{"!*vk.IsActive?"}
    J -- true inactive --> C
    J -- false active --> K[Set AvailableProviders in BifrostContext]
    K --> L[return true]
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"}}}%%
flowchart TD
    A[Request with VK header] --> B{VK header present?}
    B -- No --> C[return true, no filter]
    B -- Yes --> D{ConfigStore available?}
    D -- No --> E[return false, 503]
    D -- Yes --> F{GetVirtualKeyByValue}
    F -- ErrNotFound --> C
    F -- other error --> G[return false, 500]
    F -- found --> H{vk == nil?}
    H -- Yes --> C
    H -- No --> I{vk.IsActive == nil?}
    I -- Yes --> C["❌ BUG: return true (nil = active, should filter)"]
    I -- No --> J{"!*vk.IsActive?"}
    J -- true inactive --> C
    J -- false active --> K[Set AvailableProviders in BifrostContext]
    K --> L[return true]
Loading

Comments Outside Diff (1)

  1. transports/bifrost-http/handlers/list_models_vk_test.go, line 123-146 (link)

    P2 Missing test case for IsActive == nil (DB default)

    No test covers the case where IsActive is nil, which is the DB default meaning "active". Given that the bug fixed in list_models_vk.go hinges on this exact nil semantics, a test like TestApplyListModelsVirtualKeyProviderFilterSetsActiveVKProviders but with IsActive: nil should be added to prevent future regressions of this specific path.

    Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Reviews (1): Last reviewed commit: "build fix" | Re-trigger Greptile

Comment on lines +42 to 44
if vk == nil || vk.IsActive == nil || !*vk.IsActive {
return true
}

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.

P1 nil IsActive incorrectly bypasses provider filter

TableVirtualKey.IsActive is documented as "Nil means true (DB default); false means inactive" (see virtualkey.go:213 and the IsActiveValue() helper at line 247). When vk.IsActive == nil the VK is semantically active, but the new vk.IsActive == nil clause causes an early return true, silently skipping the ProviderConfigs filter. Any VK that was inserted with the DB default (nil IsActive) will expose all configured providers instead of only the ones in its ProviderConfigs.

The existing IsActiveValue() method already encodes the correct nil-as-true semantics. The condition should be if vk == nil || !vk.IsActiveValue() instead.

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.

Files API Support

2 participants