Repository navigation
fix model hub recent sorting for on-device models - #9642
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f1f5190107
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
Confirmed the recent branch in studio/frontend/src/features/hub/catalog/models-catalog-lists.tsx only applied pin rank and source order, and cached rows kept raw seconds while local rows were milliseconds. Will get this reviewed. |
|
Verified this end to end and it holds up. Summary first, evidence below. The bug is real and the root cause is right. Two defects were stacked:
The backend really does emit seconds: Before and after, on the real componentI rendered the actual
The base row reproduces the report exactly: bert-base-uncased pinned at the top, LM Studio rows stranded at the bottom. Pinned rows keep their manual order because Nothing else breaks
Two things to fix1. A completed download drops to the bottom of Recent. Codex was right; details and a repro table in that thread. 2. Datasets Recent is inert. Codex was right about the premise; I fixed it in the backend instead of gating the comparator, detail here. 3. Minor: What I ran
The lifecycle suite was written to fail before the fix and pass after; a green-on-both test would not have been testing anything. What this run cannot tell you
PatchCannot push to the branch (
|
A completed download stops being surfaced as a live row, and the optimistic row that replaces it carried no timestamp, so the model that just finished sorted below every dated row until a backend scan landed. Carry the inventory hint's own creation time through optimisticRow. Cached datasets carried no timestamp at all, so selecting Recent on the datasets tab put every cached Hub dataset after every local one. Emit last_modified from the dataset cache scanners, in the same POSIX seconds the cached model scan already uses. Also correct the last_modified unit docs: the picker inventory path now forwards milliseconds while the raw endpoints still return seconds.
|
Opened Imagineer99#73 against this branch with the two fixes and their tests, since I cannot push here directly. Merging it lands the commits inside this PR and keeps your authorship on the original work. It covers the completed-download drop and gives cached datasets a Separately, CI here shows |
Follow-ups to the follow-up, all found by simulating the merged tree rather than reading it. Three real defects and two documentation gaps. A non-finite mtime could take out the whole cached-datasets endpoint. _safe_mtime guarded on `mtime > 0`, and inf passes that test. Starlette encodes responses with allow_nan = False, so one inf reaching a row raises ValueError inside the encoder and /api/hub/datasets/cached returns 500 rather than one bad date. The value is not a stat() result we control: it is whatever huggingface_hub put on the repo object. _usable_mtime now requires isfinite, and every entry point routes through it. The cached-model scan has the same hole in _blob_mtime today, on main, independent of this branch; that one is reported separately rather than widened into this diff. Deduplication discarded the newer of two timestamps. Which of two rows describing one dataset survives is decided on completeness then size, neither of which has anything to do with recency, so a bigger but older copy legitimately won and took the newer copy's date with it. The dataset sank in Recent, which is the exact bug this branch exists to fix. The cached-model scan already keeps the max across duplicate roots; _adopt_newer_last_modified is the dataset twin, wired into all three replacement paths. The new backend test was in a directory no workflow collects. studio-backend-ci runs pytest tests/ from studio/backend, and hub/tests is a sibling of that path, so the guard would never have run. Moved to studio/backend/tests/ with a note saying why it sits away from its subject. The wider hub/tests gap, 629 tests that no workflow collects, is worth its own fix. normalizeTimestamp now states its supported domain. The 1e10 pivot is a heuristic, not a converter: it is idempotent only at or above the pivot, and it reads epoch seconds from November 2286 onward as milliseconds. Real mtimes sit far inside those bounds, but the next person deserves to be told where the edges are instead of inferring that the helper is general. The unit seam is now pinned by a test. After the recency fix, last_modified is epoch seconds off listCachedGguf and epoch milliseconds when the picker builds the same shape from an inventory row. Nothing renders wrongly today because every consumer subtracts like for like or stringifies. pr9642-unit-boundary-guard fails when a new reader appears without declaring its unit, when a caller of formatUpdatedDate appears, or when a scale conversion shows up outside normalizeTimestamp. pr9642-dedup-and-stale records two cases the lifecycle suite does not reach, both about re-downloading something already held complete. Dedup keeps the complete row over the live one, and a complete server row keeps its own timestamp over the completion hint. Both are right, both mean Recent lags until the next scan, and neither is a regression since Recent had no date term at all before this branch. Pinned so they are a decision rather than an accident.
Opening comment-reduction pass over the 256 comment lines this branch adds. Scoped to those, not to every comment in a touched file: rewriting pre-existing prose in chat-api.ts would balloon the diff for no reader's benefit. Kept every 'why' that is not recoverable from the code, cut the restatement around it. The normalizeTimestamp and unit-seam blocks stay longest on purpose, since the supported date domain and the two-unit hazard are the parts a reader cannot infer. AST-gated comment-only, 12 of 12 files, with docstring edits allowed: the two Python docstrings touched belong to internal helpers, not to anything FastAPI or argparse surfaces.
|
Ran the full verification on the combined change and pushed the results into #73. Summary first, then what it cannot tell you. The fix works, shown on the real componentI rendered the actual
The base row reproduces the report exactly. Pinned rows keep their manual order because Cross-browser and cross-OSNine cells, chromium / firefox / webkit against UTC, America/Los_Angeles and Asia/Kolkata: byte-identical order, zero page errors. The comparator algebra runs inside each engine too, not just under node: reflexivity, totality, no NaN, anti-symmetry, transitivity over every ordered triple, and all 720 permutations of a six element list matching a stable insertion-sort oracle of that same permutation. ES2019 guarantees a stable sort, but only for a well-formed comparator; given anything less, V8, JSC and SpiderMonkey may each return a different order, so the algebra is what makes this engine-independent and the three browsers only confirm it. For the OS axis I replicated onto a staging repo and ran ubuntu-latest, macos-15 and windows-latest, with a base control on fresh
Identical on both sides, so that one is pre-existing on Three defects found by simulating rather than readingAll fixed on
Nothing else breaks
What this run cannot tell you
Two things blocking the merge, neither about the codeThis branch conflicts with
The |
# Conflicts: # studio/frontend/src/features/hub/inventory/types.ts
|
Verified #9617 against the current code and reproduced the failure. The prior Concrete issues found and fixed:
Verification:
ESLint still reports existing violations in |
|
@codex review |
|
Codex Review: Didn't find any major issues. Keep them coming! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
Fresh convergence review found and fixed three related redownload cases in
Focused coverage now has seven frontend cases, including repeated completion TTL, stale aggregate rows, and delete-then-redownload history (tests). Local TypeScript typecheck, ESLint, production build, 13 backend timestamp tests, and Ruff all pass. |
|
@codex review |
|
Codex Review: Didn't find any major issues. Already looking forward to the next diff. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
Post-push convergence found and fixed four more correctness issues in 8478815:
Focused local verification:
|
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8478815f89
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
Convergence follow-up ce3c09d fixes the remaining lifecycle and freshness gaps:
Evidence: studio/frontend/src/features/hub/download-manager/download-manager-state.ts, studio/frontend/src/features/hub/inventory/inventory-hint-store.ts, studio/frontend/src/features/hub/inventory/inventory-hints.ts, studio/frontend/src/features/hub/inventory/use-device-inventory.ts, studio/frontend/src/features/hub/inventory/use-hub-inventory.ts, studio/frontend/src/features/hub/inventory/api.ts, and studio/frontend/tests/hub-inventory-recent-sort.test.ts. Focused local verification: 7 frontend tests, typecheck, targeted ESLint, and production build all pass. |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ce3c09d916
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
Final convergence fixes are pushed through 9028c27. Concrete findings and fixes:
Focused verification on 9028c27:
Final cross-platform focused CI is running on Linux, Windows, and macOS: https://github.com/mahiatlinux/unsloth/actions/runs/33167576075 |
|
@codex review |
|
Codex Review: Didn't find any major issues. Chef's kiss. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
Fixed the Windows frontend unit-test failure from job 98836974034. Current upstream main renamed the sidebar constant from |
mahiatlinux
left a comment
There was a problem hiding this comment.
Reviewed the implementation, fixes, regression coverage, and focused cross-platform CI.
|
All reviewed and fixed, LGTM. CI results |
Summary
Fixes #9617
Validation
node --experimental-strip-types --test tests/hub-inventory-recent-sort.test.ts tests/training-cache-reconciliation.test.ts tests/pinned-models-reorder.test.ts tests/hub-recovery-paths.test.ts— 58 passednpm run typechecknpm run build0998656891170ce53abef1f1f4383d88e2d5a7aef1f51901072be222d953910e0705e764ec549824UI evidence
Both sides use the same four timestamps, all before the capture date (2026-08-24). BEFORE preserves alphabetical/source order; AFTER orders newest to oldest across sources.
Individual captures
BEFORE
AFTER