Repository navigation
fix(container): bound and report the local image enumeration - #76
Merged
Merged
Conversation
`podman images --format json` walks the whole local store, so its cost scales with the store rather than with what the caller wants. Unbounded, a degraded store is indistinguishable from a hang: the caller writes no log line, the run directory stays empty, and the only evidence is a `podman images` child process. Reported as a `check-image` step sitting 25+ minutes with no error naming why. Bound the call and kill the process group on expiry, and say what happened: listing local images via podman: timed out after 4m0s — the local image store is large or contended; prune it (charly clean) or retry when builds are idle Also report the cost when a completed listing took more than 2s, since the number is what tells an operator to prune: charly: listed 1170 local images in 9.003s — consider pruning the image store Measured on a workstation store while writing this: 1,170 image IDs carrying 12,585 tag names, ~9s and ~17MB of JSON per call, on every cache miss. Note this does NOT make a large store fast — the enumeration is inherently O(store) and the cache above it is what keeps consecutive runs cheap. What it fixes is a slow store presenting as a silent stall. Claude-Session: https://claude.ai/code/session_016fnPmYiC6ZkqXSi6D8PAP6
Review — PASSHead SHA: Security screen: PASS — no scope mismatch (diff matches description exactly), no secrets/exfiltration, no network egress, no weakened guardrails, no supply-chain changes. The Checklist: All applicable rules PASS or NA.
Verdict: PASS ollama/deepseek-v4-flash — pi-review-action. |
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
Addresses opencharly/charly#475 — and corrects that issue's root cause, which I wrote and which the measurements below disprove.
podman images --format jsonwalks the whole local store, so its cost scales with the store rather than with what the caller wants. Unbounded, a degraded store is indistinguishable from a hang: no log line, an empty run directory, and only apodman imageschild process as evidence. That is what was reported — acheck-imagestep sitting 25+ minutes with nothing naming the cause.This bounds the call (killing the process group on expiry) and makes the cost legible:
and, when a completed listing was slow:
What this does not do. It does not make a large store fast. The enumeration is inherently O(store), and the 5-minute cache above it is what keeps consecutive runs cheap. What it fixes is a slow store presenting as a silent stall.
The issue's stated root cause is wrong — measured
charly#475 says the store was "10,865 images, of which 10,607 were untagged (97.6%)" and frames the fix as avoiding an unfiltered enumeration. I set out to add
--filter dangling=falseand measured first. Both halves of that plan collapse:Filtering dangling images is 50% slower, because the filter costs more than the 402 rows it removes. The 97.6%-untagged figure does not describe this store.
Where the cost actually is — 1,170 image IDs carrying 12,585 tag names across 177 repositories:
I also checked whether retention was blind to them — a plausible cause, since
charlyImageTagsskips images withoutai.opencharly.box:So the store is not full of junk retention cannot see; it is full of accumulated CalVer tags retention simply has not pruned. That is an operational matter, not an enumeration bug — which is why this PR fixes the legibility of the slow path and does not pretend to make it fast.
How tested
New regression guard — a fake engine that never answers, the shape of a saturated store:
It asserts more than "it returned": the error has to contain
timed outandprune, so the message keeps telling the operator what to do.Negative control — bound removed,
exec.Commandrestored:Build and full package on the committed tree:
Rulebook compliance
Change classification
fully tested and validated— the guard fails without the change, the full package passes with it, and every claim about the store is a pasted measurement rather than an estimateAssisted-by: Claude Code Anthropic Opus 5 (fully tested and validated)