Repository navigation
Docker host tools backend: accurate disk usage, host summary + free-space API, -1 sentinels fail closed - #647
Merged
Merged
Conversation
… volume sizes (agent-os-cixa) GetDiskUsage summed img.Size per image, counting shared layers once per image (dev laptop: 3.79 GB against LayersSize 3.21 GB; production 21.24 GB against docker system df's 17.52 GB). It also added Docker's -1 "not available" volume sizes and dereferenced a nil UsageData. The arithmetic now lives in the pure summarizeDiskUsage, which uses LayersSize for images, skips unknown volume sizes and reports them through the new volumesSizeKnown field. GetDiskUsage delegates to it. Wire types regenerated with tygo; two typed DashboardStats fixtures and the empty-host dashboard JSON pin gain the field. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… for in-use images (agent-os-qczn) Docker's /images/json always reports Containers as -1 and the Go client cannot ask for the count, so every image showed 0 containers. ListImages now takes counts from one image-only DiskUsage call keyed by ID (the ListVolumes pattern), through the pure toDockerImages. A failed read, or an image missing from the snapshot, sets containersKnown false instead of reporting 0. With real counts, ImagesTab would have force-removed every in-use image. Delete is now disabled for an in-use image with a "Used by N container(s)" tooltip, an unknown count reads "unknown", and the delete path never sends force. The test that pinned the force-remove behaviour is replaced. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…(agent-os-p8sm) HostSpaceService reads one DiskUsage, the network list (one inspect per network) and the stacks table, and derives both the per-category summary and the removable items from that one snapshot. Summary is served from a 30 s snapshot behind a context-aware one-slot semaphore, so concurrent pollers share one Docker read; Candidates always reads fresh. Invalidate() drops the snapshot and a fetch in flight across it is not stored. Candidate rules (spec "Reclaimable rules"): images with Containers == 0 in the DiskUsage list (-1 is unknown, not unused); build cache neither in use nor shared; containers exited/created/dead with no compose project label at all; volumes with RefCount 0 not owned by a stack; networks with no attached container, not built in (bridge, host, none, ingress, docker_gwbridge) and not owned by a stack. A failed network inspect is not a candidate. Stack-owned = the compose project label names any stack row, running or not. disk.reclaimable sums the dialog's default categories; reclaimableAll adds volumes. GET /resources/host/summary and GET /resources/host/candidates answer 503 when Docker is unavailable and 500 on any other read failure, never a zeroed body. The service is installed by SetHostSpaceService only when Docker is present. Wiring Invalidate() into the prune and delete routes is left to agent-os-yyat. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ation 24 (agent-os-8hdg) D98-A/C. The Docker cleanup policy gains one switch per category (dangling images, unused tagged images, build cache, stopped containers, volumes, networks) and an alert threshold, stored as seven settings keys. An absent row gives today's behaviour (dangling images + build cache on, 5 GiB threshold); an unreadable row refuses, as the existing keys do. - PUT /resources/cleanup/policy accepts a partial categories object and alertThresholdBytes (0..1 TiB), validates everything before writing, and writes the changed keys in one SetSettings call. An enabled policy with every category off is a 400. A categories/enabled change over an unreadable policy is refused (the all-off rule cannot be checked). - GET/PUT report nextRunAt (RFC3339) only while enabled and armed. The scheduler records armedAt/interval in startLocked and clears them in stopLocked; NextRunAt is the next interval multiple after now. - Execute honours the dangling-images and build-cache switches (orchestrator decision: skip what is off, record what ran). The other four categories are stored but not executed; that is agent-os-lr7x. A manual run reads the categories from the policy and refuses if it is unreadable. - Migration 24 adds categories (default 'dangling_images,build_cache'), containers/volumes/networks_deleted and other_bytes_reclaimed to docker_cleanup_runs. The four new reclaim figures sit in a new pendingReclaimFigures table pinned at 0 until agent-os-lr7x. - The new keys are classified as not sensitive and spelled with their constants at every read and write, so the settings-key guard sees them. - Frontend: regenerated wire types; DockerCleanupRun.status gains 'skipped' (reserved, no writer yet); DockerCleanupPolicy gains categories, alertThresholdBytes and nextRunAt; api.ts request type extended. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…echeck and measured bytes freed (agent-os-yyat) POST /resources/host/free-space removes only the listed IDs that are still candidates when re-read under the exclusive stack turn. Requested IDs that are now in use, stack-owned or gone are skipped with a reason. Every removal is unforced (images without PruneChildren), in the order containers, images, networks, volumes, build cache (BuildCachePrune All=false). spaceReclaimed is DiskUsage total before minus after, floored at 0, omitted when unmeasurable. The run uses an operation-owned 15 min context; audit ActionPrune with resource host_free_space; broadcast resource_changed/host_free_space. hostSpaceFreer joins exclusiveGatedInterfaces, so FreeSpace without acquireExclusiveLock fails TestContainerLockGuard_EveryContainerPruneTakes TheExclusiveTurnFirst. Every handler that removes Docker objects (9 routes in resource_mutations.go, runCleanup, freeSpace) now defers invalidateHostSpace(), kept there by the new AST guard TestHostSpaceGuard_EveryRemovalRouteInvalidates. Request/result wire types in services/wire_types.go; generated-services.ts regenerated with tygo. Host routes added to the no-Docker route list. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…wn sizes and counts (agent-os-gkgr) ListVolumes copied Docker's -1 "not computed" Size and RefCount through as known values, so a volume rendered a size of -1 bytes and read as not in use, and a failed DiskUsage read made every volume look unused. volumeUsageOf now resolves the sentinel: DockerVolume gains inUseKnown, and sizeKnown is false for -1. ListNetworks fell back to NetworkList's empty Containers (0) on a failed inspect, so the network read as unused; it now passes -1 and sends containersKnown false. The Volumes tab says "size unknown" and the Networks tab "unknown", both sort unknown after every known value, and Delete is disabled with a reason when in-use state or attachments are unknown. Deletes GetImageDiskUsage (0 callers, and it summed per-image Size, which counts shared layers once per image). The cleanup preview reclaim figure is left to agent-os-lr7x (orch decision). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
React Doctor found no new issues. 🎉 Reviewed by React Doctor for commit |
…t (ws-read-deadline gate) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Docker host tools, backend half (spec
.agent-os/specs/2026-10-14-docker-host-tools), plus the -1 sentinel fix. The Host page UI is NOT in this PR.GEThost summary and cleanup-candidates endpoints (HostSpaceService, fails closed).POST /resources/host/free-space, under the exclusive operation lock, rechecks candidates under the lock, never forces, reports bytes actually freed; every removal route invalidates the host summary cache (AST guard).Test plan
🤖 Generated with Claude Code