Files
archived-orca/config/scripts/orcad-distribution/server-bundle
Brennan BensonandMax Hsu 3ceb785cb8 feat(settings): show how much space Codex chat history takes (#43894)
* feat(workspace-cleanup): show how much space Codex chats take

The Chat history setting can delete Codex chats from deleted workspaces,
but nothing showed how large that history had grown (#16776 saw 11 GB).
The row now says how much the host's Codex chats use, measured read-only
on a worker thread across every Codex home, counting each hard-linked
rollout once (set-aside copies included) and never reading through links.

Co-authored-by: Max Hsu <maxmilian@gmail.com>

* perf(workspace-cleanup): reuse the Codex history size walk and skip it while hidden

* fix(workspace-cleanup): never answer a read after a deletion with the earlier walk

Co-authored-by: Max Hsu <maxmilian@gmail.com>

* fix(workspace-cleanup): stream the Codex history walk, count merge folders, flag unreadable history

Co-authored-by: Max Hsu <maxmilian@gmail.com>

* perf(workspace-cleanup): async worker walk, ship it in the server bundle, skip hidden refreshes

Co-authored-by: Max Hsu <maxmilian@gmail.com>

* fix(workspace-cleanup): start the walk's time budget in the worker; walk with sync calls inside the worker entry

Co-authored-by: Max Hsu <maxmilian@gmail.com>

* fix(workspace-cleanup): budget the home listing and skip folders whose real path changed

Co-authored-by: Max Hsu <maxmilian@gmail.com>

* fix(workspace-cleanup): every walk step checks the deadline; count a folder only if it still resolves to itself

Co-authored-by: Max Hsu <maxmilian@gmail.com>

* perf(workspace-cleanup): stop a Codex history walk that a deletion made obsolete

Co-authored-by: Max Hsu <maxmilian@gmail.com>

* style: wrap reader types

* test(fixtures): show the Codex history size in the Workspace Cleanup fixture

* chore: format the walk test and list the new size keys as protected copy

* fix(settings): read the Codex history size only while settings search shows the row

Co-authored-by: Max Hsu <maxmilian@gmail.com>

* perf(settings): check Codex account ownership in the history worker, not on main

The main-blocking helper ratchet flagged the account ownership reads; main now
lists account folders asynchronously and the worker verifies them.

Co-authored-by: Max Hsu <maxmilian@gmail.com>

* perf(settings): size Codex history without session discovery's sync account check

Co-authored-by: Max Hsu <maxmilian@gmail.com>

* fix(settings): count relocated account homes and list each home once in the size walk

Co-authored-by: Max Hsu <maxmilian@gmail.com>

* fix(settings): keep the ownership loop where the blocking-helper ratchet allows it; fix types

Co-authored-by: Max Hsu <maxmilian@gmail.com>

* fix(settings): keep a folder's counted rollouts when the size budget runs out; flag skipped folders

Co-authored-by: Max Hsu <maxmilian@gmail.com>

* perf(settings): stop the Codex history walk when the last settings view stops waiting

Each read names its view; a view that closes, hides or switches host before the size
arrives releases it, and the host stops the walk once no view waits.

Co-authored-by: Max Hsu <maxmilian@gmail.com>

* fix(settings): use the non-secure-context UUID and wait for a stopped walk's worker to exit

Co-authored-by: Max Hsu <maxmilian@gmail.com>

* fix(settings): release a size read when its window's connection closes; bound the wait for a stopped walk

A window that reloads, crashes or disconnects never sends its release, so each read
now registers against its connection and is released when that connection retires.
Waiting for a stopped walk's worker is capped and ends when the read is abandoned, so
a worker stuck on a hung mount can't hang every later read.

Co-authored-by: Max Hsu <maxmilian@gmail.com>

* test(settings): drop the typed-array cast in the connection-release test

* fix(settings): share one capped wait per stopping worker; skip it once the read is abandoned

Each retry no longer attaches a waiter to a worker stuck on a hung mount, and a read
released before its wait began returns at once.

Co-authored-by: Max Hsu <maxmilian@gmail.com>

* fix(settings): share one capped listing of Codex homes across size reads

Listing the account folders can't be cancelled, so reads abandoned while it stalls
each left one pending. Reads now share one listing and one wait for a stopped worker,
each capped at 10 s, and fail fast past the cap without attaching more waiters.

Co-authored-by: Max Hsu <maxmilian@gmail.com>

* feat(settings): show Codex history size as a badge beside Recommended

Brennan's review: the size belongs to Codex, and a sentence was wordy. The row now shows
'Codex history: <size>' (with '+' when the walk stopped early) as a muted badge; its
tooltip says the space is Codex's own history and that the setting frees only chats
from workspaces that no longer exist, so the number isn't read as what turning it on saves.

Co-authored-by: Max Hsu <maxmilian@gmail.com>

* test(settings): open the Codex history tooltip in its fixture with keyboard focus

* fix(settings): keep the Codex history badge on one line

---------

Co-authored-by: Max Hsu <maxmilian@gmail.com>
2026-11-18 10:24:10 -08:00
..