Repository navigation
Studio: warn when the disk is running low, and point at the caches - #11439
Conversation
Unsloth's caches are what make an update or a second run fast, so they are worth keeping and worth being able to see. On a working box they are also the largest thing on disk that is safe to delete: uv's wheel cache alone reaches tens of gigabytes, and nothing in Studio said so or offered to reclaim it. Settings > Resources > Storage now lists every cache with its size and a total, and can empty them. Sizes are memoised for 60 seconds with a Recheck button, because a cold walk over a large uv cache and a triton cache of tens of thousands of files takes tens of seconds. Only caches are ever removed. The API takes a cache KEY, never a path, so a caller cannot name a directory to delete; the roots are computed in the backend from the same resolvers the rest of Studio uses. Each root is then checked before anything is unlinked: absolute, not a symlink, at least two components below the filesystem anchor, and neither inside nor containing a protected path (the Studio home, studio.db, auth, projects, models, datasets, outputs, exports, the Hugging Face cache home that holds the token, or a managed asset home such as DATA_DESIGNER_HOME). The root is emptied rather than removed, a symlink inside it is unlinked instead of followed, and a directory whose real path leaves the root is skipped. Three caches are opt-in and are never swept up by the bulk clear. The Hugging Face hub and dataset caches cost a re-download of something the user asked for. The unsloth compiled cache is excluded for a different reason: a training or inference worker imports generated modules from it lazily, long after the job started, and the existing lock only serialises against a sibling backend, not against a spawned worker. Clearing it under a running job would forfeit hours of compute, which is not a trade to make from a button labelled free up space. When free disk crosses 20 GB, or 5 GB for the stronger warning, a toast offers the caches as the thing to trim and links to that section. It is mounted at the app level rather than inside Settings, since a warning shown only to someone already looking at the disk figure reaches the people who least need it, and it adds no polling: it subscribes to the system poll the app already runs. The level is held for the browser session so a threshold is announced when it is crossed, not once per poll while the disk sits below it.
The low-disk notice never worked. Its own comment claimed it subscribed to the system poll the app already runs; there is no such poll. subscribeSystemInfo only adds a callback to a Set, and the only two callers of the fetching hook are the floating monitor and the resources tab, both lazily mounted and both gated on being open. So the warning reached nobody who had not already opened the one screen that shows the disk figure, which is the audience it exists to reach. It now owns a 60 second poll and says so. The test that was supposed to cover this asserted the opposite, requiring the subscribe form and BANNING the fetching one, so it passed for as long as the feature was broken; it now asserts the fetch. It was also mounted in StudioPage, which is the /studio training route rather than an app shell, so anyone in Chat, Images or Audio never subscribed at all. It moves to RootLayout beside the other null-returning mounts. An opt-in cache nested inside another cache root was deleted by a bulk clear of the parent, because opt-in roots were in neither the protected paths nor the protected trees. That defeats the whole point of marking the model, dataset and compiled caches opt-in, so a root that contains one is now refused with that reason, except when it is the cache being asked for by name. On Windows a directory junction is not reported by Path.is_symlink but is followed by realpath, so a junction cache root had its target emptied. Junctions are now refused like symlinks, and skipped when measuring so a row cannot advertise bytes it will not delete. An explicit HF_HUB_CACHE whose basename is not hub made the displayed cache home and the hub directory the same path, so the model cache was permanently unclearable and the UI called it a protected location when it held no credential. The token lives under HF_HOME, which stays protected. The cache rows measured once per mount, so changing the models folder left them showing the previous folder's path and size beside a field showing the new one, with a Clear that acted on the new one. They now follow the inventory version. The hub confirmation dialog concatenated its cost line with the generic assurance that downloaded models are not touched, which denied the deletion it was asking permission for.
The low-disk notice ran useSystemInfo({ pollMs: 60_000 }) from the app shell, so every open tab
hit /api/system every minute for as long as Studio was open. That route enumerates GPUs, reads
package metadata and samples CPU. It is the right route for a screen someone is looking at, and
far too much to run on the chance that a disk is filling.
A disk fills because something writes to it, and in Studio that is nearly always a download. So
the reading is taken where the bytes are about to be requested: requestStart is the single
funnel every download passes through. Plus one reading when the shell mounts, for the disk that
was already full before the user did anything. No interval anywhere.
New route /api/system/disk, which is one shutil.disk_usage and nothing else: statvfs on Linux
and macOS, GetDiskFreeSpaceExW on Windows. Measured here at 6.4 us median, 17.1 us p99 over
2000 calls, against 5 GB of GPU enumeration and metadata reads on the route it replaces. The
per-platform numbers are measured in CI rather than assumed, since those are three different
syscalls.
It reports the volume the models land on, not the filesystem root: those differ whenever
HF_HUB_CACHE or the Studio root sits on another disk, and the free space that matters is the one
the download is going to. A cache directory that does not exist yet resolves to its first
existing ancestor, since disk_usage raises rather than reporting the volume.
An unreadable host answers null, not zero. diskPressure() reads a zero total as the probe having
failed and a zero free as a full disk, so zeros there would warn every user on a platform where
the probe does not work.
The check never gates a download: not awaited, and a failed reading is dropped rather than
surfaced. It throttles itself, so a page that starts several downloads at once makes one
request.
The route is held to its cost by AST rather than by grep: a comment explaining why psutil is
absent must not fail a check for psutil, which is exactly the trap the first version of that
guard fell into.
hf_default_cache_dir() is documented to ignore HF_HUB_CACHE and the Models Folder setting, so on a machine that moved its downloads to another disk /api/system/disk reported the free space of a volume the next download will not touch. Its home ancestor always exists, so the fallback never reached studio_root() either. The active hub cache is asked first now, at the cost of one SQLite setting read. The inventory memo is keyed by cache rather than by path, so changing the Models Folder left hf_hub, hf_xet and hf_datasets describing the old root for the rest of the TTL. A browser hides that by forcing a refresh off the inventory-version event, but an API-key caller may change the folder and read the inventory while being forbidden refresh=true, so it had no way to ask again. set_hf_cache_home now invalidates those three alongside the scans it already invalidated.
Emptying the whole hub cache skipped the inference load-state guards that deleting ONE repo already runs, which made the wider action the one with the weaker check. sd.cpp re-reads its companion VAE and text-encoder files for every generation, so this broke a model loaded long before the clear, not only one mid-load. A repo-agnostic guard sits beside the per-repo ones and is asked for the model-cache keys, failing closed when it cannot answer, as the per-repo path does with its 503. The uv cache is refused when the installed environment is linked into it rather than copied from it. uv's own help says clearing under UV_LINK_MODE=symlink will break all installed packages, which turns a bulk clear from a re-download into a broken install. Two cheap answers, no walk: the declared link mode, and a top-level symlink in this interpreter's site-packages resolving into a uv root. Reclaimable bytes are now counted per inode rather than per name. uv's default link mode on Windows is hardlink, so an installed environment's files ARE links into the cache and unlinking the cache copy frees nothing; counting them anyway overstated both the row and the freed_bytes toast by the size of the installed packages. A multi-link inode counts only once the number of links seen inside the roots being measured reaches st_nlink, so anything linked from outside is left out. Understating beats promising space that unlinking will not return. And the download that used the space now reports it. requestStart reads the disk before a download, which is the right moment to refuse one, but a download that starts with room and then eats it crossed the threshold with nobody looking: there is no interval, so the warning waited for the next download attempt.
…e, an unguarded import The completion reading is forced. Unforced it was swallowed by the 30 second interval for any download shorter than that, and when the pre-start request was still in flight it was handed that request's answer, which is the figure measured before the download wrote anything and precisely the one it exists to correct. A forced caller now chains behind an in-flight request rather than sharing it, with at most one waiting, so a queue of files finishing together costs two readings. A partial purge reports only what it actually removed. rmtree can delete some children and then hit a permission error or a file that moved under it, and the whole subtree was already in the ledger, so freed_bytes claimed bytes still on disk. What survives is walked into a second ledger and subtracted. The curated dataset import holds the datasets registry across its fetch. Both loaders call load_dataset and snapshot_download directly, so it was neither a managed download nor a training run and claimed nothing: a Clear of hf_hub, hf_xet or hf_datasets passed every guard and could take the snapshot out from under the copy. claim_repository_owner is the same reservation a managed download takes and excludes a purge in both directions; it is released in a finally, and a clear already running answers 409 rather than racing it.
The last two commits left cache_inventory.py and test_cache_inventory.py in a shape ruff-format-with-kwargs rewrites, which fails pre-commit.ci and tests/test_formatter_fixed_point.py inside Repo tests (CPU). Both red checks on this branch are that one cause. Output of scripts/run_ruff_format.py with the pinned ruff 0.6.9; three collapsed line wraps, no behaviour change.
any_model_load_blocks_cache_clear consults llama.cpp, the inference orchestrator, Images and Video, but not the dictation sidecars, and those are the fifth backend reading out of the cache this clear empties: stt_sidecar._find_complete_cached_snapshot resolves through _repo_cache_dir into hub_cache, so a resident Whisper or Parakeet worker re-reading its snapshot is exactly the case the docstring says is enough on its own. stt_registry.resident() already reports both loaded and loading, so this is the same question the other four are asked, asked once more. Fail open on acquire like the rest: a sidecar that cannot be reached is not holding anything this process can see, and cache_inventory still fails closed on a guard that raises. Four tests. The two positive ones fail with this hunk reverted; the idle and unreachable controls are there so they cannot pass against a guard that has simply started refusing everything.
Three conflicts, all from main moving underneath this branch. settings-section.tsx and settings-dialog-store.ts are orthogonal: main added hideHeading and a chat-composer scroll target, this branch added the optional ref and resources-caches. Both sides kept. settings.py is the one worth stating. Main split the settings routes into account / shared / owner routers, and put both /hugging-face-cache routes behind _owner_settings_router. The cache inventory and purge are the same class of install-wide storage operation and the purge is the most destructive one there, so they move onto the owner router too rather than staying on the open router they were written against. A single-user install is unaffected, since require_owner only refuses an account that is not the owner; a managed account can no longer empty the install's caches, which is the intent of main's policy. The API-key axis is unchanged and still separate: a key may read the inventory, and refresh=true and the purge remain UI-session only. studio/backend tests/test_cache_inventory.py, test_api_cache_routes.py, test_system_disk_route.py and hub/tests: 802 passed on the merged tree.
This PR was doing two separable things. Measuring and clearing caches is one feature; warning that the disk is filling up is another, and the second does not import a line of the first. The only thing joining them was the deep-link string "resources-caches", which is navigation, not a dependency. So the notice goes to a follow-up, and with it everything that existed only to serve it: low-disk.ts, low-disk-check.ts, use-low-disk-notice.ts, the RootLayout mount, the two download-manager call sites, GET /api/system/disk and its AST/budget tests, the toast's frontend tests, and the lowDisk strings in all twelve locales. The deep-link machinery goes with it rather than staying here unused: the SettingsSection ref, the resources-caches scroll target, and the scroll effect in ResourcesTab. What is left is one coherent thing: show what the caches cost, and let them be cleared. 6214 insertions over 37 files becomes 5214 over 26. The follow-up is stacked on this branch, so the Storage section it links into already exists when it lands. studio/backend tests/test_cache_inventory.py, tests/test_api_cache_routes.py and hub/tests: 796 passed. i18n:check:strict: all twelve locale overlays pass parity. The frontend unit tests could not run in this workspace (no node_modules, so tests/helpers/module-stubs.ts cannot import typescript); they run on the staging legs.
Split out of the cache-inventory change, which was doing two separable things. This is the second: the disk filling up is worth saying out loud, and the caches are the thing to offer when it does. A toast at 20 GB free, and a stronger one at 5 GB. It is mounted in the app shell rather than inside Settings, because a warning shown only to someone already looking at the disk figure reaches the people who least need it. The notified level is held for the browser session, so a threshold is announced when it is CROSSED, not once per poll while the disk sits below it, and recovering out of critical does not disarm the low warning until free space clears low's own re-arm point. Nothing polls on a timer. The reading is taken once when the shell mounts, so a machine that is already full says so before the user picks anything, and once at the start of a download, which is the moment the answer decides something. A 30 second floor coalesces bursts and concurrent callers share one in-flight request. GET /api/system/disk is one shutil.disk_usage against the volume holding the model cache: statvfs on Linux and macOS, GetDiskFreeSpaceExW on Windows. No directory walk, no recursive sizing, no psutil. A test asserts a 5 ms budget and a second parses the route's AST and fails the build if walk, scandir, rglob, iterdir, glob or psutil ever appear in it. If the cache directory does not exist yet the route walks up to the nearest existing parent rather than failing, and an unreadable volume returns null, not 0, so it cannot be mistaken for a full one and block a download. The deep link into Settings > Resources > Storage comes with it: the SettingsSection ref, the resources-caches scroll target and the scroll effect in ResourcesTab exist only to serve this toast. Stacked on studio-cache-management, so the Storage section this links into already exists.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
Security findingsFinding details are still loading. Check the individual review comments. ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
#10528 landed as a squash, so the cache-management work this branch was stacked on arrived in main under different SHAs and every file the two had in common conflicted. The cache-management files take main's version: none of them were touched by the low-disk commits, and main's copies carry the fixes #10528 picked up after this branch split, including the chat-load and draining-repo guards in the model deletion path. The low-disk side is kept where it is the only change: the lowDisk strings in all twelve locales, the settings-dialog scroll target import in the Resources tab. The diff against main is now the low-disk notice alone, 24 files rather than 37.
The route redacted `path` when the caller arrived with an API key. A managed account reaches it by another door: its session JWT satisfies get_current_subject and leaves authenticated_via_api_key false, so the key test alone handed a non-owner the owner's home layout and the volume capacity behind it. That is the boundary the rest of Settings already draws. Resources is owner-only, and /settings/caches sits behind _owner_settings_router, so a reading about those same caches should not be the way around it. Redacted rather than refused. requestStart and the poll loop call this for whoever is downloading, owner or not, and the numbers are the part that caller needs; a 403 would turn every managed user's download into a failed request for no gain. account_context defaults to OWNER, so an install that never made a managed account takes the branch it took before. Two tests, and the second is the control: removing the guard fails the managed-account one and leaves the single-user one passing, so it cannot pass by redacting for everybody.
requestStart was described as the one funnel every download passes through, and it is not. Selecting an uncached model in Chat calls loadModel, and the backend fetches the repo inside that single request through _maybe_auto_download_model in routes/inference.py. No download job is created, so neither requestStart nor the poll loop's finalize ever runs for it. That left the mount reading as the only thing standing between a user and a full disk: open Studio with room, pull a model larger than the space left, and nothing says a word until the next Hub operation. It is the case the notice exists for. The check goes in chat-api's loadModel rather than the Chat call site, because that function is the funnel for every runtime that loads a model, including the rollback path. Before the request, throttled, so picking through several models costs one reading. After it in a finally, forced, for the reason finalize is forced: the reading has to be taken after the write. finally rather than after the await because a load that FAILED is the likeliest one to have filled the disk on the way, and saying so is most of the answer to why it failed. Never awaited, so a reading cannot gate or delay a load. The two tests that load chat-api through the stub harness need the new import declared; that harness fails closed on an unstubbed import, which is how this was caught.
test_no_raw_pixel_text_utilities fails on main, not only here: the cache row's path label was written as text-[11px], and a raw px text utility ignores --ui-font-scale, so the one line naming the directory stayed 11px for a user who had turned the interface size up. --text-ui-11 is the same 0.6875rem through the scale variable, so the default rendering is unchanged and the preference now reaches it. Fixed here because this branch cannot go green while main is red on a test that reads every frontend source, and the file is the Storage section this PR's toast links into.
Two ways the notice could go quiet for the rest of a session while looking healthy. The read had no timeout and no abort signal. inFlight is the only slot, so a fetch that never settles, or a body that never finishes reading, holds it for the life of the page: every later check either queues behind it or is handed it. The warning then stops for the session, and a feature whose whole job is to report a problem cannot report that one. Bounded at 10 seconds, three orders above a route that answers in microseconds, disposed in a finally because that helper's contract says abort listeners pile up otherwise. A timeout lands in the same catch as every other failure, so it reads as "could not tell", never as a full disk. The notifier was called unguarded. observeDiskPressure has already recorded the crossing by then, so a notifier that threw lost the warning and rejected a promise nobody awaits, as an unhandled rejection. Caught, for the reason a failed reading is swallowed: a toast that could not be shown is not something to fail a download over. Both tests are proven non-vacuous by removing the guard they cover and watching only that test fail.
The third way bytes reach the cache, and the largest. Both start-fresh-training-run and resume-training-run call startTraining directly, and the worker it starts then pulls the base model itself through FastLanguageModel.from_pretrained in core/training/trainer.py, plus any remote dataset, passing neither requestStart nor loadModel. A run begun with room, on a machine that then fills up, warned nobody. The two halves are NOT symmetric here, which is the part worth reading. startTraining gets the pre-run reading only. Its download happens asynchronously in the worker, long after that request returns, so a forced reading in a finally would describe the disk as it was before any of those bytes landed and would read as reassurance rather than as a warning. The post-download reading therefore lives in useTrainingCompletionWatch, in the cleanup that runs when the run leaves the active state. That fires whether the run finished or failed, and a run that died because the disk filled is precisely the one worth reporting on. Neither is awaited, so no reading can gate or delay a run.
|
@codex review |
1 similar comment
|
@codex review |
|
Codex Review: Didn't find any major issues. Swish! 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". |
|
@codex review |
1 similar comment
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 50a8bc8c4d
ℹ️ 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".
| for candidate in chain: | ||
| try: | ||
| return candidate, os.stat(candidate).st_dev |
There was a problem hiding this comment.
Bound server-side filesystem probes
When either cache is on an unresponsive network filesystem, os.stat (and likewise the following shutil.disk_usage) can block indefinitely inside FastAPI's worker thread. The 10-second browser abort only abandons the HTTP request; it does not stop this synchronous server work, so later mount/download/completion checks can leave additional workers stuck until the thread pool is exhausted, at which point unrelated synchronous endpoints also stall. Run these probes behind a server-side isolation mechanism that can actually be terminated or otherwise prevent repeated checks from accumulating while a probe remains stuck.
Useful? React with 👍 / 👎.
Frontend build + bundle sanity is red on main: 8458 pass, 3 fail, all in tool-approval-gone.test.ts, each on no stub for import "@/features/settings/low-disk-check" in chat-api.ts Neither PR involved is wrong. unslothai#11439 added the import to chat-api.ts at 06:08 and updated every harness that existed then. unslothai#10365 landed at 08:15 with a new harness written against a chat-api.ts that did not have the import yet, so it passed on its own base and failed once the two met on main. Stub it the way the sibling harnesses already do. The whole frontend suite goes 8465 pass, 0 fail.
…nslothai#11439) * Studio: show what the caches cost and let them be cleared Unsloth's caches are what make an update or a second run fast, so they are worth keeping and worth being able to see. On a working box they are also the largest thing on disk that is safe to delete: uv's wheel cache alone reaches tens of gigabytes, and nothing in Studio said so or offered to reclaim it. Settings > Resources > Storage now lists every cache with its size and a total, and can empty them. Sizes are memoised for 60 seconds with a Recheck button, because a cold walk over a large uv cache and a triton cache of tens of thousands of files takes tens of seconds. Only caches are ever removed. The API takes a cache KEY, never a path, so a caller cannot name a directory to delete; the roots are computed in the backend from the same resolvers the rest of Studio uses. Each root is then checked before anything is unlinked: absolute, not a symlink, at least two components below the filesystem anchor, and neither inside nor containing a protected path (the Studio home, studio.db, auth, projects, models, datasets, outputs, exports, the Hugging Face cache home that holds the token, or a managed asset home such as DATA_DESIGNER_HOME). The root is emptied rather than removed, a symlink inside it is unlinked instead of followed, and a directory whose real path leaves the root is skipped. Three caches are opt-in and are never swept up by the bulk clear. The Hugging Face hub and dataset caches cost a re-download of something the user asked for. The unsloth compiled cache is excluded for a different reason: a training or inference worker imports generated modules from it lazily, long after the job started, and the existing lock only serialises against a sibling backend, not against a spawned worker. Clearing it under a running job would forfeit hours of compute, which is not a trade to make from a button labelled free up space. When free disk crosses 20 GB, or 5 GB for the stronger warning, a toast offers the caches as the thing to trim and links to that section. It is mounted at the app level rather than inside Settings, since a warning shown only to someone already looking at the disk figure reaches the people who least need it, and it adds no polling: it subscribes to the system poll the app already runs. The level is held for the browser session so a threshold is announced when it is crossed, not once per poll while the disk sits below it. * Fix six defects the review found, including a toast that could not fire The low-disk notice never worked. Its own comment claimed it subscribed to the system poll the app already runs; there is no such poll. subscribeSystemInfo only adds a callback to a Set, and the only two callers of the fetching hook are the floating monitor and the resources tab, both lazily mounted and both gated on being open. So the warning reached nobody who had not already opened the one screen that shows the disk figure, which is the audience it exists to reach. It now owns a 60 second poll and says so. The test that was supposed to cover this asserted the opposite, requiring the subscribe form and BANNING the fetching one, so it passed for as long as the feature was broken; it now asserts the fetch. It was also mounted in StudioPage, which is the /studio training route rather than an app shell, so anyone in Chat, Images or Audio never subscribed at all. It moves to RootLayout beside the other null-returning mounts. An opt-in cache nested inside another cache root was deleted by a bulk clear of the parent, because opt-in roots were in neither the protected paths nor the protected trees. That defeats the whole point of marking the model, dataset and compiled caches opt-in, so a root that contains one is now refused with that reason, except when it is the cache being asked for by name. On Windows a directory junction is not reported by Path.is_symlink but is followed by realpath, so a junction cache root had its target emptied. Junctions are now refused like symlinks, and skipped when measuring so a row cannot advertise bytes it will not delete. An explicit HF_HUB_CACHE whose basename is not hub made the displayed cache home and the hub directory the same path, so the model cache was permanently unclearable and the UI called it a protected location when it held no credential. The token lives under HF_HOME, which stays protected. The cache rows measured once per mount, so changing the models folder left them showing the previous folder's path and size beside a field showing the new one, with a Clear that acted on the new one. They now follow the inventory version. The hub confirmation dialog concatenated its cost line with the generic assurance that downloaded models are not touched, which denied the deletion it was asking permission for. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Fix ten defects the review found, including a clear enabled mid-measure * Shelter pattern-limited roots, purge only the active cache home, ask pip * Resolve the HF child caches from the real home, not the displayed one * Name the encoding on the pip cache-dir probe * Point the matplotlib, CUDA, numba and pip resolvers at the real defaults * Protect the studio bin directory, follow npmrc, clear on entries not bytes * Report the recorded uv cache, protect the temp workspace, serialize the probes * Refuse a purge under an active download and protect a configured token path * Reserve the download registries for a purge and follow the real HF_HOME * Cut the comments back to the facts that are load-bearing * Reserve the xet cache and exclude a repository delete from a whole-cache purge * Hold the model caches while training runs, and name the toast's unit * Count diffusion runs, gate the compiled cache row, and honour a forced recheck * Ask the disk when a download starts, instead of polling it forever The low-disk notice ran useSystemInfo({ pollMs: 60_000 }) from the app shell, so every open tab hit /api/system every minute for as long as Studio was open. That route enumerates GPUs, reads package metadata and samples CPU. It is the right route for a screen someone is looking at, and far too much to run on the chance that a disk is filling. A disk fills because something writes to it, and in Studio that is nearly always a download. So the reading is taken where the bytes are about to be requested: requestStart is the single funnel every download passes through. Plus one reading when the shell mounts, for the disk that was already full before the user did anything. No interval anywhere. New route /api/system/disk, which is one shutil.disk_usage and nothing else: statvfs on Linux and macOS, GetDiskFreeSpaceExW on Windows. Measured here at 6.4 us median, 17.1 us p99 over 2000 calls, against 5 GB of GPU enumeration and metadata reads on the route it replaces. The per-platform numbers are measured in CI rather than assumed, since those are three different syscalls. It reports the volume the models land on, not the filesystem root: those differ whenever HF_HUB_CACHE or the Studio root sits on another disk, and the free space that matters is the one the download is going to. A cache directory that does not exist yet resolves to its first existing ancestor, since disk_usage raises rather than reporting the volume. An unreadable host answers null, not zero. diskPressure() reads a zero total as the probe having failed and a zero free as a full disk, so zeros there would warn every user on a platform where the probe does not work. The check never gates a download: not awaited, and a failed reading is dropped rather than surfaced. It throttles itself, so a page that starts several downloads at once makes one request. The route is held to its cost by AST rather than by grep: a comment explaining why psutil is absent must not fail a check for psutil, which is exactly the trap the first version of that guard fell into. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Ask the configured models volume, and forget its sizes when it moves hf_default_cache_dir() is documented to ignore HF_HUB_CACHE and the Models Folder setting, so on a machine that moved its downloads to another disk /api/system/disk reported the free space of a volume the next download will not touch. Its home ancestor always exists, so the fallback never reached studio_root() either. The active hub cache is asked first now, at the cost of one SQLite setting read. The inventory memo is keyed by cache rather than by path, so changing the Models Folder left hf_hub, hf_xet and hf_datasets describing the old root for the rest of the TTL. A browser hides that by forcing a refresh off the inventory-version event, but an API-key caller may change the folder and read the inventory while being forbidden refresh=true, so it had no way to ask again. set_hf_cache_home now invalidates those three alongside the scans it already invalidated. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Four ways the cache page could take or promise more than it should Emptying the whole hub cache skipped the inference load-state guards that deleting ONE repo already runs, which made the wider action the one with the weaker check. sd.cpp re-reads its companion VAE and text-encoder files for every generation, so this broke a model loaded long before the clear, not only one mid-load. A repo-agnostic guard sits beside the per-repo ones and is asked for the model-cache keys, failing closed when it cannot answer, as the per-repo path does with its 503. The uv cache is refused when the installed environment is linked into it rather than copied from it. uv's own help says clearing under UV_LINK_MODE=symlink will break all installed packages, which turns a bulk clear from a re-download into a broken install. Two cheap answers, no walk: the declared link mode, and a top-level symlink in this interpreter's site-packages resolving into a uv root. Reclaimable bytes are now counted per inode rather than per name. uv's default link mode on Windows is hardlink, so an installed environment's files ARE links into the cache and unlinking the cache copy frees nothing; counting them anyway overstated both the row and the freed_bytes toast by the size of the installed packages. A multi-link inode counts only once the number of links seen inside the roots being measured reaches st_nlink, so anything linked from outside is left out. Understating beats promising space that unlinking will not return. And the download that used the space now reports it. requestStart reads the disk before a download, which is the right moment to refuse one, but a download that starts with room and then eats it crossed the threshold with nobody looking: there is no interval, so the warning waited for the next download attempt. * Three more: a stale post-download reading, an overstated partial purge, an unguarded import The completion reading is forced. Unforced it was swallowed by the 30 second interval for any download shorter than that, and when the pre-start request was still in flight it was handed that request's answer, which is the figure measured before the download wrote anything and precisely the one it exists to correct. A forced caller now chains behind an in-flight request rather than sharing it, with at most one waiting, so a queue of files finishing together costs two readings. A partial purge reports only what it actually removed. rmtree can delete some children and then hit a permission error or a file that moved under it, and the whole subtree was already in the ledger, so freed_bytes claimed bytes still on disk. What survives is walked into a second ledger and subtracted. The curated dataset import holds the datasets registry across its fetch. Both loaders call load_dataset and snapshot_download directly, so it was neither a managed download nor a training run and claimed nothing: a Clear of hf_hub, hf_xet or hf_datasets passed every guard and could take the snapshot out from under the copy. claim_repository_owner is the same reservation a managed download takes and excludes a purge in both directions; it is released in a finally, and a clear already running answers 409 rather than racing it. * Make the two cache files a fixed point of the formatting hook again The last two commits left cache_inventory.py and test_cache_inventory.py in a shape ruff-format-with-kwargs rewrites, which fails pre-commit.ci and tests/test_formatter_fixed_point.py inside Repo tests (CPU). Both red checks on this branch are that one cause. Output of scripts/run_ruff_format.py with the pinned ruff 0.6.9; three collapsed line wraps, no behaviour change. * Ask dictation too before emptying the whole Hugging Face cache any_model_load_blocks_cache_clear consults llama.cpp, the inference orchestrator, Images and Video, but not the dictation sidecars, and those are the fifth backend reading out of the cache this clear empties: stt_sidecar._find_complete_cached_snapshot resolves through _repo_cache_dir into hub_cache, so a resident Whisper or Parakeet worker re-reading its snapshot is exactly the case the docstring says is enough on its own. stt_registry.resident() already reports both loaded and loading, so this is the same question the other four are asked, asked once more. Fail open on acquire like the rest: a sidecar that cannot be reached is not holding anything this process can see, and cache_inventory still fails closed on a guard that raises. Four tests. The two positive ones fail with this hunk reverted; the idle and unreachable controls are there so they cannot pass against a guard that has simply started refusing everything. * Split the low-disk notice out into its own change This PR was doing two separable things. Measuring and clearing caches is one feature; warning that the disk is filling up is another, and the second does not import a line of the first. The only thing joining them was the deep-link string "resources-caches", which is navigation, not a dependency. So the notice goes to a follow-up, and with it everything that existed only to serve it: low-disk.ts, low-disk-check.ts, use-low-disk-notice.ts, the RootLayout mount, the two download-manager call sites, GET /api/system/disk and its AST/budget tests, the toast's frontend tests, and the lowDisk strings in all twelve locales. The deep-link machinery goes with it rather than staying here unused: the SettingsSection ref, the resources-caches scroll target, and the scroll effect in ResourcesTab. What is left is one coherent thing: show what the caches cost, and let them be cleared. 6214 insertions over 37 files becomes 5214 over 26. The follow-up is stacked on this branch, so the Storage section it links into already exists when it lands. studio/backend tests/test_cache_inventory.py, tests/test_api_cache_routes.py and hub/tests: 796 passed. i18n:check:strict: all twelve locale overlays pass parity. The frontend unit tests could not run in this workspace (no node_modules, so tests/helpers/module-stubs.ts cannot import typescript); they run on the staging legs. * Studio: warn when the disk is running low, and point at the caches Split out of the cache-inventory change, which was doing two separable things. This is the second: the disk filling up is worth saying out loud, and the caches are the thing to offer when it does. A toast at 20 GB free, and a stronger one at 5 GB. It is mounted in the app shell rather than inside Settings, because a warning shown only to someone already looking at the disk figure reaches the people who least need it. The notified level is held for the browser session, so a threshold is announced when it is CROSSED, not once per poll while the disk sits below it, and recovering out of critical does not disarm the low warning until free space clears low's own re-arm point. Nothing polls on a timer. The reading is taken once when the shell mounts, so a machine that is already full says so before the user picks anything, and once at the start of a download, which is the moment the answer decides something. A 30 second floor coalesces bursts and concurrent callers share one in-flight request. GET /api/system/disk is one shutil.disk_usage against the volume holding the model cache: statvfs on Linux and macOS, GetDiskFreeSpaceExW on Windows. No directory walk, no recursive sizing, no psutil. A test asserts a 5 ms budget and a second parses the route's AST and fails the build if walk, scandir, rglob, iterdir, glob or psutil ever appear in it. If the cache directory does not exist yet the route walks up to the nearest existing parent rather than failing, and an unreadable volume returns null, not 0, so it cannot be mistaken for a full one and block a download. The deep link into Settings > Resources > Storage comes with it: the SettingsSection ref, the resources-caches scroll target and the scroll effect in ResourcesTab exist only to serve this toast. Stacked on studio-cache-management, so the Storage section this links into already exists. * Measure the Xet volume too, and report the tighter of the two HF_XET_CACHE is resolved independently of HF_HUB_CACHE (hf_cache_settings reads it separately and falls back to <home>/xet only when it is unset), and since the Hub moved to Xet every download streams its chunks through that cache. So the two roots can sit on different volumes, and reading only the hub one let an Xet download exhaust its own disk while this route kept reporting ample space. That is the single answer the endpoint exists to get right. Both roots are read now and the TIGHTEST reading wins, because the volume that runs out first is the one that stops the download. Readings are deduplicated by st_dev, so the ordinary install with both on one disk still costs a single disk_usage call rather than paying two everywhere to help the rare split install. A device that cannot be stat'ed is not treated as proof of a shared volume, so those readings are kept rather than collapsed. Per https://huggingface.co/docs/huggingface_hub/en/package_reference/environment_variables: HF_XET_CACHE configures "where Xet chunks (byte ranges from files managed by Xet backend) are cached locally", defaulting to $HF_HOME/xet, independently of HF_HUB_CACHE. Two tests, both of which fail with this hunk reverted: the split-volume case asserts the full Xet volume is reported rather than the roomy hub one, and the shared-volume control asserts one reading per root so the dedup claim above is not just a comment. 8 passed. * Keep the host path off an API key, and the notice off managed accounts Two from review, both about who is on the other end of this feature. The reading no longer hands out a raw host path to an API key. get_current_subject accepts an sk-unsloth key, and `path` is the first existing cache ancestor, which names the service account and its home layout. hub/utils/host_paths already draws exactly this boundary for the Hub inventory routes, so the route sits behind redact_host_paths now rather than inventing a second rule. A UI session still gets the path, which is how a user tells WHICH volume the reading is about, and the capacity fields the low-disk client actually uses survive either way. The toast is owner only. The shell mounts it for every authenticated user, but "resources" is in OWNER_ONLY_SETTINGS_TABS and resolveSettingsTab sends a managed account to General, so "Review caches" was a button that landed somewhere else. There is no destination to offer instead: the caches are install-wide state a managed account cannot clear. So the notifier is not registered at all rather than shown with its action removed, since a warning nobody can act on is worse than no warning. Three tests, each failing with its own hunk reverted: an API-key caller gets no path, a UI session still does, and the hook asks useIsAccountOwner before registering. The last one also asserts resources is still owner-only, so if that ever changes the gate is revisited rather than silently outliving its reason. test_system_disk_route.py + test_cache_inventory.py: 102 passed. low-disk-cache-notice.test.ts: 19 passed. i18n:check:strict parity clean. * Actually redact the path, and stop spending a crossing nobody heard The first of these is a correction. The previous commit claimed to keep the host path off an API key and did not: redact_host_paths runs _redact with redact_ambiguous_path=False, so a field literally named "path" is left exactly as it was, and only redact_inventory_host_paths treats that generic name as a host path. Checked against the real helpers this time rather than assumed: redact_host_paths({"path": "/home/service-account/.cache/..."} , via_api_key=True) -> {'path': '/home/service-account/.cache/...'} redact_inventory_host_paths(same) -> {'path': ''} The test did not catch it because it stubbed the redactor with the behaviour I expected instead of importing the one that ships, which is the whole reason it passed against a route that was still handing the path out. It imports the real redact_inventory_host_paths now, so it can fail, and it does fail against the previous commit. Second, a reading taken with no notifier registered no longer consumes the crossing. observeDiskPressure RECORDS the level it returns, and runCheck called it before checking the callback, so a managed account's download, or a reading landing after logout, marked the disk as already warned about. An owner signing in later in the same session would then hear nothing until free space recovered past the re-arm margin. The notifier is checked first now. That one is asserted on the source, not by driving the module: low-disk-check.ts imports through the "@/" alias and the bare node runner cannot resolve it. The assertion is on the ORDER of the two statements, so it fails on the old code. test_system_disk_route.py: 10 passed. low-disk-cache-notice.test.ts: 20 passed. i18n:check:strict parity clean. * Tell missing from unreadable, and dedupe the volume before reading it Two from review, and the second one exposes a test that was asserting the opposite of its own name. An unreadable cache no longer reports its parent's free space. The climb to the nearest existing ancestor exists because a cache directory legitimately does not exist yet on a fresh install. A permission error, an I/O error or a network mount that is not answering is a different thing, and climbing past it reported the parent filesystem's room for a disk nothing could read, suppressing the warning with a confidently wrong number. Only FileNotFoundError and NotADirectoryError climb now; anything else leaves that root unreadable, which is the same reason the route already returns null rather than zero for a host it cannot read. And the volume is resolved before it is read. Deduplicating after the reading still paid one disk_usage per ROOT, so the ordinary install with hub and xet on one disk did two probes to answer about one volume: the opposite of what the docstring promises, and most expensive on exactly the network mounts this is careful about. os.stat gives both the existence check and the device, so the dedupe now happens before any disk_usage. test_one_volume_is_read_once asserted len(calls) == 2 under that name. It asserts 1 now, which is what it always meant, and it fails against the previous commit. The unreadable-volume test denies both os.stat and disk_usage, because the old and new code fail at different calls and denying only os.stat left it passing against the bug it was written for. test_system_disk_route.py: 11 passed. * An unreadable destination makes the whole reading unknown Follow-on to the previous commit, and the same mistake one level up. Marking an unreadable root as unreadable was only half of it: the loop then skipped it and let the other root answer. Hub and Xet can sit on different volumes, so an unavailable network-mounted hub cache beside a local Xet cache returned the Xet volume's free space, which is a confident number about a disk the download is not filling. With both failing it could fall back further still, to the default cache or the filesystem root. Any active destination that cannot be read now makes the answer unknown: nulls for every field, which the client already treats as neither a warning nor a block. That is the same contract the route uses for a host it cannot read at all, applied to the case where it can read some of it. One test, failing against the previous commit: an unreadable hub beside a readable Xet reports null rather than Xet's free space. test_system_disk_route.py: 12 passed. * Trim the comments on the low-disk modules Post-convergence pass. 71 comment lines out, 24 in, across the three files this change owns: use-low-disk-notice 42 to 22 percent, low-disk-check 39 to 24, low-disk 27 to 20. What went: the history of the 60 second /api/system poll this replaced, which belongs in the PR description rather than three files; restatements of the code underneath; and paragraphs saying once per line what fits on one. What stayed: the invariants a reader cannot recover from the code. Announce on crossing and re-arm past the margin. Absolute thresholds, because a percentage nags on a 4 TB disk with 400 GB free. A zero total is a failed reading, not a full disk. Ask before observing, or the crossing is spent unheard. Owner only, because resolveSettingsTab would send a managed account to General. comment_tools.py check: 3/3 code unchanged. low-disk-cache-notice.test.ts: 20 passed. * Keep the host path off a managed account too, not just an API key The route redacted `path` when the caller arrived with an API key. A managed account reaches it by another door: its session JWT satisfies get_current_subject and leaves authenticated_via_api_key false, so the key test alone handed a non-owner the owner's home layout and the volume capacity behind it. That is the boundary the rest of Settings already draws. Resources is owner-only, and /settings/caches sits behind _owner_settings_router, so a reading about those same caches should not be the way around it. Redacted rather than refused. requestStart and the poll loop call this for whoever is downloading, owner or not, and the numbers are the part that caller needs; a 403 would turn every managed user's download into a failed request for no gain. account_context defaults to OWNER, so an install that never made a managed account takes the branch it took before. Two tests, and the second is the control: removing the guard fails the managed-account one and leaves the single-user one passing, so it cannot pass by redacting for everybody. * Ask the disk on a model load too, not only on a Hub download requestStart was described as the one funnel every download passes through, and it is not. Selecting an uncached model in Chat calls loadModel, and the backend fetches the repo inside that single request through _maybe_auto_download_model in routes/inference.py. No download job is created, so neither requestStart nor the poll loop's finalize ever runs for it. That left the mount reading as the only thing standing between a user and a full disk: open Studio with room, pull a model larger than the space left, and nothing says a word until the next Hub operation. It is the case the notice exists for. The check goes in chat-api's loadModel rather than the Chat call site, because that function is the funnel for every runtime that loads a model, including the rollback path. Before the request, throttled, so picking through several models costs one reading. After it in a finally, forced, for the reason finalize is forced: the reading has to be taken after the write. finally rather than after the await because a load that FAILED is the likeliest one to have filled the disk on the way, and saying so is most of the answer to why it failed. Never awaited, so a reading cannot gate or delay a load. The two tests that load chat-api through the stub harness need the new import declared; that harness fails closed on an unstubbed import, which is how this was caught. * Scale the cache path text with the UI font size preference test_no_raw_pixel_text_utilities fails on main, not only here: the cache row's path label was written as text-[11px], and a raw px text utility ignores --ui-font-scale, so the one line naming the directory stayed 11px for a user who had turned the interface size up. --text-ui-11 is the same 0.6875rem through the scale variable, so the default rendering is unchanged and the preference now reaches it. Fixed here because this branch cannot go green while main is red on a test that reads every frontend source, and the file is the Storage section this PR's toast links into. * Bound the disk read, and let a failed toast fail alone Two ways the notice could go quiet for the rest of a session while looking healthy. The read had no timeout and no abort signal. inFlight is the only slot, so a fetch that never settles, or a body that never finishes reading, holds it for the life of the page: every later check either queues behind it or is handed it. The warning then stops for the session, and a feature whose whole job is to report a problem cannot report that one. Bounded at 10 seconds, three orders above a route that answers in microseconds, disposed in a finally because that helper's contract says abort listeners pile up otherwise. A timeout lands in the same catch as every other failure, so it reads as "could not tell", never as a full disk. The notifier was called unguarded. observeDiskPressure has already recorded the crossing by then, so a notifier that threw lost the warning and rejected a promise nobody awaits, as an unhandled rejection. Caught, for the reason a failed reading is swallowed: a toast that could not be shown is not something to fail a download over. Both tests are proven non-vacuous by removing the guard they cover and watching only that test fail. * Ask the disk around a training run too, on both sides of its download The third way bytes reach the cache, and the largest. Both start-fresh-training-run and resume-training-run call startTraining directly, and the worker it starts then pulls the base model itself through FastLanguageModel.from_pretrained in core/training/trainer.py, plus any remote dataset, passing neither requestStart nor loadModel. A run begun with room, on a machine that then fills up, warned nobody. The two halves are NOT symmetric here, which is the part worth reading. startTraining gets the pre-run reading only. Its download happens asynchronously in the worker, long after that request returns, so a forced reading in a finally would describe the disk as it was before any of those bytes landed and would read as reassurance rather than as a warning. The post-download reading therefore lives in useTrainingCompletionWatch, in the cleanup that runs when the run leaves the active state. That fires whether the run finished or failed, and a run that died because the disk filled is precisely the one worth reporting on. Neither is awaited, so no reading can gate or delay a run. --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: oobabooga <[email protected]> Co-authored-by: danielhanchen <[email protected]>
Frontend build + bundle sanity is red on main: 8458 pass, 3 fail, all in tool-approval-gone.test.ts, each on no stub for import "@/features/settings/low-disk-check" in chat-api.ts Neither PR involved is wrong. unslothai#11439 added the import to chat-api.ts at 06:08 and updated every harness that existed then. unslothai#10365 landed at 08:15 with a new harness written against a chat-api.ts that did not have the import yet, so it passed on its own base and failed once the two met on main. Stub it the way the sibling harnesses already do. The whole frontend suite goes 8465 pass, 0 fail.
Split out of #10528, which was doing two separable things. Measuring and clearing caches is one feature; warning that the disk is filling up is another. Neither imports a line of the other, and the only thing joining them was the deep-link string
resources-caches, which is navigation rather than a dependency.Stacked on
studio-cache-management, so the Storage section this links into already exists when it lands. Retarget tomainonce #10528 merges.What this adds
A toast at 20 GB free, and a stronger one at 5 GB.
It is mounted in the app shell (
RootLayout), not inside Settings and not on a single route. A warning shown only to someone already looking at the disk figure reaches the people who least need it.The notified level is held for the browser session, so a threshold is announced when it is crossed, not once per poll while the disk sits below it, and recovering out of critical does not disarm the low warning until free space clears low's own re-arm point.
Nothing polls on a timer
The reading is taken twice, both times because the answer decides something:
requestStart.A 30 second floor coalesces bursts (queueing eight files asks once), and concurrent callers share one in-flight request.
The reading itself
GET /api/system/diskdoes exactly oneshutil.disk_usageagainst the volume holding the model cache:statvfson Linux and macOS,GetDiskFreeSpaceExWon Windows, which also reports the calling user's quota rather than the raw volume when one is set. No directory walk, no recursive sizing, nopsutil.That is deliberately not what WinDirStat does. WinDirStat answers "what is using my space", which needs a full tree walk and takes seconds on a large volume. The question here is "is there room for this download", which is a single free-space syscall.
Measured on GitHub-hosted runners, 1000 calls each:
Windows is the slowest and is still about 300x under the 5 ms budget the test enforces. A test asserts that budget, and a second one parses the route's AST and fails the build if
walk,scandir,rglob,iterdir,globorpsutilever appear in it.Two behaviours worth naming: if the cache directory does not exist yet the route walks up its parents to the nearest existing one rather than failing, and a failed reading returns
null, not0, so an unreadable volume cannot be mistaken for a full one and block a download.The deep link comes with it
The
SettingsSectionref, theresources-cachesscroll target and the scroll effect inResourcesTabexist only to serve this toast, so they move here rather than sitting unused in #10528.Testing
test_system_disk_route.py, 6 passed.i18n:check:strict: all twelve locale overlays pass parity.low-disk-cache-notice.test.tsruns on CI; it cannot run in a checkout withoutnode_modules, sincetests/helpers/module-stubs.tsimportstypescript.Before and after
Two isolated installs, one Playwright scene driven identically against both. BEFORE is this PR's merge base, the head of #10528, AFTER is this branch, same host, adjacent ports. The shot is taken on
/chat, an ordinary route, because that is the claim: the notice is mounted in the app shell, so it reaches someone who never opened Settings.Read from the same servers that were photographed:
GET /api/system/disk/chat12.4 GB free of 30397 GB. Clearing caches can free space.How the toast was made to fire, and what that costs the evidence
This box has about 7958 GB free and the thresholds in
low-disk.tsare absolute, 20 GB and 5 GB. The scene installs a route handler on/api/system/diskthat fetches the real response from the Studio being photographed and rewrites onlyfree_gbto 12.4, so the total on screen is this machine's own and everything downstream of that number is shipped code.The same stub, with the same number, is installed on both halves. On the BEFORE side the route does not exist, so it never fires and no toast appears, which is the difference being photographed rather than a stub that was only applied once. The recorded interception confirms it:
[]on BEFORE, onestatus: 200rewrite on AFTER.The pointer is parked over the toast, because sonner dismisses after 5000 ms and a shot taken a moment late is indistinguishable from one where the toast never fired.
One difference in the picture is not this PR:
/chatrandomises its greeting, which is why BEFORE reads "How can I help?" and AFTER "Good to see you". Everything else on the two halves, sidebar, composer and Recents, is identical.Before and after, re-shot on the current head
The pair above was taken when this branch was still stacked on #10528. That PR has since merged, this branch has been merged with main twice, and three more commits have landed here, so the evidence was re-taken from scratch against the current merge base.
Two isolated installs built by the PR's own
install.sh --local, BEFORE at merge baseed1530922and AFTER at head4ea9694a3, same host, adjacent ports. Both halves are photographed on/chat, an ordinary route, because that is the claim being tested: the notice is mounted in the app shell, so it reaches someone who never opened Settings. A shot of the Resources tab would show the opposite of what this PR says.Read from the same two servers that were photographed:
ed1530922)4ea9694a3)GET /api/system/disk200,free_gb3631.81,total_gb30396.78free_gbthe page was given/chat12.4 GB free of 30397 GB. Clearing caches can free space.One correction to the table further up
That earlier table records
GET /api/system/diskas404on the before side. It is not: on the merge baselow-disk-check.tsdoes not exist, so nothing ever asks for the route and there is no request to answer. The recorded interceptions are[]on before, not a 404. The distinction matters because "the route answered 404" would mean the client shipped and the server did not, which is not what this PR's before state looks like.How the toast was made to fire, and what that costs the evidence
The thresholds in
low-disk.tsare absolute, 20 GB and 5 GB, and this volume has 3631.81 GB free, so the honest options were to fill a real disk or to rewrite one number. This rewrites one number.A fetch shim, installed as an init script so it is in place before any page script runs, passes
/api/system/diskthrough to the real server being photographed and rewritesfree_gbalone.total_gb,percent_usedandpathare that machine's own, and everything downstream of the number, the pressure decision, the crossing state, the wording and the action, is shipped code built from that side's tree. The30397 GBon screen is this host.The same shim with the same number is installed on both halves. On the before side there is no caller, so it records nothing, which is the difference being photographed rather than a stub applied only once. The scene refuses to produce an image if that is not what it observes: a side whose route answers 200 but which never asked, a rewrite without a toast, or a toast without a rewrite each raise instead of returning a clean looking pair.
The pointer is parked on the toast before it is read, because sonner dismisses on a timer and a shot taken a moment late is indistinguishable from one where the toast never fired.
One difference in the picture is not this PR:
/chatrandomises its greeting, which is why before reads "Good to see you" and after "How can I help?". Sidebar, composer and Recents are identical across the two halves.