Repository navigation
fix(huggingface): honor available provider capabilities - #129797
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 26, 2026, 2:44 AM ET / 06:44 UTC. ClawSweeper reviewWhat this changesThe PR projects Hugging Face route metadata into discovered model definitions, using the lowest usable context limit and hiding tools only when every usable route reports no tool support. Merge readinessKeep open for maintainer confirmation: the current head resolves the earlier order-dependent context-limit finding, but the Hugging Face router contract that makes tool capability a union across unpinned routes could not be independently verified in this environment. Priority: P2 Review scores
Verification
Live VerificationCommand: Result: PASS (completed) Assertions:
How this fits togetherThe Hugging Face plugin fetches the inference-router catalog and produces model definitions used by provider setup and agent context budgeting. Those definitions affect the tools and request size OpenClaw advertises before the router selects a backend. flowchart LR
A[Hugging Face router feed] --> B[Plugin model discovery]
B --> C[Aggregate route capabilities]
C --> D[Model definitions]
D --> E[Agent context budget]
D --> F[Provider request routing]
Decision needed
Why: The changed metadata controls whether OpenClaw emits tool payloads, while the router’s selection semantics are external and were not independently reachable from this review environment. Before merge
Agent review detailsSecurityNone. PR surfaceSource -2, Tests +143. Total +141 across 2 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Retain the minimum-context aggregation and land only after recording provider evidence that unpinned tool requests are capability-routed; otherwise make tool support conservative across all eligible routes. Do we have a high-confidence way to reproduce the issue? Yes, source-reproducible: current main reads the first positive route context while the provider configuration uses the resulting logical model definition. The read-only review did not execute the regression test. Is this the best way to solve the issue? Unclear: taking the minimum positive context is the safe fix for unpinned route selection, but the permissive tool aggregation needs the router’s capability-routing contract to be the best solution. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 0229fe7a2a90. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
History |
|
Merged via squash.
|
Summary
Hugging Face's inference-router catalog exposes context limits and tool support per backend, while its OpenAI-compatible endpoint chooses the fastest available backend by default and can select alternatives through routing policies or failover. Existing discovery copied the first backend's context limit and advertised tools even when an eligible backend explicitly rejected them.
Project the safe capability intersection at the owning Hugging Face discovery boundary:
supports_tools: false.Production delta: +23/-25 (net -2). Focused regression coverage: +173 lines.
Upstream contract
Hugging Face documents that its OpenAI-compatible router selects the fastest available provider by default, with explicit provider/policy selection and failover; it does not guarantee capability-aware routing for tool-bearing requests:
The live public catalog confirms why a union is unsafe:
meta-llama/Llama-3.1-8B-Instructadvertises Novita at approximately 168 tokens/second withsupports_tools: false, while its tool-capable DeepInfra backend reaches approximately 30 tokens/second. The documented default therefore selects the explicitly incompatible backend unless a capable provider is pinned.Verification
1,010,000 -> 262,144; Gemma262,144 -> 131,072; DeepSeek V41,048,576 -> 512,000; bundled default DeepSeek R1 remains64,000.git diff --check, and fresh independent local plus complete-branch P1 reviews passed.Risk
Low: existing plugin-owned model projection only; no configuration, authentication, request-schema, storage, migration, or model-default changes. The conservative intersection resolves both ClawSweeper concerns without assuming an undocumented upstream router capability.