Skip to content

consolidation: merge 6 LLM gateway auto-router PRs (#8739 #8758 #8740 #8744 #8746 #8748) - #10089

Closed
undivisible wants to merge 8 commits into
mainfrom
consolidation/auto-router
Closed

undivisible wants to merge 8 commits into
mainfrom
consolidation/auto-router

Conversation

@undivisible

@undivisible undivisible commented Jul 20, 2026 •

Copy link
Copy Markdown
Collaborator

Consolidates 6 LLM gateway auto-router PRs (#8739 #8758 #8740 #8744 #8746 #8748).

Changes

  • Unified auto-router with lane catalog, serving config, route artifacts, config reload, benchmark scoring/proposal tooling, config reload, capability smoke checks, and shadow cutover metrics.
  • Removes stale planning files and non-production serving placeholders.
  • Keeps only prod_ready catalog lanes eligible for serving.
  • Cataloged public-shared-conversation-chat as prod_ready (was served but uncatalogued — now fails closed).

Failure-Class: FC-client-model-outside-proxy-allowlist


Note

High Risk
Touches core LLM gateway config loading, readiness, and which auto-lanes can serve in production; mis-catalogued or reload bugs could block traffic or serve wrong routes.

Overview
This consolidation lands the LLM gateway auto-router stack in one pass: catalog-driven serving, runtime config refresh, and offline benchmark/smoke tooling, with CI policy aligned to safer desktop stable promotion.

Lane catalog and serving config — Adds lanes_catalog.yaml and lane_catalog.py so lanes are planned / dev_only / prod_ready. Only prod_ready lanes may appear in lanes.yaml / route artifacts; startup cross-checks enforce that. The resolver allowlist is derived from the catalog (e.g. chat-structured, public-shared-conversation-chat); placeholders and dev-only lanes stay catalog-only. load_gateway_config filters generated routes by catalog, merges explicit YAML over generated entries, and can require allowlisted lane IDs. Evidence gains an optional placeholder flag for promotion logic without changing prod eligibility.

Runtime config — Replaces cached sync config with GatewayConfigReloader (mtime watch + TTL cache + stale fallback). get_gateway_config is async; /ready awaits it. Prod mode defaults to on unless OMI_LLM_GATEWAY_PROD opts into dev.

Offline auto-router path — Adds _private scoring and BenchmarksFetcher (AA API with example fallback), sync_benchmarks_to_route_artifacts.py (writes route_artifacts.proposed.yaml only), capability_smoke.py with FakeProvider, and DailyRefreshCache for shared refresh semantics.

Shadow / dual-path (R3.1) — Unit tests and fakes for shadow cutover and divergence metrics (parallel control vs gateway, LKG on gateway failure).

CI — Desktop stable promotion policy script expects bearer auth and blocks reintroduced manual operator inputs. Backend dev deploy skips GitHub compare supersession when GH_TOKEN is unset so hermetic tests can run.

Reviewed by Cursor Bugbot for commit ba423a3. Bugbot is set up for automated code reviews on this repo. Configure here.

@Git-on-my-level Git-on-my-level left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for consolidating these router branches. I’m going to request changes because the current head appears to violate the core catalog/serving split that this PR documents.

Blocking issues:

  1. lanes_catalog.yaml marks only omi:auto:chat-structured as prod_ready; the other 12 lanes are dev_only and 3 are planned. But backend/llm_gateway/config/lanes.yaml still contains 17 serving lanes, including catalog-only entries like omi:auto:chat-extraction, omi:auto:daily-summary, omi:auto:stt-realtime, omi:auto:transcription, and omi:auto:screenshot-embedding. That means the serving config still exposes lanes the catalog says should not be serving.

  2. route_artifacts.yaml still includes route artifacts for the planned placeholder lanes, with evidence.placeholder: true on stt-realtime, transcription, and screenshot-embedding. This directly conflicts with the documented invariant here: “No prod-loadable placeholder route artifacts.”

  3. validate_serving_config() does not currently enforce “every serving lane must be in the catalog with prod_ready status.” The implementation only enforces the promotion direction (prod_ready catalog lane has a serving lane/artifact) and explicitly allows serving lanes that are cataloged as dev_only/planned. That lets this inconsistent config pass instead of failing closed.

  4. The PR also adds several .aidlc/* planning/review/state documents. These are agent-behavior / agent-instruction-adjacent artifacts: future coding or review agents may read them as project intent and workflow guidance. The guidance is directionally useful, but right now it is internally inconsistent with the actual checked-in config (for example, the docs say catalog-only lanes should not be in serving config, while the config includes them). Please either remove these ephemeral agent planning artifacts from the PR or make sure they accurately reflect the final maintained architecture. Human maintainer review is warranted before landing this documentation because it can shape future AI coding/review behavior in the repo.

I did not see evidence of a malicious or supply-chain attempt. The concern is correctness/safety around model-routing configuration and agent-facing documentation.

Suggested path:

  • Either trim lanes.yaml and route_artifacts.yaml so serving contains only truly prod_ready lanes/artifacts, or change the catalog/status model and docs if these lanes are intentionally serveable now.
  • Tighten validate_serving_config() so catalog entries marked dev_only/planned cannot appear in serving config unless there is a deliberately named, reviewed exception path.
  • Add regression tests covering dev_only/planned catalog lanes present in lanes.yaml and placeholder artifacts present in route_artifacts.yaml.
  • Reconcile or remove the .aidlc docs so future agents do not inherit stale/inaccurate guidance.

by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.

@undivisible
undivisible force-pushed the consolidation/auto-router branch from e0bbe02 to 7740247 Compare July 20, 2026 18:44
@Git-on-my-level

Copy link
Copy Markdown
Member

Updated consolidation follow-up

The earlier catalog/serving problems are largely resolved in the current branch. The remaining merge conditions are narrower:

  • public-shared-conversation-chat serves but is not cataloged. Either catalog it as prod_ready with evidence, or define a deliberately named, reviewed exception that fails closed; do not retain a general uncatalogued-serving allowance.
  • Split the unrelated memory-expiry behavior change into its own tested bug-fix PR.
  • Rebase the resulting focused router change and clear/re-review the stale request.

This remains a keep-and-narrow PR, not a request to close the auto-router work.

@undivisible
undivisible force-pushed the consolidation/auto-router branch 4 times, most recently from 57fb783 to 4b1d77f Compare July 21, 2026 23:43
@undivisible
undivisible force-pushed the consolidation/auto-router branch 4 times, most recently from 4b1d77f to 6faf563 Compare July 22, 2026 03:05
@undivisible

Copy link
Copy Markdown
Collaborator Author

retriggering CI after test fix

@undivisible undivisible reopened this Jul 22, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Hey @undivisible 👋

Thank you so much for taking the time to contribute to Omi! We truly appreciate you putting in the effort to submit this pull request.

After careful review, we've decided not to merge this particular PR. Please don't take this personally — we genuinely try to merge as many contributions as possible, but sometimes we have to make tough calls based on:

  • Project standards — Ensuring consistency across the codebase
  • User needs — Making sure changes align with what our users need
  • Code best practices — Maintaining code quality and maintainability
  • Project direction — Keeping aligned with our product principles and locked invariants

Before your next PR, please skim:

  • PRODUCT.md — product north star
  • Product invariants — locked rules (shared chat, memory tiers, agent control plane, integrations, brand)

If this was declined for direction or taste, maintainers should cite an invariant ID or open a proposed one — ask if that citation is missing.

Your contribution is still valuable to us, and we'd love to see you contribute again in the future! If you'd like feedback on how to improve this PR or want to discuss alternative approaches, please don't hesitate to reach out.

Thank you for being part of the Omi community!

@skanderkaroui skanderkaroui 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.

The safety gate that keeps unapproved models out of production works, but it quietly does nothing if a config file is missing and reads a file at startup in a way the backend rules forbid — so hold off on auto-merging given how much this touches. Also, the description claims a memory-expiry fix that isn't actually in the code — please drop or correct it.

@undivisible
undivisible force-pushed the consolidation/auto-router branch from a14901d to c684fe2 Compare July 29, 2026 04:53
@cursor

cursor Bot commented Jul 29, 2026

Copy link
Copy Markdown

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

@Git-on-my-level

Copy link
Copy Markdown
Member

Review: LLM Gateway Auto-Router Consolidation

❌ REQUEST CHANGES — 5 Blocking Issues

1. Merge State: DIRTY

PR has conflicts with main (mergeStateStatus: DIRTY). Must rebase before any further review.

2. CI Never Ran

Only 2 trivial checks executed (comment-on-declined-pr, Mintlify). Zero build, zero test, zero lint CI. For a +6631-line consolidation of 6 PRs, this is a hard blocker.

3. False Claims in Description

PR description claims "clamps required-memory expiry after capture time to preserve memory-tier contract" — but that code was added in one commit then removed in another. Net diff contains zero memory-expiry code. Description must match reality.

4. Fail-Open Gap in validate_serving_config()

Lanes NOT in the catalog at all are silently allowed through (explicitly asserted by test as correct behavior). This undermines the safety gate. Should fail closed for unknown lanes.

5. Import-Time File Read

resolver.py calls load_catalog() at module import time, violating backend startup rules (flagged by prior reviewer).

Path Forward

Rebase on main, fix the fail-open gap, resolve import-time side-effect, correct description, trigger full CI. The underlying auto-router work is valuable — this is fixable.

@undivisible
undivisible force-pushed the consolidation/auto-router branch from c684fe2 to fc20b6b Compare July 29, 2026 04:56

@Git-on-my-level Git-on-my-level left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for continuing to narrow this consolidation. I re-reviewed current head fc20b6b5d9718211c214c9af5811abe82a945e3c. CI is now green and the earlier broad catalog placeholders/dev-only serving-lane issues look mostly resolved, so this is not a close/split request. I would still keep changes requested on the current head for a few focused blockers:

  1. The catalog/serving contract still has a fail-open exception. backend/llm_gateway/config/lanes.yaml serves omi:auto:public-shared-conversation-chat, but backend/llm_gateway/config/lanes_catalog.yaml does not catalog that lane as prod_ready or catalog it at all. validate_serving_config() also only rejects catalogued non-prod lanes; uncatalogued serving lanes are allowed. Since the PR docs say serving config is a subset of the catalog and only prod_ready lanes serve, please either catalog this lane as prod_ready with evidence or add a deliberately named, reviewed exception path that fails closed for arbitrary unknown lanes.

  2. backend/llm_gateway/gateway/resolver.py still loads the catalog at import time to build SUPPORTED_AUTO_LANE_IDS, then falls back to an empty allowlist if that read/parsing fails. That keeps a startup/import side effect in a sensitive request-path module and can silently make the allowlist empty in production-like execution. Please move this behind the config loading/reload path or otherwise make failures explicit instead of import-time fail-open/fail-empty behavior.

  3. The PR description still claims “Clamps required-memory expiry after capture time…” and lists INV-MEM-1, but the current net diff does not include the memory-expiry change. Please correct the description so maintainers are not reviewing a stale/unrelated invariant claim.

No malicious or supply-chain behavior stood out in this pass. Because this is still a large model-routing/workflow-sensitive PR, it should continue to carry human maintainer review before merge even after these focused blockers are resolved.


by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.

@undivisible
undivisible force-pushed the consolidation/auto-router branch 2 times, most recently from 17fa459 to 42471f1 Compare July 29, 2026 21:21

@Git-on-my-level Git-on-my-level left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for continuing to narrow this consolidation. I’m keeping changes requested on the current head, but the remaining blockers look concrete and fixable:

  1. Current CI is not green. Formatting fails because backend/llm_gateway/gateway/resolver.py would be reformatted by black, and Backend unit suite fails in pyright because resolver.py uses LaneCatalog in annotations without importing it.
  2. The catalog follow-up for public-shared-conversation-chat still needs its tests/schema expectations reconciled. The PR now adds it as prod_ready, but backend/tests/unit/llm/test_lane_catalog.py still asserts the old catalog size/prod-ready counts and only permits openai.chat_completions/unknown surfaces while the new catalog entry uses surface: chat.
  3. The PR body still lists INV-MEM-1, but the current net diff does not include the memory-expiry change. Please remove that stale invariant claim so maintainers are reviewing the actual scope.

No malicious or supply-chain behavior stood out in this pass. Because this still changes model-routing and workflow-sensitive surfaces, it should keep human maintainer review before merge after the CI/test issues are fixed.


by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.

@Git-on-my-level Git-on-my-level left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for the fixes on the latest head — the previous CI/test-count issues look resolved. I’m keeping changes requested because one core safety blocker is still present:

  1. validate_serving_config() still allows uncatalogued serving lanes. The function docstring says every serving lane must be in the catalog with prod_ready status, but the implementation only rejects lanes that are catalogued as non-prod and lets catalog.get(lane_id) is None pass. The new regression test also pins that behavior as allowed (test_serving_lane_not_in_catalog_is_allowed). For this gateway, an arbitrary omi:auto:* lane entering serving config without catalog review is the fail-open case the catalog split is meant to prevent. Please make unknown serving lanes fail closed, then update the test to assert rejection.
  2. The PR body still lists INV-MEM-1, but the current net diff does not include the memory-expiry behavior. Please remove that stale invariant claim so maintainers are reviewing the actual router/workflow scope.

No malicious or supply-chain behavior stood out in this pass. Because this still changes model-routing and workflow-sensitive surfaces, it should keep the existing human-maintainer/security/workflow review labels even after the code blocker is fixed.


by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.

@Git-on-my-level Git-on-my-level left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for the latest fixes — the previous uncatalogued-serving and stale PR-body blockers look resolved on this head. I’m still requesting changes because the current CI failures are exposing a real gateway regression, not just a harness issue:

  1. Backend unit tests are failing because generated model_config lanes/routes are now filtered down to catalog prod_ready entries. That removes routes existing non-auto surfaces still use, for example omi:auto:chat-agent and route.session_titles.model_config.001. The failures show this directly: test_llm_gateway_anthropic_passthrough.py gets 404s for /v1/messages, test_capability_smoke.py hits KeyError: 'omi:auto:chat-agent', and test_llm_gateway_output_budget.py hits KeyError: 'route.session_titles.model_config.001'. The catalog split should fail closed for the LLM-gateway auto-router serving set, but it should not accidentally delete existing generated model-config routes that the Anthropic passthrough/session-title paths still depend on unless those surfaces are deliberately migrated and tested.
  2. The Formatting check is still red: CI reports backend/llm_gateway/gateway/config_loader.py would be reformatted by black.
  3. Desktop Swift CI is also red. That may be unrelated to the router diff, but it still needs a clean rerun or a maintainer-accepted explanation before merge.

No malicious or supply-chain behavior stood out in this pass. Since this continues to touch model routing and workflow-sensitive surfaces, please keep the human-maintainer/security/workflow review labels until the gateway regression and CI are cleared.


by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.

passed=False,
latency_ms=latency_ms,
failure_reason=f"auth error: {e}",
)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Duplicate auth exception classes

Low Severity

Capability smoke catches ProviderAuthError from its own module, but the default FakeProvider raises a homonymous exception from deterministic_provider. Auth-failure scenarios are handled as generic exceptions, so smoke JSON mislabels auth failures.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 9f15522. Configure here.

@undivisible
undivisible force-pushed the consolidation/auto-router branch from 9f15522 to 0e4b452 Compare July 31, 2026 03:10

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

There are 2 total unresolved issues (including 1 from previous review).

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 0415c31. Configure here.


_logging.getLogger(__name__).warning("lane catalog not loaded: %s", _exc)
_catalog = None
return _catalog

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Stale catalog breaks hot reload

Medium Severity

The resolver keeps the first-loaded lanes_catalog.yaml in a module-level cache forever, while GatewayConfigReloader reloads the catalog from disk on each mtime change. Reload passes required_lane_ids=get_supported_auto_lane_ids(), so demoted lanes can still be required after serving config is updated, causing ConfigValidationError and stale config until restart.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 0415c31. Configure here.

Consolidates #8739 #8758 #8740 #8744 #8746 #8748.

- Unified auto-router with lane catalog, serving config, route artifacts
- Config reload, benchmark scoring, capability smoke checks
- Lazy-loading lane catalog (no import-time I/O in request-path modules)
- Cataloged public-shared-conversation-chat as prod_ready

Failure-Class: none
Reconcile catalog and smoke tests with the catalog-derived allowlist, and import LaneCatalog for pyright.

Failure-Class: none
Failure-Class: FC-client-model-outside-proxy-allowlist
Failure-Class: FC-client-model-outside-proxy-allowlist
@undivisible
undivisible force-pushed the consolidation/auto-router branch from 0415c31 to ba423a3 Compare July 31, 2026 04:07
@undivisible undivisible added the backend Backend Task (python) label Jul 31, 2026

@Git-on-my-level Git-on-my-level left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for the quick CI cleanup. I’m still requesting changes because the current head appears to preserve the gateway-routing regression by changing the tests around it rather than keeping the production route available.

The default production gateway config now only loads two lanes (omi:auto:chat-structured and omi:auto:public-shared-conversation-chat). It no longer includes the generated omi:auto:chat-agent lane / route.chat_agent.model_config.001, even though the backend gateway Anthropic client still unconditionally sends chat-agent traffic to CHAT_AGENT_AUTO_LANE_ID (utils/llm/gateway_anthropic.py). With the default app config, /v1/messages for omi:auto:chat-agent returns 404 (auto lane not found: omi:auto:chat-agent). The updated Anthropic passthrough tests hide this by overriding get_gateway_config() and manually injecting a synthetic chat-agent lane, so they no longer prove the production/default config still serves the route.

This is the same model-routing safety concern in narrower form: the catalog split should fail closed for the new auto-router serving set, but it should not silently remove an existing gateway-served Anthropic/chat-agent path unless that migration is intentional, documented, and covered by production-default tests. Please either keep the generated model-config route(s) required by existing call sites available outside the auto-router catalog gate, or make the intentional removal explicit and update the call sites/rollout plan accordingly.

I verified on this head that the focused backend tests now pass, and I did not see malicious or supply-chain behavior. Because this still touches model routing and workflow-sensitive surfaces, the existing human-maintainer/security/workflow review labels should stay until a maintainer signs off.


by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.

@undivisible

Copy link
Copy Markdown
Collaborator Author

Superseded by #10934.

@github-actions

Copy link
Copy Markdown
Contributor

Hey @undivisible 👋

Thank you so much for taking the time to contribute to Omi! We truly appreciate you putting in the effort to submit this pull request.

After careful review, we've decided not to merge this particular PR. Please don't take this personally — we genuinely try to merge as many contributions as possible, but sometimes we have to make tough calls based on:

  • Project standards — Ensuring consistency across the codebase
  • User needs — Making sure changes align with what our users need
  • Code best practices — Maintaining code quality and maintainability
  • Project direction — Keeping aligned with our product principles and locked invariants

Before your next PR, please skim:

  • PRODUCT.md — product north star
  • Product invariants — locked rules (shared chat, memory tiers, agent control plane, integrations, brand)

If this was declined for direction or taste, maintainers should cite an invariant ID or open a proposed one — ask if that citation is missing.

Your contribution is still valuable to us, and we'd love to see you contribute again in the future! If you'd like feedback on how to improve this PR or want to discuss alternative approaches, please don't hesitate to reach out.

Thank you for being part of the Omi community!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend Backend Task (python) needs-maintainer-review Needs a human maintainer to sign off before merge security-review Touches auth, provider routing, secrets, or security-sensitive surfaces workflow-review Needs maintainer review for workflow, automation, hooks, or CI behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants