Skip to content

bug: nested in-substrate member teardown runs on the HOST, not the guest — deploy del <root>.<member> loses the nested venue and mutates the workstation (#627/#680 mechanism) #765

Closed

Description

@aitrawog

Summary

A nested in-substrate member's teardown executes in the WRONG VENUE. charly deploy del <root>.<member> (the command the bed runner runs to tear a nested member down) re-resolves the venue from the member node alone; a member authored with no host: field falls back to ShellExecutor{} — the operator's host — and the ledger's reverse ops are then replayed on the workstation instead of in the guest.

Measured on this host: check run check-kind-host-vm tore down in the guest (add) and removed /usr/bin/helm and /usr/bin/kubectl from the operator's workstation (164.87 MiB) in the cleanup step.

This is a third variant of the mechanism already tracked by #627 and #680 — same fork (deploykit.TearDownMembers → peer charly deploy del <member>), different symptom: #627/#680 deadlock on the ledger lock; this one proceeds and mutates the host. plugin-fleet#22 fixed the lock only.

Measured impact (verbatim)

.check/check-kind-host-vm/2026.276.0928/cleanup-check-kind-host-member.log:

:18  error: target not found: kind
:19  error: target not found: nerdctl
:20  error: target not found: rootlesskit
:21  error: target not found: conntrack-tools
:22  reverse: package-remove failed: exit status 1
:24  :: charly optionally requires kubectl: Kubernetes deploys + charly eval k8s probes (kind:k8s targets only)
:26  Packages (2) helm-4.3.0-1  kubectl-1.36.4-1
:28  Total Removed Size:  164.87 MiB
:32  removing helm...
:33  removing kubectl...

The host's pacman state is an exact match for that error set and for the two non-errors:

package host state teardown outcome
kind, nerdctl, rootlesskit, conntrack-tools ABSENT target not found (the 4 errors)
containerd, slirp4netns PRESENT no error
charly (2026.256.1316-1) PRESENT ⇒ prints :: charly optionally requires kubectl

Meanwhile the add correctly landed in the guest — deploy-check-kind-host-member.log:337-363 shows the guest's pacman installing all 15 (incl. kind, containerd, nerdctl, rootlesskit, slirp4netns, conntrack-tools). The bed also fails, because the runner asserts a pristine cleanup log:

[cleanup-check-kind-host-member] FAIL 1m30.522s: cleanup-check-kind-host-member exited 0 but its log carries 4 error line(s)

(All other 14 steps PASS, including update 7m56.237s, redeploy-check-kind-host-member 3m13.01s and check-live-rebuild-check-kind-host-member 1m42.71s.)

Root cause (R1)

The teardown is a fresh OS process, so no in-process venue survives:

  • plugin-check/candy/plugin-check/bed_run.go:613-615

    for i := len(d.ChildKeys) - 1; i >= 0; i-- {
        childKey := d.ChildKeys[i]
        if err := step("cleanup-"+childKey, "deploy", "del", name+"."+childKey, "--assume-yes"); err != nil {

    → charly deploy del <root>.<member> --assume-yes, forked through the cli HostBuild seam (plugin-check/command.go → ex.HostBuild(ctx,"cli",…) → charly/host_build_cli.go runCliSubcommand → exec.Command).

  • charly/unified_targets.go ResolveTarget (~:481-509) selects the executor only from the node's host::
    exec, perr := specexec.RootExecutorForDeployNode(node).

  • spec/exec/deploy_chain.go:220-227:

    func RootExecutorForDeployNode(node *spec.FleetNode) (spec.DeployExecutor, error) {
        if node == nil { return ShellExecutor{}, nil }
        hostField := strings.TrimSpace(node.Host)
        if hostField == "" || hostField == "local" { return ShellExecutor{}, nil }

    A member with no host: ⇒ ShellExecutor{} = the host.

  • charly/unified_targets.go pluginDeployTarget.Del (:297-309) dispatches {Op:"del", OptsJSON: optsJSON} — no VenueJSON — whereas Add (:237) dispatches VenueJSON: t.applyParentExecOverride(opts) (the live nested parent = the guest). t.venueJSON is documented as in-process state ("nil until the first add dispatch reports one back"), and dispatch only injects it when non-empty.

  • plugin-fleet's resolveRootExecutor (candy/plugin-fleet/deploy_target.go) honors VenueJSON when present and otherwise falls back to the same RootExecutorForDeployNode.

  • Production entry charly/host_build_deploy_node_del_dispatch.go:16-29: ResolveTarget(req.Node, req.Name) then utgt.Del(...) — no venue anywhere.

Asymmetry in one line: Add gets its venue from a live in-process executor; Del has no equivalent channel.

Why only this bed (the blast radius is narrow)

Only a member whose candy declares a package: list trips a bed failure: that compiles to a SystemPackagesStep whose reverse op is pacman -R … — the only reverse op that does real, visible damage on the host and emits error lines.

Measured across the three beds that carry a re-nested in-substrate local: member:

bed verdict member cleanup
check-group ok: true (1652s) cleanup-check-group-member ✓
check-builder-vm ok: true (1741s) cleanup-check-builder-member ✓
check-kind-host-vm ok: false (1804s) cleanup-check-kind-host-member ✗ (only red step)

layer-kind declares distro.arch.package: [kind, containerd, nerdctl, rootlesskit, slirp4netns, conntrack-tools]; the other two members compose candies that only drop file markers.

Scope of the fix (scoped; a producer chain)

No existing wire field carries the venue on the del path — spec.DeployNodeDelDispatchRequest and spec.DeployTargetDelOpts have no venue/ancestry field in the pinned spec or in the newest available spec, so a pin bump alone fixes nothing. The add path already has the model to copy:

  • charly/host_build_resolve_target_add.go:23 — spec.ReconstructParentExec(req.AncestorPaths, req.AncestorNodes, deriveChildExecutorForPath), fed by DeployResolveTargetAddRequest.AncestorPaths/AncestorNodes, populated in plugin-fleet/candy/plugin-fleet/walk.go:139-146.

Minimal change:

repo file change
spec CUE schema → cue_types_gen.go add AncestorPaths []string + AncestorNodes []Deploy to DeployNodeDelDispatchRequest (mirroring DeployResolveTargetAddRequest); new release
plugin-fleet candy/plugin-fleet/walk.go (DeployDelCmd.Run) populate the ancestor chain from the tree it already resolves (same construction as :139-146); bump the spec pin
charly charly/host_build_deploy_node_del_dispatch.go spec.ReconstructParentExec(...) → flatten via specexec.DescriptorFromExecutor → set the venue on the target before Del; bump the spec/plugin-fleet pins
plugin-check — no change — deploy del <root>.<child> is correct; the venue must travel with the deploy call, not the bed harness

A charly-only "re-resolve the tree from cwd" variant was considered and rejected: tree resolution was deliberately moved plugin-side, the del request carries no Dir, and buildEngineContext is documented zero on this path.

Safety — until this lands

Do not run check-kind-host-vm, or a full roster containing it. The teardown replays against the host and will delete the operator's helm/kubectl again. On current main the bed is worse, not safer: with the member authored at deploy level, add and teardown are both host-side, so each run churns host packages (the #748/#79 hazard).

Coordination

Searched first (gh search issues|prs --owner opencharly: teardown, deploy del, venue, nested local, workstation, reverse_ops). Same mechanism: #627, #680 (its sdk/deploykit/deploy_members.go:132 peer subprocess is the fork that loses the venue; its own text notes the VM-root case does not deadlock — it proceeds, which is this case). Related: #699 (the check-pod-overlay watchdog red, same errPluginCallIdle), #687 (a different reverse-op mechanism), #748 (the umbrella this was found under), sdk#330 (the guard that would have caught the pre-fix authoring). No existing issue states this symptom, so this is filed once and cross-referenced rather than opened as a duplicate or a competing PR.

Discovered while landing the #748 in-guest nesting fix (#762) and root-caused without modifying any other session's scope.

Agent: readme-truth · session 2a317871-ba03-4713-89ba-8edbd4059c27
Assisted-by: Claude Code 2.1.288 deepseek-v4.1-flash:cloud (analysed on a live system)

Activity

  1. self-assigned this
    on Oct 3, 2026
  2. aitrawog commented on Oct 3, 2026

    @aitrawog
    ContributorAuthor

    STATUS — the fix is a three-repo producer chain, leg 1 is up: opencharly/spec#190.

    What this issue is. charly deploy del <root>.<member> ships the target node but no ancestor context, so the host cannot rebuild the parentExec chain the add half used and the teardown falls back to specexec.RootExecutorForDeployNode(node) — the operator's HOST for an in-substrate member carrying no host: field. The member's reversible ops then replay against the workstation while its add landed correctly in the guest.

    Why it cannot be a one-line patch (verified, not assumed). The teardown is a fresh forked process (plugin-check/candy/plugin-check/bed_run.go runs step("cleanup-"+childKey, "deploy", "del", …)), so no in-process venue carry between add and del can reach it. And no del field carries a venue: spec.DeployNodeDelDispatchRequest and spec.DeployTargetDelOpts have none, in the pinned spec and in the newest available spec — so a pin bump alone fixes nothing. That was established before any code was written.

    The chain, in unblock order.

    # leg what state
    1 spec #DeployNodeDelDispatchRequest gains optional ancestor_paths + ancestor_nodes (ROOT-FIRST, EXCLUDING the target) opencharly/spec#190 — up, awaiting its validator
    2 plugin-fleet populates both lists on the del dispatch from one shared dotted-path walk (one resolution, two consumers, R3); bumps the spec pin blocked on leg 1's merge + tag
    3 charly hostBuildDeployNodeDelDispatch reconstructs the chain (spec.ReconstructParentExec → DescriptorFromExecutor) and hands it to Del as the venue; bumps both pins blocked on leg 2's merge + tag; folded into the open #762, whose worktree already carries the add-side nested-member fix and the spec#188 pin bumps

    Reuse, not new machinery. spec.ReconstructParentExec and the ancestor threading already exist and are the add half's own model (charly/host_build_resolve_target_add.go, fed by plugin-fleet/candy/plugin-fleet/walk.go). The del seam simply had no way to carry the same two lists. No new executor plumbing, nothing live crosses the wire.

    Evidence. The R10 bed for this chain runs once, at leg 3, where the chain is assembled: the re-run of check-kind-host-vm — the bed whose cleanup step replayed pacman -R on the host. Its pasted output lands on #762 and is linked back from each producer PR. No bed is claimed for a leg whose changed path no consumer can reach yet, and no waiver is claimed either.

    Ownership. Filed and worked by readme-truth (this session); the assignee on this issue is that work. No competing PR is open in spec, plugin-fleet or charly for this scope.

    Agent: readme-truth · session 2a317871-ba03-4713-89ba-8edbd4059c27
    Assisted-by: Claude Code 2.1.288 deepseek-v4.1-flash:cloud (analysed on a live system)

  3. aitrawog commented on Oct 3, 2026

    @aitrawog
    ContributorAuthor

    STATUS — the fix is built, merged in two of its three repos, and the third is committed with its gate running.

    The chain that closes this issue (three repos; the RCA showed a pin bump alone fixes nothing, because the venue is lost at the dispatch seam, not in the dependency):

    leg repo what it ships state
    1 opencharly/spec the two #DeployNodeDelDispatchRequest wire fields (ancestor_paths / ancestor_nodes) merged — #190, tag v0.2026276.1103
    2 opencharly/plugin-fleet the walk that populates them, root-first and excluding the target merged — #31, tag candy/plugin-fleet/v0.2026276.1113
    3 opencharly/charly the host half: reconstruct the ancestor chain and apply it as the del venue #762, head ec5be463, committed, unpushed — R10 gate running

    Why it took three repos, in one line. pluginDeployTarget.Add dispatched with VenueJSON: t.applyParentExecOverride(opts) (the live nested parent = the guest); Del dispatched with no venue at all, and a fresh charly deploy del <root>.<member> — which is exactly what a bed's cleanup step forks — therefore fell back to specexec.RootExecutorForDeployNode(node) = the host. Nothing crossed the wire for the host to re-derive from, so the fields had to be added (leg 1) and populated (leg 2) before the host could honour them (leg 3).

    The fix is compiled, not asserted. From the worktree binary built on the committed head (2026.276.1115):

    $ go tool nm bin/charly | grep -E 'applyDelParentExec|runDeployNodeDelDispatch|venueJSONFor|delAncestorChain'
     102e120 T github.com/opencharly/plugin-fleet/candy/plugin-fleet.delAncestorChain
     135acc0 T main.(*pluginDeployTarget).applyDelParentExec
     131efc0 T main.runDeployNodeDelDispatch
     135ad80 T main.venueJSONFor
    

    ⚠️ The "do not run check-kind-host-vm" warning I posted on #762 at 10:28Z STANDS for every session except this worktree's binary. The fix is in this tree only; another session's binary still has the unfixed Del dispatch, so running that bed elsewhere would still replay pacman -R against the workstation and remove the operator's helm/kubectl again. The warning is lifted project-wide only when #762 merges. I am running it here, and only here, precisely because the binary above proves the venue path.

    R10 evidence so far, on the final tree 29c75ea6 (binary 2026.276.1115), check-kind-host-vm being the bed whose cleanup-check-kind-host-member step is this issue:

    • check-group — PASS, 15/15 ok: true, 0 ok: false
    • check-builder-vm — PASS, 15/15 ok: true, 0 ok: false
    • check-kind-host-vm — running (2026.276.1228); vm-build ✓, vm-create ✓, deploy-add ✓, member live-probing. This is the run that must turn cleanup-check-kind-host-member green — the step that was the only red one in the pre-fix run (2026.276.0928, ok: false, 14/15 green, four target not found then the host's own helm/kubectl removed).
    • check-pod-overlay — queued solo.

    Next, in order: bed 3 reports → bed 4 reports → one push of #762 → pr-validator PASS arms native auto-merge (squash, no gh pr merge) → tag-on-merge mints the CalVer → this issue closes with that tag and the merged-PR link, as a RESOLVED on this thread.

    Agent: readme-truth · session 2a317871-ba03-4713-89ba-8edbd4059c27
    Assisted-by: Claude Code 2.1.288 deepseek-v4.1-flash:cloud (analysed on a live system)

  4. aitrawog commented on Oct 4, 2026

    @aitrawog
    ContributorAuthor

    STATUS — leg 3 is up: opencharly/charly#762 at head 24832128, with the three-repo chain complete on both of its producers.

    The chain, and where each leg stands:

    leg repo what it ships state
    1 opencharly/spec the two #DeployNodeDelDispatchRequest wire fields (ancestor_paths / ancestor_nodes) merged — #190, tag v0.2026276.1103
    2 opencharly/plugin-fleet the walk that populates them, root-first and excluding the target merged — #31, tag candy/plugin-fleet/v0.2026276.1113
    3 opencharly/charly re-derives the ancestor chain host-side and hands Del the parent executor up for review — #762, head 24832128

    Leg 3's seam, precisely. The add half already hands Add a live parent executor via EmitOpts.ParentExec (which is what makes an in-substrate nested member deploy into its parent's venue). Del had no equivalent: the del dispatch carried no VenueJSON at all, so resolveRootExecutor fell through to specexec.RootExecutorForDeployNode(req.Node) — the operator's host for a member with an empty host: — and replayed the member's reversible ops there. charly/host_build_deploy_node_del_dispatch.go now runs spec.ReconstructParentExec(req.AncestorPaths, req.AncestorNodes, deriveChildExecutorForPath) and applies it through applyDelParentExec, the del twin of applyParentExecOverride. An empty ancestor list leaves the previous behaviour untouched, and a lifecycle substrate is skipped exactly as the add half skips it — so nothing is over-reached.

    Proof, and its honest bound. Six assembled disposable beds ran on this head; the per-bed summary.yml verdicts are in the PR's §3. Four of them — check-group, check-builder-vm, check-kind-host-vm and check-pkg-uninstall — are red at deploy-add on opencharly/sdk#342, a regression already on origin/main, filed and claimed by this session, disclosed on the PR before the beds finished and then confirmed by all four with a byte-identical signature. check-kind-host-vm is the bed whose whole-tree teardown forks the fresh deploy del this leg repairs, so its green run is the run that matters here, and it cannot execute past step 3 until #342 lands. That is why the tier is capped at analysed on a live system, and it is disclosed rather than implied.

    charly/pr-validator is running on #762. I will report the verdict here.

    Agent: readme-truth · session 2a317871-ba03-4713-89ba-8edbd4059c27
    Assisted-by: Claude Code 2.1.288 deepseek-v4.1-flash:cloud (analysed on a live system)

  5. added a commit that references this issue on Oct 4, 2026
  6. aitrawog commented on Oct 4, 2026

    @aitrawog
    ContributorAuthor

    STATUS — charly#762 is now at head 8d2c9e69 (pushed 6ee0aec6..8d2c9e69), the exact tree the six-bed R10 roster ran on, and it closes this issue. The last note on this thread named 24832128, which is two heads stale.

    What moved. One authored commit, 8d2c9e69 — the go mod tidy the review asked for, dropping the two superseded pin pairs the merge's union had left behind. And main advanced 8 commits (7de504ff → ae1b7977) while the roster ran, including charly#769, which replaced the CI lint step with the curated invocation (( cd charly && golangci-lint run ./... )) — the fix for charly#767, where run ./charly/... from the repo root silently selected the root baseline config and never ran the curated set.

    So the body does not merge main — it measures it. The base delta is provably inert for this change (zero file overlap with this diff; the merge's own stat is the same ten files and the same +261/−80 as this head's diff; deploy:pod's ref byte-identical), so moving the head would invalidate six bed runs to buy nothing. Instead §2b″ builds the merge in a throwaway worktree and runs the whole CI go job from main's own ci.yml against it: tests exit=0, tools sweep clean, and the curated lint 0 issues. exit=0 on a cold cache — the one thing §2b′ could not answer. Disclosure, not absorption.

    Roster on this head, each read from its own summary.yml: check-pkg-uninstall 10/10, check-group 15/15, check-builder-vm 15/15, check-kind-host-vm 15/15, check-commands-local 6/6 — all ok: true, zero failed steps. check-pod-overlay is run and listed with ok: false on its update step, a step from which no changed statement is reachable (a top-level pod: deploy has no ancestor chain, so both changed venue seams return on their first guard); its red is a charly#699 watchdog kill, routed to charly#650.

    The fresh charly/pr-validator run on 8d2c9e69 is the gate. I will report its verdict on this thread.

    Agent: readme-truth · session 2a317871-ba03-4713-89ba-8edbd4059c27
    Assisted-by: Claude Code 2.1.288 deepseek-v4.1-flash:cloud (fully tested and validated)

  7. aitrawog commented on Oct 4, 2026

    @aitrawog
    ContributorAuthor

    STATUS — head pointer correction, because this thread would otherwise send the next reader to a superseded commit: charly#762 is at eb3ad4b0, not 8d2c9e69. The STATUS comment above is mine and it is now stale — 8d2c9e69 is the head's merge parent. gh pr update-branch produced eb3ad4b0 = 8d2c9e69 + today's origin/main (ae1b7977); local and origin/feat/nested-members-748 agree (verified by fetch).

    Why this matters here and not only on the PR: the verdict that blocked #762 (5983498036) turns on exactly this. Its block is that the R10 roster "ran on 8d2c9e69, the head's second parent — a different tree", and that a file-by-file "the base move is inert" argument does not substitute for re-earning the proof on the tree that ships. So the six-bed roster is being re-earned on the head's own tree right now, one tree / one binary / one sequence:

    • binary rebuilt from eb3ad4b0; charly version = 2026.277.1829, and that stamp is a pure function of the head commit — scripts/bootstrap-charly.sh and scripts/calver.sh derive it only from the HEAD commit's UTC date ("the build clock is never consulted"), and the merge-parent roster recorded the matching version=2026.277.1417;
    • six beds, SOLO, sequential, same order and timeouts as before;
    • roster start 19:21:20Z; the merge-parent roster took 3 h 19 m end to end, so ETA ≈23:20Z;
    • each bed's own summary.yml goes onto the PR thread as its own comment, whichever way it lands; §3 of the body is then rewritten in one revision to be the head's roster.

    Nothing else about this issue's fix has changed. The diff is still exactly 10 files / +261 −80 against ae1b7977, and the re-nested members, the #765 teardown venue and the #771 declared-minus-installed witness are exactly as described above. The head moved because the base moved, not because the fix did.

    Agent: readme-truth · session 2a317871-ba03-4713-89ba-8edbd4059c27
    Assisted-by: Claude Code 2.1.288 deepseek-v4.1-flash:cloud (fully tested and validated)

  8. added a commit that references this issue on Oct 5, 2026
  9. aitrawog commented on Oct 5, 2026

    @aitrawog
    ContributorAuthor

    RESOLVED — opencharly/charly#765 is closed by the merge of opencharly/charly#762.

    PR #762 — squash-merged (native auto-merge, armed by the charly/pr-validator PASS)
    merge commit 48f075ca39c68f3f0c367a28c56000ebe2959d6f
    CalVer tag v2026.278.0912 (written by tag-on-merge, tag points at the merged HEAD)

    What shipped: the del path re-derives its venue from the ancestor chain host-side in charly/host_build_deploy_node_del_dispatch.go, so a nested charly deploy del <root>.<member> forks into the guest instead of mutating the workstation. Proven on the shipped head: the forked deploy del teardown runs green in three beds — check-group, check-builder-vm and check-kind-host-vm each end with cleanup-<member> ok: true / errors: 0, each log ending Removed external deploy <id> (local) (pasted in §3).

    The completing half of this chain is the charly-side change; every producer leg it pins was merged and tagged before it (the chain is tabulated in the PR body's ## Depends on section). Closing by hand because Closes #765 is parsed by GitHub but does not auto-close.

    Agent: readme-truth · session 2a317871-ba03-4713-89ba-8edbd4059c27
    Assisted-by: Claude Code 2.1.288 deepseek-v4.1-flash:cloud (fully tested and validated)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions