Recommendation: Changes Requested
This PR fixes a real operator-facing diagnostic gap on Hub 404 lookup failures with low merge risk and zero hot-path or concurrency impact, and it places the error context at the right call site (resolve_primary_target, avoiding double-prefixing refresh_model_at). However, the current diff adds 22 lines of unused typed-error boilerplate (RevisionLookupError / Error::source()), restricts annotation strictly to HTTP 404 while leaving HTTP 401/403 (which Hugging Face returns for private or nonexistent repositories) unnamed, and omits test coverage for the -tp1 fallback-exhausted path highlighted in the description. Simplifying the wrapper to format!(...).into(), widening it to ApiError (or explicitly scoping 404-only behavior), and adding a -tp1 fallback-exhausted test will make this a cleaner, smaller, and complete fix.
Merge Risk
Level: Low
- Isolated error-path scope: Only
resolve_primary_targetinflare/src/hub.rs:3421-3449changes, executing once on an already-failed revision lookup with zero effect on successful acquisitions, retry policy (transient_hub_erroratflare/src/hub.rs:5460-5472), or-tp1fallback ordering (resolve_revisionatflare/src/hub.rs:3381-3393). - No public, wire, or concurrency blast radius:
RevisionLookupErroris private, no downstream code inflare/orflare-cli/downcasts toApiErroror parses the lookup error text (content_failureatflare/src/hub.rs:5497-5506is unaffected), and no locks, shared state, or on-disk formats are touched.
Walkthrough
flare/src/hub.rs:3398-3419: Adds a privateRevisionLookupErrorstruct implementingDisplay(cannot resolve {repository}@{revision}: {source}) andstd::error::Error::source().flare/src/hub.rs:3427-3441: Wrapsresolve_revision(api, repo, progress)inresolve_primary_targetwith.map_err(...), downcasting the boxed error toApiError::RequestError(ureq::Error::StatusCode(404))and boxingRevisionLookupErrorwithrepo.url()andrepo.revision()while passing all other errors through unchanged.flare/src/hub.rs:8620-8622: Strengthenspermanent_resolution_failures_are_not_retriedto assert that thestatus == 404cases (gb10-tp1andcustom) includeowner/model@{revision}in the formatted error.
Pre-merge Checks
- [PASS] Security / malicious screen: Purely local stderr error formatting on an existing 404 path; no external execution, untrusted input handling, or credential exposure.
- [PASS] Charter & value fit: Addresses a concrete, reproducible diagnostic defect (#489) in the model-agnostic Hub acquisition layer with minimal surface area.
- [PASS] Related / duplicate / conflict check: No overlapping PRs or conflicting commits on
mainsince branch point; complements #598's expandedPLATFORMSlist (helios/src/core/naming.rs:15-18). - [WARN] Tests & verification evidence: No automated CI checks ran on
a3ec4b6; results are author-reported on Linux ARM64 using a temporary checkout realigningflare/Cargo.lock:597-600tohelios/Cargo.toml:35-37(deepseek-recipe), with Orbit CLI end-to-end flow unrun (both limitations honestly disclosed).
Blockers
None.
Should Fix
-
HTTP 401/403 (and other Hub lookup errors) remain unnamed (
flare/src/hub.rs:3427-3441,:8603,:8620-8622):- As
flare/src/identity.rs:91-95documents, Hugging Face returns HTTP 401/403 for a repository that does not exist or is not public — the other half of the diagnostic ambiguity cited from #489 — yetresolve_primary_targetfilters strictly toureq::Error::StatusCode(404). Even in the PR's own test (flare/src/hub.rs:8603),("gb10", 401)still surfaces withoutowner/model@gb10. - Fix: Annotate any
ApiErrorreturned byresolve_revision(e.g.,if error.is::<ApiError>()), which keeps cancellation errors (flare/src/hub.rs:125) untouched, covers 401/403/404/5xx/network lookup failures uniformly, removes the duplicated 404 match guard (:3382-3383vs:3430-3431), and lets:8620-8622assertowner/model@{revision}for the401case too. (If 404-only scoping is strictly intentional, narrow the PR title accordingly and add an explicit negative assertion for the 401 case.)
- As
-
-tp1fallback-exhausted path is untested and reports only the requested revision (flare/src/hub.rs:3381-3393,:3433-3437,:8603):- When
repo.revision()matchestp1_revision_alias(flare/src/hub.rs:3363-3365, e.g.,gb10) and bothgb10andgb10-tp1return 404 insideresolve_revision,resolve_primary_targetformatsrepo.revision()(gb10). Because the retry message at:3388islog::info!(hidden in default CLI output), the surfaced error omits thatgb10-tp1was also attempted — slightly at odds with the PR description's "attemptedrepository@revisionto the final HTTP 404". Neither("gb10-tp1", 404)nor("custom", 404)inpermanent_resolution_failures_are_not_retried(:8603) exercisestp1_revision_alias. - Fix: Add a fixture test case where both
gb10andgb10-tp1return 404, pinning the exact expected error text. Either include the fallback alias in the diagnostic when tried (e.g.,cannot resolve owner/model@gb10 (also tried gb10-tp1): ...) or clarify in the PR description that the requested revision is reported (matchingrefresh_model_atatflare/src/hub.rs:2280).
- When
Subtract / Simplify
- Delete
RevisionLookupErrorand useformat!(...).into()(flare/src/hub.rs:3398-3441):RevisionLookupError(22 lines plusDisplayandstd::error::Errorimpls) exists only to exposeError::source(), which nothing inflare/orflare-cli/reads:flare/src/hub.rs:29erases errors toBox<dyn std::error::Error>, the CLI printsDisplay(flare-cli/src/main.rs:64), and Orbit flattens toString(flare-cli/src/orbit/agent.rs:135,flare-cli/src/orbit/controller.rs:2534-2546). Every other contextual wrapper inflare/src/hub.rs(:2280,:2651,:2658,:3297,:5516-5520) usesformat!(...).into().- Replacing
:3398-3441with a directmap_err(combined with Should Fix #1):
produces the identical rendered message (retaining HTTP 404) while cutting ~25 lines of boilerplate and unused abstraction (let info = resolve_revision(api, repo, progress).map_err(|error| { if error.is::<ApiError>() { format!("cannot resolve {}@{}: {error}", repo.url(), repo.revision()).into() } else { error } })?;AGENTS.md:188-190).
Nits
- Missing Discord contact line in PR description:
AGENTS.md:144-150requires aDiscord: <username>orDiscord: no username providedline at the end of every PR description.
Dropped on verification
- Claim that
resolve_revisionshould own the wrapper becauserefresh_model_atandRevisionClient::revisionare left uncovered / opaque: Verified false on both counts.refresh_model_at(flare/src/hub.rs:2279-2280) already formatscannot check {}@{revision} for updates: {error}; ...for every error — moving"cannot resolve {repo}@{rev}: ..."intoresolve_revisionwould double-print{repo}@{rev}inrefresh_model_atunlessrefresh_model_atis also rewritten. Separately, all non-test callers ofRevisionClient::revision(scan_revisionsatflare/src/hub.rs:2171andcheck_model_updateatflare/src/controller.rs:2649) intentionally discard errors (let Ok(...) else { continue; }/.ok()?) for best-effort update notices, so its errors are never shown to operators. - Claim that a
fn hub_not_found(error: &ApiError) -> boolhelper could deduplicate all three 404 matches (:2142,:3383,:3431): Verified false for:2142.RevisionClient::revision(flare/src/hub.rs:2131-2146) matchesureq::Error::StatusCode(404)directly, notApiError, so anApiErrorpredicate cannot be used there. Furthermore, wrappingerror.is::<ApiError>()eliminates the duplicated 404 predicate at:3431altogether without adding a new helper. - Claim that #603 must add a
docs/TODO.txtentry and link #489: Verified false. Revieweroriginal-el8on #489 asked to move the bare-404 note out ofdocs/multi-host.md(not opened) intodocs/TODO.txtbecause #489 was a docs-only PR leaving an unresolved defect (AGENTS.md:57-58). #603 resolves the defect rather than leaving it unresolved, and already references #489 in its description. - Claim that
docs/cli-design.mdrequires a documentation delta for the new stderr message: Dropped as low-signal churn.docs/cli-design.md(:920-934,:1060-1072) specifies revision fallback and update behavior without quoting exact Hub error message strings anywhere indocs/. - Separate minor finding that
Error::source()is unobservable: Merged into Subtract / Simplify #1 (RevisionLookupErrordeletion) to avoid duplicate reporting.