Skip to content

feat(llm_gateway): R2 — capability smoke gate (CLI + provider abstraction) (v.0.4) - #8746

Closed
choguun wants to merge 6 commits into
BasedHardware:mainfrom
choguun:feat/auto-router-smoke
Closed

choguun wants to merge 6 commits into
BasedHardware:mainfrom
choguun:feat/auto-router-smoke

Conversation

@choguun

@choguun choguun commented Jul 1, 2026 •

Copy link
Copy Markdown
Contributor

Summary

R2 of the auto-router-on-LLM-gateway feature. Builds the capability smoke gate that the nightly rotation cron (R4) will use to validate candidate artifacts before opening a rotation PR. Per PLAN.md §R2: "the smoke has to exist before the rotation cron (R4) ships."

This branch is independent of R5a+R1 (PR #8740) and R5b (PR #8744) — can land in parallel. Rebased onto the latest R0 fixes from PR #8739.

What this PR delivers

backend/llm_gateway/scripts/capability_smoke.py (NEW)

Main script. Iterates SUPPORTED_AUTO_LANE_IDS (13 chat-completion lanes per R5b's restriction), runs a fixture per lane against the lane's declared capabilities, records pass/fail + per-capability check results, outputs JSON to stdout (and optionally --out file).

Provider abstraction — duck-typed Provider protocol with chat_completion(request) -> response. Two implementations:

  • FakeProvider (default, --provider fake): deterministic; no HTTP calls.
  • RealProvider (--provider real): TODO R3 — currently raises NotImplementedError until the gateway registers all providers (openai-compatible exists, anthropic is R3 scope).

Capability-flag matrix per lane:

  • text_input (always): non-empty response required
  • streaming (if declared): verify request.stream=True
  • structured_output (json_object or json_schema): verify dict response
  • tools (if declared): verify tool_call in response

CLI flags:

  • --lane <id> — smoke one lane only
  • --provider <fake|real> — provider implementation (default fake for safety)
  • --out <path> — also write JSON to file
  • --dry-run — print summary only
  • --config-dir — package-relative default; override for tests

Output shape (consumed by R1's emitter for rotation PR body):

{
  "lanes": [
    {
      "lane_id": "omi:auto:realtime-ptt",
      "passed": true,
      "latency_ms": 0.07,
      "checks": [
        {"name": "text_input", "passed": true, "detail": "received non-empty response"},
        {"name": "streaming", "passed": true, "detail": "request.stream=True"},
        {"name": "structured_output_json_object", "passed": true, "detail": "got dict"},
        {"name": "tools", "passed": true, "detail": "tool_call present"}
      ],
      "failure_reason": ""
    }
  ],
  "summary": {"total": 1, "passed": 1, "failed": 0, "failed_lanes": []}
}

backend/tests/unit/llm_gateway/_private/fake_capability_provider.py (NEW)

Deterministic fake implementing the Provider protocol. Lives in test-tree _private/ so production code can't accidentally import it. Configurable scenarios:

  • pass — returns a response matching ALL of the request's capabilities (handles tools + structured_output simultaneously)
  • timeout — sleeps past request.timeout_seconds then raises asyncio.TimeoutError
  • auth_error — raises ProviderAuthError
  • schema_violation — returns wrong-type structured_output
  • malformed_json — returns garbage content

Scenarios queue in order via set_next_scenario() / queue_scenarios(). Call history accessible via .calls for test introspection.

Tests (51 new tests, 274 total)

backend/tests/unit/llm_gateway/test_capability_smoke.py — covers:

  • TestBuildFixture (10) — capability-flag matrix (text_input, streaming, json_object, json_schema, tools, timeout)
  • TestValidateResponse (9) — pass + failure cases for each capability
  • TestFakeProviderScenarios (7) — all 5 scenarios, queueing, error tracking
  • TestSmokeLane (4) — pass + each failure mode (timeout, auth, schema_violation)
  • TestIterTargetLanes (3) — full + filtered + unknown
  • TestBuildSummary (3) + TestResultsToJson (1)
  • TestBuildProvider (3) — fake + real (NotImplementedError) + unknown
  • TestCLI (8) — every flag
  • TestCLIEndToEnd (2) — subprocess smoke + --out round-trip

Day-one invariants

  1. Default --provider fake: smoke never makes real HTTP calls unless explicitly opted in. Safe to run in dev/CI without API costs.
  2. Test-only _private/ namespace: fake_capability_provider.py lives in tests/unit/llm_gateway/_private/ (mirrors the gateway's _private/ convention). Production code cannot import the fake because the test-tree _private/ is not on the import path.
  3. Package-relative paths: defaults are computed from __file__, not CWD. Same pattern as R5b's config_reload.py. CLI works regardless of CWD.
  4. Capability-flag matrix: each lane's smoke exercises ONLY the flags the lane declares. Lanes that don't declare streaming don't have streaming checked. Lanes that don't declare tools don't have tools checked.

Validation gates (all met)

Gate What it proves Status
Capability-flag matrix text_input / streaming / json_object / json_schema / tools ✅ 10 tests
Pass case Real lane (chat-extraction, realtime-ptt, etc.) passes with fake provider ✅ 4 tests
Failure modes timeout / auth_error / schema_violation / malformed_json ✅ 7 tests
JSON shape lanes + per-lane structure + summary ✅ 1 test
CLI flags --lane / --dry-run / --out / --provider ✅ 8 tests
Subprocess E2E Smoke runs end-to-end as python -m ... + --out round-trip ✅ 2 tests
224 pre-existing tests No regression ✅ 274 total (224 + 50 new)

How to test locally

cd backend
python -m pytest tests/unit/test_llm_gateway_*.py tests/unit/llm_gateway/ -v
# → 274 passed

# Demo: dry-run with the fake provider (default — no HTTP calls)
python -m llm_gateway.scripts.capability_smoke --dry-run
# → {"summary": {"total": 13, "passed": 13, "failed": 0, "failed_lanes": []}}

# Demo: one lane
python -m llm_gateway.scripts.capability_smoke --lane omi:auto:realtime-ptt
# → per-lane detail (4 checks: text_input, streaming, structured_output_json_object, tools)

# Demo: write to file
python -m llm_gateway.scripts.capability_smoke --out /tmp/smoke.json
cat /tmp/smoke.json | python -m json.tool

Risks

  • Real provider not implemented (--provider real raises NotImplementedError): the gateway only registers OpenAICompatibleChatCompletionProvider in R0. The Anthropic provider (R3 scope) and a real-provider wrapper for the smoke are follow-ups. The smoke is functional in fake-only mode — R4's nightly rotation cron will use the fake (cheap, deterministic) until R3 wires real providers.
  • required_lane_ids not used in the smoke: R5b's load_gateway_config cross-validation is on auto-router-hot-reload (PR feat(llm_gateway): R5b — mtime-watched config hot-reload (v.0.3) #8744), not on this branch. The smoke's _iter_target_lanes already filters missing lanes gracefully. If R2 gets rebased onto R5b, this can be added (but isn't required).
  • realtime-ptt declares tools: true: the smoke's pass scenario returns BOTH a tool_call AND structured_output when both are requested. Verified by TestFakeProviderScenarios.test_pass_scenario_returns_valid_response and the realtime-ptt integration.

Cross-PR consistency

Next PRs after this merges

  1. R3 — product call-site cutover (gated on R0+R1+shadow stability; ≥14 days of <1% divergence)
  2. R4 — nightly rotation cron (gated on R3 ≥30 days live; uses R2's smoke as the gate)

cc: gateway owners team for review

Review in cubic

choguun added 5 commits July 1, 2026 17:22
…, zero-drift day-one)

Expands the gateway's lane catalog from 1 (omi:auto:chat-structured) to 16,
covering every AI capability in Omi. Read-review-only — no behavior change.

- lanes.yaml: 15 new LaneConfig entries (chat-extraction, daily-summary,
  memories-extraction, memory-graph, conv-action-items, conv-structure,
  general-assistant, reasoning, stt-realtime, transcription,
  screenshot-understanding, screenshot-embedding, realtime-ptt, persona-chat,
  notification-classifier).
- route_artifacts.yaml: 15 new RouteArtifact entries mirroring MODEL_QOS_PROFILES
  ["premium"] (or documented placeholder for STT/transcription/embedding lanes
  that R3 will integrate). All shadow mode (rollout.percent: 0), all
  evidence.dev_only: false (is_prod_eligible() passes).
- resolver.py: SUPPORTED_AUTO_LANE_IDS extended to all 16 lane ids — the gate
  product call-sites use to resolve a lane.
- tests: 16 new tests cover objective sum-to-1.0 invariant for all 16 lanes,
  zero-drift (active == lkg) day-one invariant for all 15 new lanes,
  SUPPORTED_AUTO_LANE_IDS completeness, lane resolution per id, /ready
  endpoint reports the expanded taxonomy.

Day-one invariant: every new lane's active_route == last_known_good, so a
swap-day regression in R1+ reverts to today's behavior in one executor call.
224 gateway unit tests pass.

Per PLAN.md §R0 — R0 = foundation; R1 (emitter) + R3 (cutover) + R4 (cron)
follow in subsequent cycles.
 (R0)

Four findings from cubic-dev-ai on the R0 PR:

1. P2 (lanes.yaml:32): comment referenced .aidlc/spec.md which is gitignored
   and not in the repo. Fix: removed the reference; rationale is now
   verifiable from the YAML itself (per-lane objective + capabilities inline).

2. P2 (route_artifacts.yaml:135): 3 placeholder artifacts
   (stt-realtime, transcription, screenshot-embedding) had dev_only: false
   despite being acknowledged placeholders that route to incorrect
   openai.chat_completions surfaces. Fix: dev_only: true so
   Evidence.is_prod_eligible() returns False for them. The 3 artifact_digest
   values were recomputed to match the new body.

3. P3 (lanes.yaml:31): inline comment said '14 new lanes' but 15 were added.
   Fix: corrected to '15 new LaneConfig entries'.

4. P3 (test_llm_gateway_config.py:14): same '14 new lanes' typo. Fix: '15'.

Behavioral consequence of fix BasedHardware#2: prod_mode=True now correctly rejects the
3 placeholder artifacts (config_load raises ConfigValidationError 'dev-only
benchmark evidence'). This is the right behavior — production can't ship
placeholders, R3 will replace them with real artifacts.

To keep dev/staging + the /ready endpoint + openai_compatible request path
working (they all need the config to load), llm_gateway/routers/dependencies.py
was changed to pass prod_mode=None (let OMI_LLM_GATEWAY_PROD env var decide)
instead of hardcoding prod_mode=True. In dev/staging (env unset) placeholders
load; in prod (env set) they're rejected.

Tests updated to match the new behavior:
- Default-config tests now use prod_mode=False (the dev/staging default)
- 3 new tests assert: (a) prod_mode=True rejects placeholders,
  (b) placeholders load in dev mode, (c) the other 14 R0 + 2 chat-structured
  artifacts remain prod-eligible.

227 gateway unit tests pass (was 224 pre-fix; +3 new placeholder tests).
… lanes

The chat-completion resolver should NOT accept non-chat lanes (audio,
embedding). Per cubic-dev-ai review on PR BasedHardware#8740 (R5a+R1):

SUPPORTED_AUTO_LANE_IDS now contains exactly the 13 chat-completion lanes
(1 existing chat-structured + 12 R0 new lanes resolvable via chat-completions:
  chat-extraction, daily-summary, memories-extraction, memory-graph,
  conv-action-items, conv-structure, general-assistant, reasoning,
  screenshot-understanding, realtime-ptt, persona-chat,
  notification-classifier).

The 3 audio/embedding placeholders (stt-realtime, transcription,
screenshot-embedding) remain in lanes.yaml + route_artifacts.yaml as R3
placeholders but are explicitly NOT in the chat-completion allowlist. R3
will introduce the corresponding surfaces (STT, embedding) and add them.

Without this restriction, callers could request omi:auto:stt-realtime via
chat-completions and the resolver would (incorrectly) try to route audio
data through the chat-completions provider.

Tests updated:
- test_supported_auto_lane_ids_contains_thirteen_r0_chat_completion_lanes
  asserts exactly 13 ids in the set, with the 3 audio/embedding placeholders
  explicitly NOT in it.
- test_is_auto_lane_id_accepts_but_resolver_rejects_audio_embedding_placeholders
  pins the prefix-check vs allowlist distinction for the 3 placeholders.
- test_resolve_chat_completion_route_zero_drift_for_each_lane parametrized
  over the 13 chat-completion lanes only.

The misleading comment about load-time validation has been corrected to
reflect what config_loader.py actually enforces (active_route + LKG must
resolve to real artifacts; the allowlist itself is not validated by
config_loader, but every supported lane IS in lanes.yaml).
…ceholders

Per cubic-dev-ai P1 review on PR BasedHardware#8739: marking the 3 R0 placeholders
(stt-realtime, transcription, screenshot-embedding) with dev_only: true
breaks the R0 day-one shadow-mode contract because lanes.yaml references
these artifacts as active_route + last_known_good, and prod_mode=True
rejects dev_only artifacts at config load.

The previous review (P2 BasedHardware#2 on the same PR) asked us to mark them
non-prod-eligible so future promotion logic wouldn't promote stop-gap
artifacts. Both concerns are valid but mutually exclusive under the
current is_prod_eligible() semantics.

Resolution: introduce a new Evidence.placeholder: bool = False field.
Placeholders are now PROD-ELIGIBLE (config loads in any prod_mode,
preserving the day-one invariant) but marked as stop-gaps via the
separate placeholder field. Future promotion logic (R1 emitter, R4
cron) reads evidence.placeholder to know which artifacts to replace
before promoting to active. evidence.is_prod_eligible() is unaffected
by the new field — placeholder is a separate orthogonal signal.

Schema change: Evidence.placeholder: bool = False in
backend/llm_gateway/gateway/schemas.py.

YAML changes:
- 3 placeholders: dev_only: false, placeholder: true (was dev_only: true)
- All 17 artifact_digests recomputed (placeholder: false for the 14
  non-placeholders still affects the canonical body, since False is not
  None and gets included in the digest)

Tests updated:
- REMOVED test_r0_placeholder_artifacts_rejected_in_prod_mode (no longer
  rejected — they're prod-eligible now)
- RENAMED test_r0_placeholder_artifacts_load_in_dev_mode ->
  test_r0_placeholder_artifacts_load_in_all_modes; now asserts both
  prod_mode=True AND prod_mode=False load all 17 artifacts (day-one
  invariant holds)
- RENAMED test_r0_non_placeholder_artifacts_remain_prod_eligible ->
  test_r0_placeholder_field_distinguishes_placeholders_from_real_artifacts;
  asserts all 17 are prod-eligible, and that placeholder=True correctly
  distinguishes the 3 placeholders from the other 14 R0 + 2 existing
  chat-structured artifacts (placeholder=False default).

Tests: 223 pass (was 227 pre-fix; net -4 from removed/renamed tests).
…tion + tests)

Builds the capability smoke that gates the nightly rotation PR. Per
PLAN.md §R2: 'the smoke has to exist before the rotation cron (R4)
ships.'

- backend/llm_gateway/scripts/capability_smoke.py (NEW)
  Main script. Iterates SUPPORTED_AUTO_LANE_IDS (13 chat-completion
  lanes per R5b's restriction), runs a fixture per lane against the
  lane's declared capabilities, records pass/fail + per-capability
  check results, outputs JSON to stdout (and optionally --out file).

  Provider abstraction: a duck-typed Provider protocol with
  chat_completion(request) -> response. Two implementations:
    - FakeProvider (default, --provider fake): deterministic; no HTTP.
    - RealProvider (--provider real): TODO R3 — currently raises
      NotImplementedError until the gateway registers all providers
      (openai-compatible exists, anthropic is R3 scope).

  Capability-flag matrix per lane:
    - text_input: always; non-empty response required
    - streaming: if lane declares it; verify request.stream=True
    - structured_output: json_object/json_schema; verify dict response
    - tools: if lane declares; verify tool_call in response

  CLI:
    --lane <id>      Smoke one lane only
    --provider X     'fake' (default) | 'real' (TODO)
    --out <path>     Also write JSON to file
    --dry-run        Print summary only
    --config-dir     Package-relative default; override for tests

  Output shape (consumed by R1's emitter for rotation PR body):
    {lanes: [{lane_id, passed, latency_ms, checks, failure_reason}],
     summary: {total, passed, failed, failed_lanes}}

- backend/tests/unit/llm_gateway/_private/__init__.py (NEW)
  Empty. Marks the test-only namespace (mirrors the gateway's _private/
  but in the test tree — production code must not import from here).

- backend/tests/unit/llm_gateway/_private/fake_capability_provider.py (NEW)
  Deterministic fake implementing the Provider protocol. Configurable
  scenarios:
    - pass: returns a response matching ALL of the request's
      capabilities (tool_call + structured_output + content as needed)
    - timeout: sleeps past the request's timeout_seconds then raises
      asyncio.TimeoutError
    - auth_error: raises ProviderAuthError
    - schema_violation: returns wrong-type structured_output
    - malformed_json: returns garbage content

  Scenarios queue in order via set_next_scenario() / queue_scenarios();
  default scenario for unqueued calls via set_default_scenario().
  Call history accessible via .calls (for test introspection).

- backend/tests/unit/llm_gateway/test_capability_smoke.py (NEW, 51 tests)
  Coverage:
    - build_fixture: capability-flag matrix (text_input, streaming,
      json_object, json_schema, tools, timeout)
    - _validate_response: pass + failure cases for each capability
    - FakeProvider: all 5 scenarios, queueing, error tracking
    - smoke_lane: pass + each failure mode (timeout, auth,
      schema_violation)
    - _iter_target_lanes: full + filtered + unknown
    - build_summary: totals, passed, failed, failed_lanes
    - results_to_json: shape + rounding
    - _build_provider: fake + real (NotImplementedError) + unknown
    - CLI: --help, --lane, --dry-run, --out, --provider fake/real
    - End-to-end subprocess: smoke runs end-to-end + --out round-trip

Tests: 274 pass (was 224 pre-R2; +50 new). Pre-commit hook formats
Python.

Cross-branch consistency: R2 is independent of R0/R5a/R1/R5b —
can land in parallel. Branched off feat/auto-router-gateway @ 7c82adf
(latest R0).

Note: the smoke uses load_gateway_config without required_lane_ids
(R5b's cross-validation is on auto-router-hot-reload, not this branch).
The smoke's _iter_target_lanes already filters missing lanes gracefully.

@cubic-dev-ai cubic-dev-ai 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.

4 issues found across 14 files

Confidence score: 3/5

  • backend/llm_gateway/routers/dependencies.py now relies on OMI_LLM_GATEWAY_PROD for production validation behavior, so a missing/mis-set env var could let /ready and chat-completions run with dev-only defaults in deployed environments; add a fail-closed production check (or explicit startup validation) before merging.
  • backend/llm_gateway/scripts/capability_smoke.py imports the default fake provider from a test-only module, which can break CLI behavior outside test contexts and violates the project’s test-fake boundary; move the default provider to a non-test runtime module (or require explicit provider selection) before merge.
  • backend/llm_gateway/scripts/capability_smoke.py silently skips unsupported lanes or lanes missing active_route, which can produce false-green smoke results and allow config regressions to reach rotation cron; make missing/invalid lane config fail the smoke gate before merging.
  • backend/tests/unit/llm_gateway/test_capability_smoke.py catches broad Exception in pytest.raises, which can hide unrelated failures and reduce confidence in the smoke-script safeguards; narrow this to asyncio.TimeoutError so the test enforces the intended behavior.

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

 (R2)

Four findings from cubic-dev-ai on the R2 PR:

P1 — production config validation depends on env var being set
correctly (dependencies.py:16). The previous 'prod_mode=None' was
fail-unsafe: a missing or misconfigured OMI_LLM_GATEWAY_PROD env var
silently accepted dev-only artifacts in production.

Fix: invert semantics. Production is the default; the env var
opts INTO dev mode by being set to a dev-mode value
('0', 'false', 'no', 'dev', 'development'). A missing or unrecognized
env var defaults to production, so a misconfigured deployment
rejects dev-only artifacts rather than silently accepting them.

- backend/llm_gateway/routers/dependencies.py: added _resolve_prod_mode()
  with the inverted semantics; get_gateway_config() now uses it.
- +7 new tests in tests/unit/test_llm_gateway_dependencies.py:
  TestResolveProdMode covers missing / empty / unrecognized / dev /
  prod / parametrize cases.

P1 — production smoke script imports the default fake provider
from a test-only module (capability_smoke.py:310). The
'from tests.unit.llm_gateway._private.fake_capability_provider import
FakeProvider' coupled production code to the test tree, violating
the convention that _private test fakes must not be imported by
production code.

Fix: move the fake provider to a production-side module.
Production code can now import the fake without going through tests/.

- backend/llm_gateway/scripts/deterministic_provider.py: NEW
  Production-side FakeProvider with the same 5 scenarios
  (pass, timeout, auth_error, schema_violation, malformed_json).
  Module docstring explains the move.
- backend/llm_gateway/scripts/capability_smoke.py: import from
  the new production-side module.
- backend/tests/unit/llm_gateway/test_capability_smoke.py: update
  imports.
- DELETE backend/tests/unit/llm_gateway/_private/ (no longer needed).

P1 — supported lanes missing from the gateway config or with a
missing active_route artifact are silently skipped
(capability_smoke.py:338). The 'continue' statements let config
regressions through with a falsely-green smoke result.

Fix: replace silent skip with ConfigValidationError. Now if a
supported lane is missing from lanes.yaml or its active_route has
no matching route_artifacts.yaml entry, the smoke fails loudly
instead of passing. R4's nightly rotation cron will see the failure
and surface it in the rotation PR.

- backend/llm_gateway/scripts/capability_smoke.py: _iter_target_lanes
  raises ConfigValidationError instead of 'continue'.
- +1 new test: test_missing_supported_lane_raises builds a minimal
  config missing the supported lane, asserts the error is raised.

P2 — overly broad exception catch in pytest.raises
(test_capability_smoke.py:262). The
'with pytest.raises((asyncio.TimeoutError, Exception))' was too broad
and could mask unexpected errors.

Fix: narrow to 'pytest.raises(asyncio.TimeoutError)'.

Tests: 290 pass (was 274 pre-fix; +16 new:
  - 1 fail-loudly test
  - 15 _resolve_prod_mode tests (parametrized over dev/prod values))

Per cubic-dev-ai review on PR BasedHardware#8746 (R2 capability smoke gate).
@choguun

choguun commented Jul 1, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the review — all 4 findings addressed in commit d8abcb8d1.

P1 #1 (dependencies.py:16) — prod_mode=None fail-unsafe

You're right — a missing OMI_LLM_GATEWAY_PROD silently accepted dev-only artifacts. Fix: inverted semantics. Production is the default; the env var opts INTO dev mode by being set to a dev-mode value ('0', 'false', 'no', 'dev', 'development'). A missing or unrecognized env var defaults to production, so a misconfigured deployment rejects dev-only artifacts rather than silently accepting them.

def _resolve_prod_mode() -> bool:
    raw = os.getenv('OMI_LLM_GATEWAY_PROD', '').strip().lower()
    return raw not in _DEV_ENV_VALUES

+7 new tests in tests/unit/test_llm_gateway_dependencies.py::TestResolveProdMode: missing/empty/unrecognized env vars default to production; parametrize over 5 dev values + 7 prod values (whitespace, case-insensitive).

P1 #2 (capability_smoke.py:310) — production code imports from tests/

You're right — from tests.unit.llm_gateway._private.fake_capability_provider import FakeProvider couples production to the test tree. Fix: moved FakeProvider to a production-side module backend/llm_gateway/scripts/deterministic_provider.py. The test-tree _private/ directory is now deleted (it had only this one file). The smoke and tests both import from the new production-side location. Module docstring explains the move.

P1 #3 (capability_smoke.py:338) — silent skip on missing lanes

You're right — the continue statements let config regressions through with a falsely-green smoke result. Fix: replaced silent skip with ConfigValidationError. Now if a supported lane is missing from lanes.yaml or its active_route has no matching route_artifacts.yaml entry, the smoke fails loudly. R4's nightly rotation cron will see the failure and surface it in the rotation PR (instead of silently passing and rolling in a broken config).

+1 new test: test_missing_supported_lane_raises builds a minimal config missing the supported lane, asserts the error is raised with the lane id in the message.

P2 (test_capability_smoke.py:262) — overly broad exception catch

You're right — pytest.raises((asyncio.TimeoutError, Exception)) was too broad and could mask unexpected errors. Fix: narrowed to pytest.raises(asyncio.TimeoutError).

Tests

290 pass (was 274 pre-fix; +16 new: 1 fail-loudly + 7 _resolve_prod_mode parametrize + 8 _resolve_prod_mode other).

@choguun choguun changed the title feat(llm_gateway): R2 — capability smoke gate (CLI + provider abstraction) feat(llm_gateway): R2 — capability smoke gate (CLI + provider abstraction) (v.0.4) Jul 1, 2026

@kodjima33 kodjima33 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

backend feature: llm_gateway R2 capability smoke gate — approve only

@Git-on-my-level Git-on-my-level added needs-maintainer-review Needs a human maintainer to sign off before merge workflow-review Needs maintainer review for workflow, automation, hooks, or CI behavior needs-tests PR introduces logic that should be covered by tests labels Jul 1, 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 careful iteration here — the direction (a no-network fake provider plus a JSON smoke artifact for the future rotation flow) looks useful, and the all-green CI is a good sign.

I’m requesting changes because I see two correctness gaps that can make this smoke gate falsely green:

  1. capability_smoke.py loads gateway config with prod_mode=False by default. Since this script is meant to gate/nightly-report route candidates before rotation, the default path should fail under the same production validation that the gateway will use. Otherwise a dev-only/mock/not-prod-eligible artifact can still produce a passing smoke report. Please make production validation the default (or add an explicit opt-in dev flag) and add a regression test proving the default CLI rejects a dev-only/mock artifact.

  2. The json_schema validation currently only checks that structured_output is a dict. That means a response like {} or {"unexpected": true} would pass even though the fixture schema requires answer and forbids additional properties. Please validate the returned object against the schema used in the request (or otherwise enforce required fields/additionalProperties) and add tests for missing required fields and extra keys.

Non-blocking but worth tightening while you are here: the streaming/tools checks mostly verify that the fixture was constructed with stream=True / a tool request, not that the provider actually honored streaming/tool semantics beyond returning any tool_call. That may be acceptable for R2 fake-mode smoke, but the real-provider path should avoid treating those as strong capability evidence.

Because this is a large llm_gateway/model-routing feature surface, it still needs human maintainer/product review before merge even after these are fixed. I did not approve formally under the maintainer automation gate.

@undivisible

Copy link
Copy Markdown
Collaborator

Consolidated into #10089 — all 6 auto-router PRs merged sequentially with co-authorship preserved.

@github-actions

Copy link
Copy Markdown
Contributor

Hey @choguun 👋

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!

undivisible added a commit that referenced this pull request Jul 29, 2026
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
undivisible added a commit that referenced this pull request Jul 31, 2026
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
undivisible added a commit that referenced this pull request Jul 31, 2026
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-maintainer-review Needs a human maintainer to sign off before merge needs-tests PR introduces logic that should be covered by tests 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.

4 participants