fix: scope structured provider failures to request - #867
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks 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 |
b49d6ff
into
fix/provider-backed-embedding-batch
| admitted = self._request_admitted_agents.get() | ||
| if admitted is not None: | ||
| candidates = [agent for agent in candidates if agent.id in admitted] |
There was a problem hiding this comment.
🟡 Semantic-affinity embedding selection disabled during conduct
The request-admitted set, built only from structured chat readiness, is applied by _ranked_agents to the re-entrant embedding lookup reached via _embedding_agent_id. A dedicated embedding provider is excluded, so select_capability_agent("embedding") fails and semantic-affinity ranking silently falls back to declaration order for the whole conducted request.
Prompt for agents
The request-scoped admitted-agent filter added in _ranked_agents (contextual_orchestrator/orchestrator.py around lines 4414-4416) is intended to restrict chat provider selection during a conducted request to structured-chat-ready agents. However _ranked_agents is re-entrant: _semantic_affinities -> _embed_cached -> _embedding_agent_id -> select_capability_agent -> _capability_agents calls _ranked_agents again with capability="embedding", chat_only=False. Because the admitted set only contains structured-chat-ready (or mock) agents, a dedicated embedding provider is filtered out, making embedding selection fail and disabling semantic-affinity ranking for the whole conduct request. Consider scoping the admitted filter to chat-role ranking only (e.g. only apply it when chat_only is True, or when the capability/role is a chat role), so non-chat capability resolution like embeddings is not incorrectly gated by structured chat readiness.
Was this helpful? React with 👍 or 👎 to provide feedback.
| admitted = self._structured_admitted_agent_ids() | ||
| if not admitted: | ||
| raise NoViableAgentError( | ||
| retry_after_seconds=max(1, math.ceil(self.circuit_reset_seconds)) | ||
| ) | ||
| token = self._request_failed_agents.set(set()) | ||
| admitted_token = self._request_admitted_agents.set(admitted) | ||
| try: | ||
| return self._conduct_request( | ||
| messages, model_name=model_name, progress=progress | ||
| ) | ||
| finally: | ||
| self._request_admitted_agents.reset(admitted_token) | ||
| self._request_failed_agents.reset(token) |
There was a problem hiding this comment.
🔍 ****
The conduct gate raises NoViableAgentError only when the entire admitted set is empty. For an explicit model_name, _plan uses _requested_agent directly and _failover_candidates prepends that primary before the admitted filter shapes only the failover pool. A conduct request naming a real, not-structured-ready model can still reach it whenever any other admitted agent keeps the set non-empty.
Was this helpful? React with 👍 or 👎 to provide feedback.
Summary
no_viable_agentretry contract when the declared set is exhaustedVerification
uv run pytest -q tests/test_provider_reliability.py tests/test_openai_passthrough.py tests/test_model_judge.py(75 passed)uv run python -m compileall -q contextual_orchestratorStacked on the delivered provider-backed embedding owner branch so the combined runtime tree remains reproducible.