Skip to content

fix: make upstream and model routing switches authoritative - #3

Merged
kingfs merged 3 commits into
mainfrom
clean/codes
Sep 14, 2026
Merged

kingfs merged 3 commits into
mainfrom
clean/codes

Conversation

@kingfs

@kingfs kingfs commented Sep 14, 2026

Copy link
Copy Markdown
Owner

Description

Linked Issues

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactoring

Verification Performed

Screenshots (if applicable)

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Bring PR #3 (fix: make upstream and model routing switches authoritative) up to
date with main and resolve the merge so main can fast-forward onto this branch.

Resolution notes:
- router: keep the PR guards (skip disabledModels, honour configuredModelsOnly)
  on top of main's supportsPath(target, rawPath, features) signature.
- monitor: drop the configuration wrapper for POST /api/router/reload, which
  main removed as dead code along with its handler.
- tests: keep main's expectations where the PR was stale (ResponsesServerConfig
  .Enabled, create-provider gating and help copy) while keeping the PR's new
  coverage: bootstrap keeps disabled/deleted channels, probe defaults to
  disabled, a disabled provider keeps model choices, provider toggle failure
  stays visible.
- ui: rebuild internal/monitor/ui/dist from the merged source and drop the PR's
  stale bundle assets.
Follow-up hardening on top of the routing-switch work:

- store: every Store view of one database now shares one state block, so a
  configuration transaction no longer runs with a fresh event sequence and an
  empty live subscriber set.
- store: rebindingDB.Begin/BeginTx fail with ErrNestedTransaction instead of
  silently borrowing a pooled connection, and a nested ConfigurationTransaction
  is rejected before it can deadlock on the configuration lock.
- store: add the upstream write lock. ConfigurationTransaction holds it for the
  whole transaction, while background/proxy refresh takes it on a best-effort
  basis and filters results against the live target set, so a refresh that raced
  a configuration change can no longer write rows for a deleted target.
- router: commit the database transaction before publishing the new snapshot and
  outside router.mu, so request routing is not blocked for the duration of the
  commit.
- channel: WithHTTPClient and WithReadOnly now return a derived service like
  WithStore, and an already initialized startup no longer rewrites the bootstrap
  marker.
- monitor: add GET/DELETE /api/settings/channels to report and clear the
  channels.initialized marker through the configuration transaction.
- docs: document the channels.initialized key and reset path plus the
  transaction/lock ordering invariants.

Tests: new store, router, channel and monitor coverage for each fix.
@kingfs
kingfs merged commit c137c26 into main Sep 14, 2026
2 checks passed
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.

1 participant