Repository navigation
fix(gateway): stop model overrides failing in multi-agent gateways - #137913
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed September 4, 2026, 12:44 AM ET / 04:44 UTC. ClawSweeper reviewWhat this changesThe PR passes the selected HTTP agent into prepared model-catalog loading for model overrides and adds a two-agent regression check. Merge readiness✅ Ready for maintainer review Keep open. This is a focused owner-boundary repair: current main drops the already-selected agent before catalog loading, while the patch preserves it for both OpenAI-compatible HTTP endpoints. No blocking correctness or security defect was found. Priority: P1 Review scores
Verification
How this fits togetherGateway Chat Completions and Responses requests resolve and authorize an agent before processing an optional model override. The override resolver loads that agent’s prepared model catalog, applies its visibility policy, and returns either the allowed model or an HTTP error. flowchart LR
A[HTTP client] --> B[Chat or Responses endpoint]
B --> C[Selected agent]
C --> D[Model override resolver]
D --> E[Prepared model catalog]
E --> F[Agent visibility policy]
F --> G[Agent run or HTTP error]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource 0, Tests +2. Total +2 across 2 files. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Technical reviewBest possible solution: Land this single forwarding repair after ordinary exact-head CI gates so selected-agent model overrides use the selected agent’s prepared catalog. Do we have a high-confidence way to reproduce the issue? Yes. Current main resolves an explicit HTTP agent but calls the prepared catalog without it; in an explicit multi-agent configuration that reaches ambient-owner resolution and its selection error. I did not execute the supplied live scenario in this read-only review. Is this the best way to solve the issue? Yes. Passing the already-resolved agent through the existing catalog-loader contract preserves one canonical path and avoids an incorrect global default or ambient-owner fallback. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against c6ea391c9298. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Thanks @syncword! Proof: Real built Gateway with two explicitly owned agents, both HTTP routes, no ambient owner, and process-restart coverage. Four allowed-override requests reached the real provider and returned correct answers.
Validation: 57 focused tests pass; the two ownership regression cases fail on pre-fix production. Exact-head real HTTP proof and Autoreview are green. Production line count is unchanged. |
…penclaw#137913) Preserve the explicitly selected agent when validating model overrides for the chat completions and responses HTTP endpoints. Multi-agent gateways without an ambient owner now return the selected agent's visibility rejection instead of HTTP 500. Proved both routes with two agents before and after process restart, unknown-agent controls, and four successful real-provider requests. All 57 focused tests pass; production line count is unchanged. Fixes openclaw#137820. Thanks @syncword for reporting the regression. Co-authored-by: Ayaan Zaidi <[email protected]>
Closes #137820. Thanks @syncword for the report.
What Problem This Solves
Selecting an agent and overriding its model could return HTTP 500 in a multi-agent Gateway with no ambient owner. Both chat-completion and response endpoints were affected.
Why This Change Was Made
The shared override helper now passes the already-selected agent into the model catalog loader. The catalog can apply that agent's visibility policy without trying to select an ambient owner.
User Impact
Selected agents can use allowed overrides without a system agent. Disallowed overrides return the normal HTTP 400 rejection, and unknown-agent rejection stays unchanged. No configuration or model-policy change.
Evidence
Real Gateway requests reproduced HTTP 500 before the fix and correct HTTP 400 rejection afterward across both endpoints and two agents, including after restart. Four allowed live inference requests returned HTTP 200. The two new regression cases failed before the change; all 57 focused tests passed afterward.
Consumers: both HTTP model-override endpoints pass the selected agent to catalog lookup.
AI-assisted.