fix(discovery): stop blanket-excluding OpenRouter from serving on ZDR grounds - #951
fix(discovery): stop blanket-excluding OpenRouter from serving on ZDR grounds#951seonghobae wants to merge 2 commits into
Conversation
… grounds OpenRouter's ProviderModelSource has carried evidence_only=True since 952996e ("ZDR hardening"), meaning no OpenRouter model can ever become a serving agent (agent_from_discovered hard-refuses; is_routable_discovered_model excludes it) regardless of that specific model's own ZDR status. Traced the actual security history: the real bug 721ae51 fixed was cross-provider evidence *contamination* -- suffix-matching OpenRouter's ZDR feed against other providers' models that merely shared a display name. That was correctly fixed by scoping the match to exact canonical ids. 952996e's blanket evidence_only=True is a separate, over-broad follow-up with no independent security rationale on record (empty commit body) -- and it made OpenRouter's own rows worse than before: _apply_discovered_model_evidence's zdr_capable=not model.evidence_only and matches(...) meant an OpenRouter model attested ZDR-capable by OpenRouter's own exact-match feed still could never carry that evidence into a servable agent. ZDR is per-route/model evidence (this repo's own zdr_capable field, supports_zero_data_retention, and privacy:zdr/privacy:no_zdr tags already model it that way for every other provider), not grounds to bar an entire provider account from serving. ContextualWisdomLab/.github's own zdr_policy.is_zdr_model already evaluates OpenRouter per exact "provider/model" route against the same /api/v1/endpoints/zdr feed -- it was already built to consume honest per-model evidence and never depended on this blanket exclusion. Removes evidence_only=True from OpenRouter's PROVIDER_MODEL_SOURCES entry. No other source ever set it, so is_routable_discovered_model / agent_from_discovered's evidence_only guard remains in place as general infrastructure for a genuinely evidence-only future source. New regression test proves a free, ZDR-attested OpenRouter model is now routable, serving-agent-eligible, and carries privacy:zdr -- RED confirmed against the pre-fix source (assertion on evidence_only), GREEN after. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Kj32ABZLZ2a6TPTyvYrRkg
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueThanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Kj32ABZLZ2a6TPTyvYrRkg
|
Superseded by #949 ("fix(discovery): route OpenRouter by model evidence", merged Closing without merging to avoid duplicating already-landed, more complete work. Generated by Claude Code |
Why
Reported (in the org's product-loop session): OpenRouter contributes zero servable free models even though
OPENROUTER_API_KEYis registered and OpenRouter's own catalog carries real, complete per-token pricing (unlike Bytez, which never reports pricing at all — separate, already-tracked gap in #940).Root cause:
PROVIDER_MODEL_SOURCES'sopenrouterentry has carriedevidence_only=Truesince952996ec("fix(discovery): keep OpenRouter catalog evidence-only").evidence_only=Truemeans no OpenRouter model can ever become a serving agent —agent_from_discoveredhard-refuses (raise ValueError("evidence-only model cannot become a serving agent")) andis_routable_discovered_modelexcludes it — regardless of that specific model's own ZDR status.Traced the actual security history through the commit trail (
721ae519,588aef3,984fe91,6dcfc07,caab2ed,952996ec):721ae519fixed ("fix(security): scope ZDR evidence to OpenRouter") was cross-provider evidence contamination: an earlier version matched OpenRouter's ZDR feed against every discovered provider's models by model-id suffix, so a different provider's model that merely shared a display name with an OpenRouter model could incorrectly inherit OpenRouter's ZDR attestation. That was correctly fixed by requiring an exact canonical id match — no more suffix matching. This fix is real, correct, and untouched by this PR.952996ec(empty commit body, no linked issue/design doc) is a separate, later, much broader change: it doesn't touch matching logic at all — it just addsevidence_only=Trueto OpenRouter's source, which bars the entire provider account from ever serving. There's no independent security rationale on record for this specific scope._apply_discovered_model_evidence'szdr_capable=not model.evidence_only and matches(model.model_id)meant OpenRouter's own rows — even ones OpenRouter's own exact-match ZDR feed attests as ZDR-capable — could never actually carry that evidence into a serving decision, sinceevidence_only=Truezeroed it out beforematches()even mattered.ContextualWisdomLab/.github's ownscripts/ci/zdr_policy.py(used by the central Strix/Noema/OpenCode review sidecar) was already built to consume this correctly:is_zdr_model()evaluates OpenRouter per exact"provider/model"route against the same/api/v1/endpoints/zdrfeed, with fullPROVIDER_ZDR_SCOPE/PROVIDER_CREDENTIAL_NAMES/PROVIDER_BASE_URLSentries foropenrouteralready in place. It never depended on this blanket exclusion — it was just never reachable, becausecontextual_orchestrator's own discovery layer never let an OpenRouter model become a servable candidate in the first place.ZDR is per-route/model evidence — this repo already models it that way for every other provider (
zdr_capable,supports_zero_data_retention,privacy:zdr/privacy:no_zdrtags) — not grounds to bar an entire provider account from serving.What changed
evidence_only=Truefrom OpenRouter'sPROVIDER_MODEL_SOURCESentry. No other source ever set it;is_routable_discovered_model/agent_from_discovered'sevidence_onlyguard remains in place as general infrastructure for a genuinely evidence-only future source.discover_all_modelscomment describing OpenRouter's role.test_default_sources_request_openrouter_full_modality_catalog,test_enable_cheapest_activates_the_lowest_priced_discovered_agent,test_enable_cheapest_bootstraps_independent_provider_accounts) to assert the corrected behavior — OpenRouter now legitimately wins cheapest-price selection when it is in fact cheapest.test_openrouter_free_zdr_verified_model_is_routable_and_servable: proves a free, ZDR-attested OpenRouter model is routable, serving-agent-eligible, and carriesprivacy:zdr— using the real productionPROVIDER_MODEL_SOURCESentry, not a synthetic fixture.Verification
assert openrouter_source.evidence_only is False(i.e. it'sTrueon unfixed code); restored the fix, confirmed it passes.python -m pytest tests -q(deselecting the same pre-existing, unrelatedfast_mlsirmenvironment gap noted in fix(discovery): bound OpenRouter free-model endpoint fan-out to one deadline #939):2824 passed, 1 skipped.interrogate contextual_orchestrator/model_discovery.py: 100%.Scope note
Left
_apply_discovered_model_evidence'snot model.evidence_onlyguard in place — it's correct in the abstract (an evidence-only row can never serve regardless of itszdr_capablevalue, so gatingzdr_capablecomputation on it is immaterial dead weight for such rows, not wrong), and now correctly inert for OpenRouter sinceevidence_onlyisFalsethere.Generated by Claude Code