Repository navigation
fix(deploy,vm,bundle,substrate,status): bed-robustness batch — 6 VM/deploy/bed reliability fixes - #176
Conversation
…eckpoint) WIP checkpoint before merging origin/main (charly#175) — will be reshaped/ re-verified against the final composed tree before the R10 acceptance run.
…eploy/bed reliability fixes Pins sdk feat/bed-robustness-batch (guest SSH hardening + VM state-dir worktree scoping, sdk#87). 1. Ephemeral teardown timer never fired (no --working-directory on the systemd-run transient unit) — closes ~21 recorded failures over weeks. 2. VM ssh-port dual-allocation race — vmPrepareVenue no longer races vm create's own allocator on a fresh domain. 3. Guest SSH hardening (sdk leg) — mask ssh.socket + a self-testing PerSourcePenalties sshd drop-in, closing the RCA'd kex-reset wedge. 4. Discarded-decode-errors sweep across plugin-deploy-vm/plugin-vm/ plugin-deploy-pod — malformed replies no longer silently read as success or zero-value. 5. DeployStateHost out-of-process-read audit (the batch's most severe finding) — vmPrepareVenue's prior-state read was ALWAYS silently empty out-of-process, forcing the per-domain disk overlay to be wiped and recreated on every ordinary redeploy of an already-running VM. Fixed via the existing config-resolve seam, and swept to every other registered dormant site (plugin-bundle, plugin-status, plugin-substrate). 6. Global ~/.local/share/charly/vm non-worktree-scoping footgun — a new CHARLY_VM_STATE_DIR override (sdk leg) closes the cross-worktree domain collision risk. No public surface removed — internal-only fixes (unexported function signatures gained a ctx param; no YAML field, CLI flag, or OCI label changed) — so no breaking-change marker. R10: check-substrate (10/10), check-charly-vm (8/8, incl. fresh-rebuild), check-sidecar-pod (17/17, incl. fresh-rebuild + a second ephemeral-VM redeploy cycle) all PASS on the frozen final tree, binary 2026.203.0640/0644. ephemeral-register-roundtrip check (item 1's direct proof) exit=0. Assisted-by: Claude Code (Anthropic Claude Sonnet 5; fully tested and validated)
…ash (sdk#87) sdk#87 merged as af9beb2 (v0.2026203.730) — the squash-merge commit, distinct from the local feat/bed-robustness-batch branch tip (faa32b1, which does not survive on sdk main after the branch delete). Repoints the sdk gitlink + bumps charly/go.mod's require to the merge-time tag, mirroring wave-6's own e2b9520 "repoint gitlink to the merged sdk#86 squash" pattern. Verified: task build:binary rebuilds cleanly on this pointer. Assisted-by: Claude Code (Anthropic Claude Sonnet 5; fully tested and validated)
pr-validator — CHANGES REQUESTED ❌Change class: charly Go, runtime (cross-repo consumer leg — sdk gitlink repointed to the merged Head SHA validated: Gitlink repoint verification (independent)
Independent re-run of the full Go quality gates (this exact head, in the dedicated
|
| # | Item | Verdict |
|---|---|---|
| 0 | Security & anti-tampering | PASS |
| 1 | Description completeness | PASS (substantively complete; the boundary-law "N/A" inaccuracy is captured under item 15, not scored as an incomplete-template failure) |
| 2 | Change-class gate matches evidence | PASS |
| 3 | Attribution tier vs proof | PASS |
| 4 | R0 skills honored | PASS, with a note: /charly-internals:plugin (the boundary-law owner) was not in the loaded list despite this PR touching the kernel/plugin boundary via new charly/*.go code — consulting it would likely have caught finding #2 |
| 5 | R1 RCA + zero warnings | PASS |
| 6 | R2 no pre-existing/out-of-scope split | PASS for the PR's own six items; the two findings above are this review's own surfaced issues, to be fixed in this same cutover per R2 |
| 7 | R3 no duplication | FAIL — see finding 1 |
| 8 | R4 no ad-hoc workaround | PASS |
| 9 | R5 hard cutover + grep self-test | PASS / N/A (no identifier removed) |
| 10 | R6/R8/R9 | PASS/N/A |
| 11 | R10 disposable-only, fresh-rebuild, coverage | PASS |
| 12 | RDD/ADE/SDD | PASS |
| 13 | Concurrency mandate | PASS — genuine 3-bed concurrent roster on shared-state (deploy ledger/VM lifecycle) paths |
| 14 | Hard cutover — one atomic set, no Phase 2 | PASS (the f555a7c repoint commit is a legitimate producer-dependency follow-up, not scope creep) |
| 15 | ARCHITECTURE GATE — placement | FAIL — see finding 2. placement: SHOULD-BE-tracked-inventory (vmshared.VmStateRoot() call in charly/vm_backend_lifecycle.go needs explicit until-K inventory or should not have been added this PR) |
| 16 | Disposable-only autonomy | PASS |
| 17 | Clean architecture + Go gates | PASS — independently re-run: gofmt/vet/build/test/golangci-lint all clean on charly/ + every touched candy module |
| 18 | CHANGELOG present | PASS |
Per-item trace (charly/*.go changes):
charly/go.mod: dependency version bump only (not a placement decision).charly/host_build_vm_build.go: pre-existing core function (HostBuild "vm-build" seam handler, itself residual migration inventory per the boundary law's R-item classification, not newly placed by this PR); no new import in this file — it calls the already-modified same-packagevmDir(). No alias, no Legacy smell.charly/vm_backend_lifecycle.go: pre-existingvmDir()helper (inventory) modified to call a NEWsdk/vmsharedimport → blocker, see finding 2. No alias-form declaration (plain call, does not trip the ZERO-ALIASES hook), no Legacy smell.
Comments considered: none — the PR carries no comments as of this review.
Cross-PR interactions considered: sdk#87 — already merged by me; this PR correctly repoints to its squash SHA (verified). charly#118 — zero file overlap, verified-non-blocking. opencharly/plugins#101 — the docs-last companion for the sdk leg; correctly does not touch this repo, no interaction with this PR's own correctness.
Decision: FAIL. Two findings, both narrow and mechanical to fix (see "What's needed to clear both" above). Not merged.
Assisted-by: Claude Code (Anthropic Claude Sonnet 5; analysed on a live system)
…— R3 seam-read hoist + UNTIL-K annotation pr-validator round-1 findings on charly#176, both fixed in this same cutover: 1. R3 — the "pod-config-load-bundle" HostBuild seam read had accumulated 4 near-identical copies (candy/plugin-bundle/ephemeral.go, candy/plugin-pod/remove_orchestration.go's resolveSidecarNames, candy/plugin-status/nested_tree.go, candy/plugin-substrate/status_flat.go). Hoisted into ONE shared deploykit.LoadBundleConfigViaSeam (sdk#88, merged d7c04ed, tag v0.2026203.824) and repointed all four call sites onto it. Pure consolidation, byte-equivalent semantics; net -22 LOC across the four files. 2. Architecture gate — charly/vm_backend_lifecycle.go's new sdk/vmshared import lacked its required K-wave inventory justification. Added an explicit "MIGRATION INVENTORY (north-star §4.4): ... UNTIL-K4/K5" doc comment on vmDir(), naming charly/vmshared_aliases.go (documented K4/K5-dissolving inventory) as the shared exit this call site rides. sdk gitlink repointed af9beb2 -> d7c04ed; charly/go.mod bumped to v0.2026203.824. Delta re-gate only (no bed re-run): go build/vet/test clean on charly/ (152s) + all 4 touched candy modules against the real merged sdk commit; gofmt clean; the two standalone plugin-deploy-vm/plugin-deploy-pod modules re-verified unaffected. golangci-lint: 14 pre-existing issues, zero in code touched by this cutover (verified against git diff d92e3e4..HEAD) -- flagged for the next lint-category thematic batch, not fixed here.
|
Round-1 findings fixed, pushed as 1. R3 — hoisted the 4-way-duplicated
Removed the now-dead local seam-kind consts and unused imports at each site. Net -22 LOC across the four files (pure consolidation). Pure byte-equivalent semantics — same seam kind, same request/reply shape, same nil-on-empty contract, same error propagation; verified no test anywhere asserts on this path's error text. 2. Architecture gate — the new Sequence + gitlink: Re-gate (delta, no bed re-run — both fixes are zero-behavior-change):
CHANGELOG ( |
pr-validator — APPROVED ✅ (round 2 review — supersedes round-1 verdict)Head SHA validated: Gitlink / require re-verification
Finding 1 (R3 duplication) — resolved, independently verifiedAll four call sites now delegate to
I independently re-ran the R3 grep myself (not trusting the author's "should now show the helper as the ONLY implementation" framing): New, non-blocking finding surfaced during this re-check: a 5th live instance of the identical marshal→HostBuild( Finding 2 (architecture gate — new
|
pr-validator merge-time version stamp for the bed-robustness batch (guest SSH hardening, VM ssh-port race, DeployStateHost sweep, discarded-decode-error sweep, VM state-dir worktree scoping, and the round-2 R3 seam-read hoist + architecture-gate inventory annotation). Assisted-by: Claude Code (Anthropic Claude Sonnet 5; fully tested and validated)
Both were true-sounding facts about shared mutable state, asserted without the identifiers that would have made them falsifiable. 1. "main is drift-red" — FALSE, and it was never true. main pins plugins at 396e4bfe, and aa80ca9f (#174) is NOT an ancestor of it, so the gitlink predates #174: main's candy sources are pre-sweep AND its pinned plugins tree is pre-#174, two halves of one older state, which is what a clean drift check reports. The eight-artifact red only appears in a checkout with plugins/ ahead of the gitlink and candy sources not yet swept — an ordinary working tree, never a committed state of main. Recorded as a rule, because the mechanism generalises: `charly marketplace drift` and `charly docs drift` answer a question about the CHECKOUT they ran in — candy sources on disk versus the submodule tree on disk — not about any commit. A submodule checkout floats independently of its gitlink, so "the gate is red on main" means nothing until main's exact tree is reconstructed (superproject commit plus each submodule at its PINNED sha). The urgency framing this produced is removed from the entry and the PR body: the generated half was pending at the plugins tip, which is a queue, not a breakage. 2. "both gitlinks are their submodule's current tip" — half false, and already false when written. docs ee3d162e was the tip; plugins aa80ca9f was not — 4458a400 (#176) had merged minutes earlier, and ab1f93d3 has landed since. The pin is a strict ancestor of the tip, so the FORWARD MOVE claim (the one that matters for correctness) stands unchanged; only the word "tip" was wrong. Restated as "descendant of what main carries", which does not decay. Both corrections applied to the CHANGELOG and the PR body, and the whole entry re-swept for sentences leaning on the removed premise rather than only the two quoted in review. That re-sweep caught a third, smaller instance: this correction's own cross-reference said "see below" for a section that sits above it. Now cited by heading, per the same rule. CHANGELOG-only; no code, config, gitlink or DOCS_REF change, so the bed run and every gate figure in the entry stand unchanged. Assisted-by: Claude Code Anthropic Claude Opus 5 (fully tested and validated) Claude-Session: https://claude.ai/code/session_01Rt9KMZF6v3x1iL24M74dN2
An earlier revision of this entry — written at my own request for a disclosure — stated that landing the projections leaves main drift-red until this PR carries their source. That is FALSE and it stated it about main, in an artifact of record. Verified mechanism: marketplace drift compares candy sources against the plugins tree AT THE SUBMODULE CHECKOUT, and main pins plugins at 396e4bfe, which is not a descendant of either #174 (aa80ca9f) or #176 (4458a40). Main's source and its pinned tree are both pre-projection, so the gate is green on it, and landing a projection does not move a superproject gitlink. The true statement: the gap is PENDING AT THE PLUGINS TIP and materializes only when a superproject leg bumps the gitlink past those commits — the leg that advances the pointer owns carrying the matching source. The red state is reproducible only in a working tree whose plugins/ is fetched past the gitlink, which is not main. Both traps are kept because both are correct and independently useful: a drift result is a fact about a CHECKOUT (measuring main means reconstructing main's tree with submodules at their gitlink, not their own origin/main), and the 'clean (N artifacts)' line prints only on the clean path so its absence is not evidence. Assisted-by: Claude Code Anthropic Claude Opus 5 (documentation reviewed) Claude-Session: https://claude.ai/code/session_01Rt9KMZF6v3x1iL24M74dN2
…uilt (#278) `charly check box <box>` could run against an image that was not the one you had just built, report every step green, and give no sign. A gate that certifies the wrong artifact is the highest-severity defect this system has, because a false pass is indistinguishable from a real one. Two independent causes compounded, both traced against the real image store. The render labelled an imported box's image with the namespace-qualified Generator key while tagging the ref with the leaf name, so a fresh build was invisible to a resolve of its own image name. And the election's primary key is the content-derived version label, so an image built from a differently-versioned source tree outranked a newer build regardless of when either was produced. The three build-scope verdict verbs — `charly check box`, `charly box feature run` and `charly box labels` — now resolve through the guarded `kit.ResolveBuiltImageRef`, which refuses a short name whose election is not the newest local build and names both refs plus the pinned re-invocation. Build recency keys on the image's CREATION TIME, the only key total over the tags charly mints (`--tag` REPLACES the CalVer tag, so every bed build reads as no CalVer at all). All three verbs print their `Image:` provenance FIRST on every path, including the no-plan path that previously bailed before printing one; for `box labels` it goes to stderr so `--format`'s single raw stdout value stays byte-unchanged. `candy/plugin-clean`'s retention sort shared the same blind spot and is folded in rather than named separately, because it is the one surface here that DESTROYS an artifact instead of mis-answering: a group of bed-tagged images had no usable ordering key, so `keep_images: N` kept an arbitrary N and could delete the newest build. This commit carries FOUR cutovers' candy sources, and the union was forced rather than chosen. The docs mirror had been regenerated at a projection no reachable superproject state reproduced, so the first leg through the gate had to carry all of them: the build-scope verdict resolver, the git-workflow landing-mechanics leg (#176), the merge-tree guard (#177, source `c144ad11`), and the R4a task-target sweep (#285). Named so a squash does not bury other authors' provenance. Advancing the `sdk` gitlink forces a spec-floor sweep across 90 `candy/*/go.mod` files: under MVS every module depending on `sdk` and requiring `spec` directly must match, and `go.work` masks the defect in-tree while these plugins ship out-of-workspace. The standing gate this adds is a `GOWORK=off` per-module build; it reports 91 modules with one failure, `candy/plugin-dsh`, which fails identically on `main` for an unrelated `go`-directive cause and joins a named module-hygiene batch with a measured scope. Gates, re-derived independently at merge: `check-agent-pod` run 2026.227.1451 (13 steps, 365s) against a byte-identical final resolver; `check-docs` run 2026.227.1835 (13 steps, 492s) on the final tree at zero warnings, with the build log showing it cloned the `DOCS_REF` commit it then asserts. `marketplace drift` clean at 400 artifacts and `task docs:drift` a no-op over 6 repo roots and 891 pages — the first of those perturbation-tested to confirm it can actually fail. Assisted-by: Claude Code Anthropic Claude Opus 5 (analysed on a live system)
…systemd (#419) B1's last item, and the half that had to wait for sdk#176. systemd's candy_file: listed only *.service, and its assembly_template hardcoded that same extension TWICE: cp /systemd/*.service /usr/lib/systemd/user/ && \ for svc in /systemd/*.service; do systemctl --global enable ...; done The pair agreed only because both were frozen. A candy could not ship a .socket, .target or .slice at all - and widening either side alone would have been worse than leaving it: widening candy_file: would stage units the copy never installs, widening the copy would install units nothing collected. Both move together now. candy_file: claims .service/.socket/.target/.timer/.path/ .slice, and the assembly copies EVERY staged unit, then enables only the types systemd can enable. .slice is claimed but deliberately NOT enabled: a slice is a resource container referenced by other units' Slice=, and `systemctl enable` on one is an error, not a no-op. That distinction is asserted, not just commented. The enable loop carries an existence guard because an unmatched glob stays literal in sh - without it, a candy shipping only services would fail the build on `systemctl enable '/systemd/*.socket'`. This is inert without sdk#176, which made candy_file: honoured at all (the scan is init-agnostic, so the patterns are globbed at the point of use). The sdk pin moves to v0.2026240.1542, which also carries #177's fix for the depends_candy false positive that #176 introduced. TestEmbeddedVocab_SystemdClaimsEveryUnitTypeItInstalls guards the pair that has to stay consistent - what candy_file: claims versus what the assembly copies and enables - so neither side can drift again. Verified to fail on the pre-change vocabulary rather than assumed. Assisted-by: Claude Code Anthropic Opus 5 (analysed on a live system) Claude-Session: https://claude.ai/code/session_01Gf42A3bau77JigFYLALrnq Co-authored-by: atrawog <[email protected]>
Summary of changes
The charly-core half of the bed-robustness thematic batch (the
operator-directed batch collecting accumulated non-blocking VM/deploy/bed-
reliability findings from recent wave landings — the Cutover Sizing Law: one
landing ceremony for the whole theme). Depends on
opencharly/sdk#87merging first (pins its commit via the
sdkgitlink — items 3 and 6 belowland there).
Six items, cross-checked against the program's own LOC ledger register (every
finding matches an already-logged entry):
candy/plugin-bundle/ephemeral.go)—
registerTransientTimernever pinned--working-directoryon thesystemd-run --usertransient unit, so the self-exec'dcharly bundle delran from the user systemd manager's default cwd (home), never finding
charly.yml. ~21 recorded failures over weeks (wt-6a/6b/fsint/s3b).candy/plugin-deploy-vm/lifecycle.go)—
vmPrepareVenueused to pre-allocate its own throwaway port beforeauto-boot, racing
vm create's own independent allocator for the SAMEdomain.
sdk#87); no charly-core files touched.candy/plugin-deploy-vm,candy/plugin-vm,candy/plugin-deploy-pod— every silently-discardedjson.Unmarshalerror now handled (hard-fail at dispatch entry points /opts gating the R10 rebuild path; warn-and-continue where that matches the
surrounding loop's existing convention). Two severity fixes:
vmPluginOpErrorand the egress-validate reply decode used to treat amalformed reply as success.
finding) —
vmPrepareVenue's prior-state read calleddeploykit.LoadDeployConfigForReaddirectly; since this plugin runsout-of-process,
deploykit.DeployStateHost(registered only by charlycore's own
init()) was never set in its process, so the read ALWAYSsilently returned empty — forcing auto-boot (and a full disk-overlay wipe
+recreate) on EVERY
charly bundle add vm:<name>, even for analready-running VM. Fixed via the existing "config-resolve" HostBuild
seam. Swept the same dormant class (compiled-in TODAY, but a per-BUILD
placement fact, not an authoring guarantee) to
candy/plugin-bundle(6 sites),
candy/plugin-status, andcandy/plugin-substrate(3 sites,including
charly reap-orphans— which exists specifically to clean uporphaned EPHEMERAL deploys and would otherwise silently find nothing to
reap, out-of-process, every time).
~/.local/share/charly/vmnon-worktree-scoping footgun — sdkleg (
vmshared.VmStateRoot(),sdk#87); this PR routes every charly-corecall site (
charly/vm_backend_lifecycle.go,charly/host_build_vm_build.go,candy/plugin-vm/vm.go+ 2 more sites,candy/plugin-deploy-vm/lifecycle.go) through it instead of duplicatingthe literal path (R3).
Change class
charly-or-sdk Go (cross-repo: this is the CONSUMER leg — depends on
opencharly/sdk#87merging first; thesdkgitlink here already points atthat PR's head commit
faa32b1).How R10-tested — exact gate, commands, and pasted output
change → the full matching bed roster, run CONCURRENTLY (the high-load
concurrency mandate for shared-state paths: the deploy ledger, VM
lifecycle).
2026.203.0640/0644, all three launched concurrently as separaterun_in_backgroundprocesses against the SAME rebuilt binary on themerged tree):
Item 1's direct proof (grepped from
.check/check-sidecar-pod/2026.203.0644/check-live.log):task build:binaryrebuilt cleanly from this exactmerged tree (sdk pinned at
faa32b1);charly version=2026.203.0640(later
0644for the sidecar re-run) matched across all bed runs;go.work.sumunchanged.ephemeral-register step fired for real (systemd timer + persisted state,
verified); item 2's ssh-port resolution ran on every VM bed's
deploy-addAND
update; item 5'sresolvePriorVmStateseam call executed on everydeploy-add/updateacross all three VM-touching beds (previously thispath silently no-op'd — the beds now correctly reuse persisted state
instead of wiping the disk overlay every time, which is WHY
update'sfresh-rebuild pass — a genuine destroy+recreate — still completes cleanly
rather than racing a stale allocation).
separate
run_in_backgroundprocesses AT THE SAME TIME against the SAMEbinary/tree (the deploy ledger + VM lifecycle are exactly the shared-state
paths this batch touches). No cross-bed interference observed; each bed's
charly.ymloverlay entries + libvirt domains are keyed by deploy name(P33 domain-identity scoping), so no collision.
Attribution tier
fully tested and validated
Assisted-by: Claude Code (Anthropic Claude Sonnet 5; fully tested and validated)Harness rulebook compliance
/charly-internals:go,/charly-internals:strict-policy,/charly-internals:git-workflow,/charly-internals:cutover-policy,/charly-vm:vm,/charly-internals:vm-deploy-target,/charly-internals:vm-spec,/charly-check:check,/charly-internals:disposable,/charly-core:deploy— all loaded beforeany edit.
check-sidecar-podrun wedged 30m54s on
deploy-check-sidecar-pod-ephvm— root-caused to thebinary predating the sdk-side redundant-package fix (log inspection +
cloud-init module-ordering analysis); the post-merge run above resolves it
cleanly. (2)
sdk/kit'sTestStartProcessWaitMonitorNeverClosesConsumerPipestimed out at 600s under a real host-load spike (load avg 6.33→2.99 across
retries, 21GB swap, 2 concurrent qemu VMs + another teammate's podman
build) — re-ran isolated at lower load: PASS in 30ms; documented with
before/after timing evidence, unrelated to this PR's files. Zero warnings
in the final gate.
fixed in this SAME cutover (the DeployStateHost sweep was extended from 1
confirmed-active site to all 4 registered packages per operator ruling —
"dormant today" is a placement fact, not grounds to defer).
filepath.Join(home, ".local", "share", "charly", "vm")literals collapsed to ONE call throughvmshared.VmStateRoot()(sdk leg); the DeployStateHost fix reuses theSAME "config-resolve"/"pod-config-load-bundle" seam pattern everywhere
rather than inventing per-package variants.
ssh-port fix removes a race via single-allocator ownership, not a delay.
additive/corrective fixes; N/A for the stale-reference sweep.
git status/git stash listchecked clean before theorigin/mainmerge; a WIP checkpoint was committed first (never mergeover uncommitted work).
go test), seeabove.
touched by this batch).
task build:binaryrebuilt from thisexact merged tree;
charly versionverified matching on every bed run; nonew runtime OS dependency.
disposable: true;proven via FRESH
charly update(destroy+recreate) passes in ALL THREE,zero warnings; the check coverage that would FAIL without these fixes is
exactly
ephemeral-register-roundtrip(item 1) and the absence of adisk-overlay-wipe-on-every-redeploy regression (item 5, implicitly proven
by
update's clean pass reusing persisted state).resolution, prior-state read behavior, guest boot sequencing) proven live
on disposable VM beds, not from a code/doc reading — see the exploratory
pre-merge run's FAILURE + this PR's fresh combined-fix PASS as the
before/after RDD proof pair. ADE: N/A. SDD: N/A (no
.cueschema touched).sweep is complete across every registered site, not partially deferred.
plugin candy or the pre-existing charly-core call sites those candies
already used; no new kind-specific core branch.
disposable: truebeds only.gofmt -l .empty,go vet ./...clean,go test ./...green acrosscharly/(169.5s) + every touched pluginmodule (
plugin-deploy-vm,plugin-deploy-pod,plugin-vm,plugin-bundle,plugin-status,plugin-substrate).CHANGELOG/2026.203.0710.mdstaged (placeholder CalVer; thepr-validator finalizes the merge-time version).