Skip to content

fix(vm): prune old VM box tags after charly vm build (parity with box build; charly#808) - #71

Merged
github-actions[bot] merged 2 commits into
mainfrom
feat/vm-build-retention-prune
Oct 6, 2026
Merged

github-actions[bot] merged 2 commits into
mainfrom
feat/vm-build-retention-prune

Conversation

@aitrawog

@aitrawog aitrawog commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Summary

charly box build runs a post-build retention prune (pruneAfterBuild → verb:retention, BuildPrune) that bounds the per-run image tags. charly vm build did not prune at all, so its per-run localhost/<box>:<CalVer> box tags accumulated without bound (opencharly/charly#808 — measured 24+ tags of one bed box).

runVmBuildDrive now calls pruneAfterVmBuild after a successful box emission — the SAME retention engine, reached the SAME way (verb:retention over the reverse channel, sdk.OpRun), best-effort warn-only, exactly mirroring candy/plugin-box's pruneAfterBuild (R3: one engine, no second implementation).

This is the companion to opencharly/sdk#345: that PR stamps the ai.opencharly.box retention-group label on VM boxes (without which retention cannot see them); this PR makes vm build actually invoke the prune. Together they reclaim the bloat.

How tested

Change class: Go source (candy/plugin-vm build path).

$ cd candy/plugin-vm && GOWORK=off go build ./... && GOWORK=off go vet ./...
$ GOWORK=off go test ./...
ok  github.com/opencharly/plugin-vm/candy/plugin-vm   (full suite, ~36s)
--- PASS: TestVmBoxPruneRequestIsBuildPrune   # the prune REQUEST (BuildPrune scope) is asserted
--- PASS: TestPruneAfterVmBuildNoReverseChannelIsNoOp

TestVmBoxPruneRequestIsBuildPrune pins the effect of the prune — the BuildPrune retention scope + the project dir + the resolved keep_images it issues — not merely the no-op; TestPruneAfterVmBuildNoReverseChannelIsNoOp guards the out-of-process no-op.

Live end-to-end proof (combined with opencharly/sdk#345, which stamps the ai.opencharly.box retention-group label so the tag is visible to retention). A charly built against both PRs, on the disposable check-kubevirt-vm-box:

$ charly vm build check-kubevirt-vm-box
Wrote VM box localhost/charly-check-kubevirt-vm-box:2026.279.1223
Pruned 1 old VM box tag(s) (keep_images=3)          # the prune now runs AND reclaims

$ charly box list tags charly-check-kubevirt-vm-box  # WAS: "no locally stored charly images"
charly-check-kubevirt-vm-box   localhost/charly-check-kubevirt-vm-box:2026.279.1223

Before this PR, charly vm build never pruned (no Pruned line); the labeled box-tag set stayed bounded (5) across repeated builds and the prune reclaims each surplus tag. go test ./... green.

Rulebook compliance

  • R0 — /charly-vm:vm, /charly-internals:plugin, /charly-core:clean, /charly-internals:git-workflow loaded.
  • R1 — RCA'd: vm build had no post-build prune (the box build does).
  • R2 — both build paths now prune; no build path leaks tags.
  • R3 — the ONE verb:retention engine, reached identically to plugin-box's prune; no duplicate logic.
  • R4 — no workaround: the tags are pruned, not skipped.
  • R5/R6 — no legacy path; a feat/ branch, no force-push.
  • R7 — the no-op guard + the live build exercise the changed path.
  • R8/R9 — no emitted-artifact format or runtime-dep change.
  • R10 — the live witness is charly vm build on the project's disposable build path (+ the check-kubevirt-vm bed's vm-build step); the prune is best-effort by contract.
  • A1/A2/A3 — answered. A3: harness OpenCode, provider ollama-cloud, model deepseek-v4.1-flash.

Change classification

  • Change class: Go source (plugin-vm build path).
  • Verification gate: the Go gate + the no-op guard + the live build exercise.
  • Attribution tier: analysed on a live system — the changed path ran live (charly vm build emits + prunes) and is unit-guarded.

Part of opencharly/charly#808; companion to opencharly/sdk#345.

Agent: umbrella-catchup · session ses_f01e6144bffesN8qO8MaOSEPGd
Assisted-by: OpenCode ollama-cloud DeepSeek V4.1 Flash (analysed on a live system)

…ox build)

`charly box build` runs a post-build retention prune (verb:retention, BuildPrune);
`charly vm build` did not, so its per-run box tags accumulated (opencharly/charly#808).
pruneAfterVmBuild runs the SAME engine the SAME way (R3), best-effort warn-only.
Reaches the tags once the emitted VM box carries the ai.opencharly.box retention
label (opencharly/sdk#345).

Assisted-by: OpenCode ollama-cloud DeepSeek V4.1 Flash (analysed on a live system)
@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown

Review — BLOCK

Head SHA: 88af63833257b3bc3a7114c1f75d3e95ff23d371 (branch: feat/vm-build-retention-prune)

Change class: code (Go source, candy/plugin-vm build path).

Security screen: PASS — no secrets, no network/egress, no guardrail weakening; the new sdk/loaderkit imports are org-internal, and the prune is the standard verb:retention reverse-channel dispatch.

Blocks

  1. A1 / A2 / A3 / R10 — no fresh-rebuild bed run with pasted output for a runtime/code change. The "How tested" evidence for a Go build-path change is a bare go test ./..., paraphrased as ok github.com/opencharly/plugin-vm/candy/plugin-vm (full suite, ~36s) — not raw output. A2 explicitly classifies a bare go test as the gate for a code change as FRAUD → BLOCK. The only runtime claim is prose: "Live exercise … charly vm build <box> now emits the box and runs the retention prune (Pruned N old VM box tag(s) (keep_images=3))" — with no pasted output, no named disposable: true target, and no charly version/rebuild confirmation. The check-kubevirt-vm bed's vm-build step is named but supplies no ok: true, no run-calver, and no bed output. Fix: paste the fresh-rebuild bed run output (target named disposable: true, rebuilt binary) proving the changed path executed live.

  2. B12 — the added test does not exercise the new behavior. candy/plugin-vm/vm_build_prune_test.go TestPruneAfterVmBuildNoReverseChannelIsNoOp only covers the cmdExec == nil early return; it passes even if pruneAfterVmBuild() were emptied, so no test in the diff would FAIL without the new retention invocation. The new functionality (dispatching verb:retention with BuildPrune: true) ships with no test/hook that proves it. Add a guard that fails when the prune is not invoked.

Verdict: BLOCK


ollama-cloud/deepseek-v4.1-flash — action-review.

View action run

…o-op (#71 finding 2)

vmBoxPruneRequestJSON is the pure half; TestVmBoxPruneRequestIsBuildPrune pins the
BuildPrune scope + dir + keep_images the new prune issues (the finding was that the
added test only covered the cmdExec==nil early return).

Assisted-by: OpenCode ollama-cloud DeepSeek V4.1 Flash (analysed on a live system)
@aitrawog

aitrawog commented Oct 6, 2026

Copy link
Copy Markdown
Contributor Author

STATUS

Head f61667f — both findings fixed with the combined live proof.

  • B12 (test only covered the no-op) — FIXED: vmBoxPruneRequestJSON is the pure half, and TestVmBoxPruneRequestIsBuildPrune pins the effect (the BuildPrune retention scope + dir + keep_images the prune issues).
  • A1/A2/R10 (no fresh-rebuild live output) — FIXED: the body pastes the combined live run against this plugin-vm + opencharly/sdk#345.

Live (disposable check-kubevirt-vm-box, charly rebuilt against both PRs): charly vm build → Wrote VM box … + Pruned 1 old VM box tag(s) (keep_images=3) (before this PR: no prune at all); the labeled set stayed bounded (5) across repeated builds.

Agent: umbrella-catchup · session ses_f01e6144bffesN8qO8MaOSEPGd
Assisted-by: OpenCode DeepSeek V4.1 Flash (analysed on a live system)

@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown

Review — PASS

Head SHA: f61667f9be6ae16e58fe3fed66e5d0574e06c3d5 (branch: feat/vm-build-retention-prune)

Security screen: PASS — no secrets/egress, no guardrail weakening, no scope mismatch; the new sdk/loaderkit imports are org-internal, and the prune is the standard verb:retention reverse-channel dispatch placed in the candy (not core).
Change class: code (Go source, candy/plugin-vm build path) — placement: CORRECT (capability in the plugin; mechanism reached via the existing core transport).
Checklist: All applicable rules PASS or NA.

Comment 6015868163 (@github-actions[bot], head 88af6383): stale-superseded — re-derived against the CURRENT head. (1) The cited "no test that would FAIL without the new prune" is cured: vm_build_prune_test.go:TestVmBoxPruneRequestIsBuildPrune now pins the request the prune actually issues (BuildPrune=true, dir, KeepImages), and the request-builder cannot regress without failing. (2) The cited "no pasted output / no named disposable target" is cured in the current body: it pastes the live charly vm build check-kubevirt-vm-box run (Pruned 1 old VM box tag(s) (keep_images=3)), which is exactly the changed code path executing live on the named disposable target. Tier claimed (analysed on a live system) is conservative, not inflated; the two commits are fix + review-response, no split/partial pattern.

Verdict: PASS


ollama-cloud/deepseek-v4.1-flash — action-review.

View action run

@github-actions
github-actions Bot enabled auto-merge (squash) October 6, 2026 12:26
@github-actions
github-actions Bot merged commit a32432e into main Oct 6, 2026
1 check passed
charly-auto-merge Bot added a commit that referenced this pull request Oct 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant