Repository navigation
Conversation
16986b0 to
83b14e1
Compare
|
Since this adds automatic thread deletion, I want to raise a need it touches. What I'm trying to achieve: delete old threads to keep Why it matters for me:
Why I can't cover it with a plugin today: Related: #3598 (undelete).
|
@patleeman tracking your feedback here: #4714 - I'm curious what you'd find useful in the snapshot / feel free to comment on the issue to clarify anything I missed |
2922da2 to
b9e4b93
Compare
9806ea0 to
859ddc9
Compare
f690eef to
7088e28
Compare
Drop the duplicated page header, show machine online status and a usage summary per machine, replace day inputs with preset selects, and surface pinned-thread protection as a banner. Scans now record the free and total bytes of the thread-storage volume. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Largest threads render as single-line rows with archived and running pills. Machine rows follow Settings → Machines: server pill, status, and per-machine thread counts that need no scan. Drop the retention footer when there is nothing to report. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Thread counts come from the scan, the only source that can attribute storage to a machine: most archived threads no longer reference an environment, so environment-based counts undercount them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The panel owns the data and machine pages read their report from the host list, so moving between the list and a machine renders instantly. The first load shows nothing for 200 ms, then a page-shaped skeleton. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add Scan all and per-machine scan buttons to the machine list, a banner that clears storage of archived threads across scanned online machines, and an archived row in each machine's cleanup list. Pinned and running threads are skipped. Host discard now takes batches of entries. The CLI gains clear-archived and usage --rescan without --machine. Use the new DatabaseRestore icon for the plugin. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Clear-archived now targets archived threads holding 100 MB or more, which on real machines covers about 99% of archived bytes while touching a few dozen threads instead of thousands. Reports carry the exact clearable count and size, and the banner moves to the top of the page with copy that says only thread-storage files go and conversations stay. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Scans now find files of 10 MB or more in thread storage. When archived, unpinned threads hold 1 GB or more of them, the Storage page suggests deleting just those files, keeping smaller files like reports and every conversation. Replaces whole-folder clearing of archived threads; the CLI command becomes clear-large-files. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Both passes stat every file in thread storage and are kernel-bound, so running them side by side cuts a 5.5M-file scan from about 3.5 to about 2 minutes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The scan now runs du -a once and streams its output, recording files at or above the threshold while summing directory sizes, instead of a separate find walk over the same files. The walker fallback records them too, and deleting large files reuses the same measurement. A scan of 5.5M files costs one du pass again. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Bundled plugins added after #4576 must use a bb-- id. Rename the package to bb-plugin-bb--storage-retention so the plugin id is bb--storage-retention; the directory and builtin:storage-retention source stay. The plugin has not shipped, so no migration is needed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ervers Dev servers keep running after their checkout is deleted (for example when a thread's storage is cleared), so removal first stops every process whose command line runs from the missing checkout. The host re-verifies each checkout is missing before deleting and skips entries whose processes survive. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Clearing a thread's files renamed the folder to trash and deleted it while dev servers started inside it kept running from the trash path. Discard now stops processes whose working directory is inside each folder first, using the same SDK helper as worktree removal. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…sweep Removing a development instance now uses experimental_killProcessesWithCwdUnder for each missing checkout instead of a plugin-owned ps/PowerShell command-line matcher and kill loop. The core sweep now resolves the nearest existing ancestor of a deleted directory, so a removed checkout under a symlinked path such as /tmp still matches the canonical working directory the OS reports. The Windows dev-instance test timed out listing processes through PowerShell; the cwd sweep is a no-op on Windows, so the test is skipped there like the thread-storage process test. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The largest-threads toggle sat outside its card, and the development storage toggle expanded every section at once from below the last one. Each list now previews five rows and ends with its own Show N more / Show fewer control inside the card, so each development section expands independently. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Rows whose source checkout is missing offer Remove instance… in their menu, confirmed inline under the row. removeMissingDevInstances takes names (null for every missing instance) and rejects names the last scan did not mark missing; the host still re-verifies each checkout before stopping servers and removing. bb storage remove-dev-instances gains --instance NAME. Rows whose checkout exists or whose source is unidentified get no remove action. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Pills sat in a flex column beside the title, so a wrapped title left them floating at the right edge. Thread titles in the largest-threads list and the development card now share one ThreadTitle that renders pills inline after the title text, and the development card uses the same archived pill instead of plain text. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Clean up rows share one CleanupRow and a SectionHeading, and the bulk development-instance removal moves there from a banner inside the dev card. - Largest-thread rows match development rows: title with inline pills, size and a three-dot menu (Open thread, Clear files) on the right at every width. Clearing still starts immediately; progress and errors show under the title. - Linked threads of one development entry stack one per line, group counts drop the double gap, and pills or size badges that wrap no longer indent. - Scan times read "Scanned 3d ago" everywhere with the exact time on hover, and machine rows say "26.4 GB in 222 dev instances" like the thread total. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Some ~/.bb-dev entries are symlinks into thread storage or temp folders. Removal rejected any non-directory entry, so one symlink aborted the whole batch with "Development instance must be a directory, not a symbolic link". A symlinked entry is now unlinked, keeping the folder it points to, and other non-directory entries are skipped. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Each killProcessesWithCwdUnder call lists every process working directory (about 120 ms with lsof on macOS), and storage cleanup called it once per entry: roughly 16 s for 133 development instances and minutes for thousands of archived thread folders, so the remove buttons appeared to hang. The helper now takes directories and matches processes under any of them from one listing. Storage & retention passes each whole batch; the daemon, worktree and personal-workspace callers pass their single directory. 133 directories now take one ~120 ms sweep. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ances Thread rows and missing-checkout development rows now have an inline trash button that acts immediately, with a spinner on the button and progress or error text under the title. The ⋯ menu on development rows keeps navigation and path copying; thread rows drop their menu since the title opens the thread. Single-instance removal takes a per-row lock like thread clearing, so different rows can run at once while the bulk Clean up actions stay exclusive, and each removal re-reads the cached scan before updating it so concurrent removals don't overwrite each other. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The right-hand cluster's alignment placeholder was taller than the title line, pushing sizes below their titles and spacing rows apart; both row clusters now sit on the title's line height. An instance linked to several threads shows its first thread with an "Also linked to N other threads" line instead of stacking titles that read like separate rows. Group headings carry their own short description, replacing the footer that only explained "Other instances". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Only instances whose checkout was gone could be removed, so once those were cleared no row had an action. Each row now has the trash button. The host reports an instance as running when its daemon lock (daemon.lock.lock, refreshed every few seconds by proper-lockfile) changed in the last 15 seconds. Removing a single instance (removeDevInstances with names, or --instance) stops servers and removes it when its checkout is gone, removes it when it is not running, and otherwise refuses with "Stop the development server first"; BB never stops servers whose checkout still exists. The bulk Clean up action still removes only missing-checkout instances. The RPC is renamed from removeMissingDevInstances since it is no longer limited to them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Removing one development instance never refuses. When its dev server is
running (fresh daemon lock) and its checkout still exists, a plain removal
leaves it in place and reports it in `running`; the row then asks "Stop and
remove?" and confirming sends SIGTERM to the launcher PID recorded in that
instance's bb-app-runtime.json (SIGKILL after 15 s) before removing it. The CLI
treats --yes as that confirmation. Only the instance's own launcher is stopped,
never other processes in the checkout.
removeDevInstances takes {hostId, names: null} for the bulk missing-checkout
cleanup or {hostId, names, stopRunning} for chosen instances, and the host
contract carries the matching mode instead of a refusal condition.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Re-select each retention group right before archiving or deleting it, so a thread pinned or unarchived during a sweep is kept. - Confirm a development instance's recorded launcher (entry path and start time) before signalling its PID; expose experimental_readProcessIdentity from the Plugin SDK host entry for it. - Drop pending archive cleanups whose thread or machine no longer exists. - Clean development data on environment removal by re-measuring only that machine's ~/.bb-dev, queued behind running maintenance instead of dropped. - Replace a toast-placement UI test with the stop-and-remove request flow. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
86e8023 to
6b2bdf3
Compare
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Human comments
What was wrong
BB had no unified way to see storage use across machines, reclaim thread files or abandoned development instances, or opt into automatic retention. Cleanup tied only to live notifications could also lose work while a plugin was disabled, reloading, or its machine was offline.
What changed
bb storagecommands. Reports include hidden threads and link development data to its source checkout where possible.~/.bb-dev, queued behind any scan or cleanup already running there; later scans retry offline/busy machines or failed cleanup. Disabling the plugin stops its schedules and cancels active workers while retaining saved state.Public Plugin SDK changes
bb.events.on("experimental_environment.removed", handler)receives{ removal }after successful provider removal commits. The payload containsenvironmentId,removedAt,hostId,path, andproviderOwnedPath; delivery is ephemeral.PluginThreadEventPayloadsand the fake-host harness support it.experimental_killProcessesWithCwdUnder({ directories, graceMs? })replaces the singulardirectoryinput with a directory list. Existing callers must passdirectories: [directory]. Each sweep enumerates processes for the whole batch, including deleted paths resolved through their nearest existing ancestor. It uses SIGTERM then SIGKILL; Windows cwd enumeration remains a no-op.experimental_readProcessIdentity(pid)from@get-bb/plugin-sdk/hostreturns{ command, startedAt }or null, the same probe bb's launcher uses before stopping a recorded PID. Storage & retention uses it to confirm a development instance's recorded launcher (entry path and start time) before signalling it.Plugin-owned RPC and data contracts
state,hosts,host,scanHost,scanAll, andpreview.configureaccepts archive/delete thresholds plusdeleteStorageOnArchiveanddeleteDevDataOnCheckoutRemoval.clearThread,clearArchivedFiles,clearLargeFiles,removeOrphans,retryWorktreeCleanup, andremoveDevInstances. The latter accepts all missing-checkout entries or selected names with explicitstopRunning.startClearLargeFiles,startClearArchivedFiles, andstartCleanup(orphans, development, or worktrees). Machine responses expose cleanup progress/completion/failure.How you verified
turbo run lint typecheck test --filter='...[origin/main]'passes exceptbuiltin-plugins.test.ts > surfaces builtin app build failures…, a file-watch rebuild test unrelated to this plugin that times out only under full parallel load and passes 3/3 in isolation.git diff --checkpasses.Known limits: automation targets have no special retention exemption; pin threads that must be kept. Reports are cached snapshots, and filesystem eligibility is rechecked before cleanup. Windows does not enumerate working directories for process sweeps.