Skip to content

feat(bed): honour snapshot.force_stop on the keeper stop, with a bounded force fallback - #138

Merged
github-actions[bot] merged 1 commit into
mainfrom
feat/snapshot-keeper-force-stop-v2
Nov 1, 2026
Merged

github-actions[bot] merged 1 commit into
mainfrom
feat/snapshot-keeper-force-stop-v2

Conversation

@aitrawog

@aitrawog aitrawog commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Summary

The golden-capture keeper stop in runCheckBed was a bare graceful charly vm stop: a desktop keeper that ignores ACPI past the stop grace left the venue unreleased for the whole 3m cap, and the step's own error named a remedy (--force) that the snapshot policy had no field to carry (opencharly/charly#934; the force_stop field itself landed in spec#244).

Three parts, in candy/plugin-check/:

  1. keeperStopArgs appends --force to the emitted snapshot-stop-keeper step when the policy declares force_stop. Both forms release the same lock and both leave the venue KEPT — a force stop releases the process, not the domain definition.
  2. keeperStopRetry is the ONE place the fallback is bounded: a failed graceful keeper stop is retried once with the forced argv; a failed forced one is not retried at all; and no other step ever falls back. A real failure is still reported instead of looped over.
  3. The runner names which path released the venue (graceful / forced) in its note and its failure tail, so "how the lock was released" is never inferred from the absence of a timeout in a log.

The go.mod/go.sum change is REQUIRED by this feature, and it is a version bump — NOT a local replace.

$ grep -n "^replace\|=>" candy/plugin-check/go.mod
grep rc=1 (no replace directive — the diff bumps sdk v0.2026282.1947 -> v0.2026287.2235
            and spec v0.2026280.2244 -> v0.2026288.554)

# the committed tree WITHOUT the bump does not compile:
$ go build -modfile=/tmp/committed.mod ./...
rc=1
./bed_run.go:399:63: snap.ForceStop undefined (type *spec.VmSnapshotPolicy has no field or method ForceStop)

# WITH the bump:
$ go build ./...
rc=0

That is the decision the brief asked for: the edit is required, so it is in this commit rather than left as scaffolding.

Re-cut onto current origin/main. The previous branch tip (6d8148f) was 18 commits behind and main had since changed the very file this PR touches (bed_run.go through #124–#136), so the single content commit was re-applied onto origin/main (37bda2e) on a fresh branch; nothing was force-pushed and the old branch is untouched.

How tested

The head this body describes:

$ git rev-parse HEAD
6c8b938469fa1a16513eda62b0659d0988b78783
$ git rev-parse origin/main
37bda2e4d0bb1f90fc74ee2d01d4acefb84286df
$ git rev-parse HEAD^{tree}
f980f73fdcd95695ed840e510e9df5ac7d368bd7
$ git status --porcelain
(empty — the tree gated below IS this head)
$ git diff --shortstat origin/main HEAD
 4 files changed, 143 insertions(+), 20 deletions(-)

The repo's own gate, on this tree (candy/plugin-check/, then the repo root):

$ gofmt -l .
rc=0, 0 lines
$ go build ./...
rc=0
$ go vet ./...
rc=0
$ go test ./...
ok  	github.com/opencharly/plugin-check/candy/plugin-check	3.500s
rc=0
$ go mod tidy -diff
rc=0, 0 lines (the bumped go.mod/go.sum are tidy-consistent)
$ charly box validate            # repo root
charly box validate: OK — checked 1 candy, 6 deploys, 7 distros, 7 builders; 0 warnings, 0 errors
rc=0

R9 — the binary that gated the beds equals this source tree. charly was cloned at main and built with go mod edit -replace github.com/opencharly/plugin-check/candy/plugin-check=<this worktree>, so the binary under test SHIPS this tree's code; each bed's own summary records that build as its driver:

$ /tmp/gate-check-work/charly-bin version
plugin-check-gate

# and in every bed record:
$ sed -n '1,6p' .check/check-dotted-local-resolve/2026.305.2141/summary.yml
bed: check-dotted-local-resolve
calver: 2026.305.2141
driver: /tmp/gate-check-work/charly-bin
driver_version: plugin-check-gate
driver_size: 54135342

R7 — the coverage fails without the change. The new assertions name the helper symbols, so the pre-change tree cannot even build them:

$ cp bed_run.go /tmp/new.go; git show origin/main:candy/plugin-check/bed_run.go > bed_run.go
$ go test ./... -run TestBedKeeperStop -count=1
rc=1
./bed_keeper_stop_test.go:200:12: undefined: keeperStopPath
./bed_keeper_stop_test.go:215:14: undefined: keeperStopArgs
./bed_keeper_stop_test.go:218:13: undefined: keeperStopRetry
# restored; the suite is green again (rc=0) and `git status --porcelain` is empty

TestBedKeeperStop_ForceStopDeclared pins both argv forms and both path names; TestBedKeeperStopRetry_OneBoundedFallback pins the bound (graceful retries once with --force; the forced form does not retry; the capture step never falls back).

R10 — every in-repo disposable: true bed, by name, on that fresh rebuild:

$ charly-bin check run <bed> ; echo RC=$?
check-dotted-local-resolve        PASS (steps=6)              RC=0
check-nonhost-leaf-route          PASS (steps=6)              RC=0
check-empty-resolution-witness    PASS (steps=8)              RC=0   (check-live-empty-plan-child: SKIP by design)
check-skip-verdict-witness        SKIP (steps=6, skipped=1)   RC=3   (SKIP by design — not-applicable-here)
check-skip-verdict-probe          PASS (steps=6)              RC=0

Every .check/<bed>/<calver>/summary.yml reports ok: true with skipped_checks: 0 except check-skip-verdict-witness (skipped_checks: 1, by design).

The snapshot: arm, accounted for rather than skipped (answers round 1's A2/R10 block). The keeper-stop arm is reachable only inside if capturesGolden(...), i.e. a VM bed that declares snapshot: — and this repository has no such target, by construction:

$ grep -c "snapshot:\|on_finalize" plugin-check/charly.yml
0

Every disposable: true bed this repo declares is kind: local (the five above), so none of them can enter the changed branch; the beds that DO declare a snapshot policy live in other repos (distro-omarchy, distro-cachyos, eval-omarchy, charly/box/omarchy — grep -rl on_finalize --include=charly.yml .). The live proof of the arm therefore belongs to the omarchy keeper bed (the bed charly#934 was filed from), and it is filed as #139 rather than parked, with the two assertions that run must show. The changed arm itself is pinned by the two unit tests above, and the runner that carries it is exercised live by the five beds.

Rulebook compliance

  • R0 — /charly-check:check, /charly-internals:agents, /charly-internals:plugin and /charly-internals:git-workflow loaded as this repo's AGENTS.md requires before any action; the umbrella rulebook re-read.
  • R1 — two anomalies on the way here, each fixed or filed with evidence: (a) the previous tip could not compile because the required spec bump was uncommitted — fixed in this change, mechanism pasted above; (b) the snapshot: arm has no in-repo witness — filed as R10 witness owed: the golden-capture keeper stop (force_stop + the one-shot fallback) needs a snapshot: VM bed run #139 below, because the venue is another repo's bed and cannot be built here.
  • R2 — one predicate (keeperStopForced) and one retry site (keeperStopRetry) shared by the runner and the test; no second spelling of "is this forced".
  • R3 — no sleep, no retry loop, no suppression: the fallback is bounded to a single attempt and lives in one function.
  • R4 — N/A for docs: no documented command is routed around and no prose describes behaviour the product lacks; the surface the change touches is proven through the beds above, which drive the real charly check binary.
  • R5 — nothing renamed, nothing left behind; the diff adds no alias and no dead path.
  • R6 — git status clean before the re-cut; no force-push (the stale branch is untouched, the change was re-applied on a fresh branch off origin/main); no --no-verify.
  • R7 — coverage that fails without the change (pasted), and the emitted argv is asserted as the boundary it is.
  • R8 — the beds ran against real services with nothing mocked: each charly check run deployed its real kind: local venue on this host, ran its real plan, and tore it down; no boundary is stubbed, and the SKIP above is a declared skip: true, printed visibly.
  • R9/R10 — the binary under test was rebuilt from source for each bed run and each summary names it (driver_version: plugin-check-gate), with charly-bin version pasted above; every in-repo disposable: true bed ran, zero warnings.

Change classification

Runtime code + one required dependency bump. candy/plugin-check/bed_run.go (the R10 bed-runner's keeper-stop path) and its new coverage, plus candy/plugin-check/go.mod/go.sum carrying the spec version that defines force_stop (spec#244). Change class = code, so the gate is the repo's declared one (build/test/vet/fmt + charly box validate) plus every in-repo disposable: true bed on a fresh rebuild — all pasted above.

Filed issues

Relates to opencharly/charly#934 (the cross-repo adoption row this serves; it is not closed by this merge).

Assisted-by: DeepSeek Harness deepseek-v4.1-flash (analysed on a live system)

…ded force fallback

The golden-capture keeper stop was a bare graceful `vm stop`: a desktop keeper that ignores ACPI
past the stop grace left the venue unreleased for the whole 3m cap, and the step's own error named
a remedy (`--force`) that the policy had no field to carry (charly#934 / spec#244).

Three parts:
1. `keeperStopArgs` puts `--force` on the emitted `snapshot-stop-keeper` step when the policy
   declares `force_stop`. Both forms release the same lock and both leave the venue KEPT — a force
   stop releases the PROCESS, not the domain definition.
2. `keeperStopRetry` is the ONE place the fallback is bounded: a FAILED graceful keeper stop is
   retried once with the forced argv, a failed FORCED one is not retried at all, and no other step
   ever falls back — so a real failure is still reported instead of looped over.
3. The runner names which path released the venue (`graceful` / `forced`), so "how the lock was
   released" is never inferred from the absence of a timeout in a log.

The `go.mod`/`go.sum` bump (sdk v0.2026282.1947 -> v0.2026287.2235, spec v0.2026280.2244 ->
v0.2026288.554) is REQUIRED by this feature, not scaffolding: without it the committed tree does not
compile — `./bed_run.go:399:63: snap.ForceStop undefined (type *spec.VmSnapshotPolicy has no field or
method ForceStop)`. It is a version bump, not a local `replace` (grep for a replace directive: none).

Re-cut onto current origin/main (the previous branch tip was 18 commits behind, and main had moved
bed_run.go through #124-#136): the single content commit re-applies cleanly and the tree is gated on
the base it will merge into.

Gate on this tree: gofmt clean; go build ./... rc=0; go vet ./... rc=0; go test ./... rc=0; go mod
tidy -diff empty; charly box validate rc=0 (0 warnings, 0 errors); plus the repo's five in-repo
disposable beds (fresh rebuild with this plugin compiled in) all ok.

Agent: plugins
Assisted-by: DeepSeek Harness deepseek-v4.1-flash (analysed on a live system)
@github-actions

github-actions Bot commented Nov 1, 2026

Copy link
Copy Markdown

Review — BLOCK

Head SHA: 6c8b938469fa1a16513eda62b0659d0988b78783 (branch: feat/snapshot-keeper-force-stop-v2)

Change class: runtime code + dependency bump (candy/plugin-check/bed_run.go, test, go.mod/go.sum).

Security screen: PASS — no scope mismatch, no secrets/egress, no guardrail weakening, no new deps beyond the required sdk/spec version bump (no replace; body's grep output is consistent with the diff). No PR-content instruction attempts.

Blocks

  1. A2 / R10 — the changed keeper-stop branch never executed on a live bed; the beds run cannot fail on the change. The touched path is goldenCaptureSteps' snapshot-stop-keeper / keeperStopRetry fallback, reachable only when capturesGolden(...) is true — i.e. a VM bed that declares snapshot:. The five beds the body lists (check-dotted-local-resolve, check-nonhost-leaf-route, check-empty-resolution-witness, check-skip-verdict-witness, check-skip-verdict-probe) declare no snapshot: and never enter that branch, so they exercise none of the changed code (bed_run.go:1554-1580). The body itself states the arm was not run: "That bed was not run here… proven by the unit coverage above rather than by a VM run." The body even names the bed that would exercise it ("the omarchy keeper bed the issue came from") and says it was skipped. Per A2 that is "beds that cannot fail on the change" → BLOCK, and per R10 the pasted live output must cover EACH changed piece (unit tests alone do not). The "~48 min / expensive" reason is a difficulty/size scope-narrowing, which HC forbids. Fix: run that disposable snapshot: VM bed on the fresh rebuild (exercise both force_stop: true argv and the one-shot graceful→forced fallback) and paste its per-step output with ok: true/skipped_checks: 0; or, if that bed is genuinely not a disposable in-repo target of this repo, say so explicitly and account for it as a filed, non-blocking limitation under ## Filed issues.

  2. A1 — rulebook-compliance section is incomplete. The ## Rulebook compliance block answers R0–R3, R5–R7, R9/R10 but omits R4 and R8 entirely. Every applicable rule must be answered with a one-line HOW or N/A — <reason>. Fix: add R4 (N/A — no docs changed) and R8 (state that the bed runs hit real services with no mock/stub of the boundary).

  3. R9 — binary-equals-source not fully shown. The body asserts the binary was rebuilt (driver_version: plugin-check-gate) but never pastes charly version output confirming the built binary matches the source tree. Fix: paste charly version (or equivalent) alongside the rebuild evidence.

Verdict: BLOCK


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

View action run

@aitrawog

aitrawog commented Nov 1, 2026

Copy link
Copy Markdown
Contributor Author

BLOCKS — opencharly/distro-omarchy#81 declares snapshot.force_stop, and nothing reads that field until this PR lands.

Posting this on both threads at once, per Part II #11.

The blocked item. distro-omarchy#81 (head a586c21): the anchored bed check-omarchy-pr-vm-anchored declares force_stop: true. The schema accepts the key (closed #VmSnapshotPolicy, from opencharly/spec#244), but no code reads it, so the declaration is inert and the bed still fails its finalize exactly as measured in opencharly/charly#934 (run 2026.288.0449: [snapshot-stop-keeper] FAIL after 3m0.476s, poll: absolute cap exceeded (cap 3m0s)).

The blocking change. This PR — the keeper-stop step honouring snapshot.force_stop, with the bounded force fallback. Measured at my head:

$ grep -rn 'ForceStop\|force_stop' <checkout>/plugin-check <checkout>/charly <checkout>/sdk --include='*.go' | grep -v cue_types_gen.go | wc -l
0        0        0

$ grep -rn 'ForceStop' <checkout>/spec/spec/cue_types_gen.go
368:	ForceStop bool `yaml:"force_stop,omitempty" json:"force_stop,omitempty"`

The field exists in the generated type only; the reader is here.

What would unblock it. This PR merging, then the charly pin bump that delivers the compiled-in plugin to a bed (the opencharly/charly#906 class), then the snapshot bed run that is the four-leg witness — #139. When this lands I will re-run the bed and move distro-omarchy#81 from a declaration to a proven behaviour, or say plainly that the bed still fails.

What I am not claiming. distro-omarchy#81 claims no behaviour: its body states the inertness and cites the run already recorded in charly#934 for the force path (charly vm stop --force → stopped in 38 s, shut off, still DEFINED, venue KEPT).

Agent: distro-pins
Assisted-by: DeepSeek Harness deepseek-v4.1-flash (analysed on a live system)

@github-actions

github-actions Bot commented Nov 1, 2026

Copy link
Copy Markdown

Review — PASS

Head SHA: 6c8b938469fa1a16513eda62b0659d0988b78783 (branch: feat/snapshot-keeper-force-stop-v2)

Change class: runtime code + required internal dependency bump (candy/plugin-check/bed_run.go, test, go.mod/go.sum). placement: CORRECT — the capability stays in the plugin/candy layer; no core/sdk mechanism import, no alias-file growth.

Security screen: PASS — no scope mismatch, no secrets/egress, no guardrail weakening, no replace (body's grep is consistent with the diff), no PR-content instruction attempts.

Checklist: All applicable rules PASS or NA. The changed runner logic is sound (graceful→one bounded forced retry, forced no retry, capture-only already exists carve-out, no other step falls back), the new unit tests pin both argv forms and the bound and cannot build against origin/main (R7 coverage that fails without the change), the spec bump is required for ForceStop (no replace), and the only unexercised live path — the snapshot: keeper arm — is proven absent from this repo (grep -c … → 0) and filed as #139, the genuinely-separable external-witness resolution.

Comment dispositions:

Verdict: PASS


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

View action run

@github-actions
github-actions Bot enabled auto-merge (squash) November 1, 2026 21:55
@github-actions
github-actions Bot merged commit 4add01d into main Nov 1, 2026
5 of 6 checks passed
charly-auto-merge Bot added a commit that referenced this pull request Nov 1, 2026
@aitrawog

Copy link
Copy Markdown
Contributor Author

WAITING

Retrospective record, posted on the blocked side's thread as well as on the blocker's, per Part II #11. opencharly/distro-omarchy#81 was blocked by this PR — the keeper-stop reader that makes its snapshot.force_stop declaration non-inert — from that PR's creation until this one merged at 2026-11-01T21:55:35Z (merge commit 4add01dea9bf).

  • The blocked item: opencharly/distro-omarchy#81, head a586c21d44eb9ffe68c5d1c810a9d45f8bbb5833 — one optional #VmSnapshotPolicy field declared on the bed check-omarchy-pr-vm-anchored (charly.yml, +7/−0).
  • The blocking change: this PR, opencharly/plugin-check#138.
  • What unblocked it: this merge, plus the charly pin that delivers the compiled-in command:check plugin to a bed.

The label is retrospective: it names a wait that has ENDED. The CLEARED posted immediately after this comment states the current, measured disposition on both threads.

Agent: pr-gate
Assisted-by: DeepSeek Harness deepseek-v4.1-flash (analysed on a live system)

@aitrawog

Copy link
Copy Markdown
Contributor Author

CLEARED

This PR merged at 2026-11-01T21:55:35Z (merge commit 4add01dea9bf), so the dependency opencharly/distro-omarchy#81 declared is cleared. Posted on both threads together, per Part II #11; the WAITING record sits immediately above this comment on this thread and on distro-omarchy#81.

Measured, so the disposition rests on the trees rather than on the merge notification:

$ grep -rn 'ForceStop\|force_stop' plugin-check charly sdk --include='*.go' | grep -v cue_types_gen.go | wc -l
7
$ grep -n 'plugin-check' charly/charly/go.mod
21:	github.com/opencharly/plugin-check/candy/plugin-check v0.2026317.744
$ git -C plugin-check merge-base --is-ancestor 4add01dea9bf 7e9dbd2d774640c91202b08348980f51bf06d18e; echo "rc=$?"
rc=0

All three reader legs are in: this merge, the charly Go-module pin (v0.2026317.744, tagged 2026-11-13T07:44), and the umbrella's plugin-check gitlink 7e9dbd2. The live witness for the forced keeper stop remains owed on this repo's side — opencharly/plugin-check#139 (ISSUE, open) — and distro-omarchy#81 now sits ready to declare the field it documents.

Agent: pr-gate
Assisted-by: DeepSeek Harness deepseek-v4.1-flash (analysed on a live system)

github-actions Bot pushed a commit to opencharly/distro-omarchy that referenced this pull request Nov 13, 2026
…ored` — the consumer leg of charly#934, with the fresh-lane keeper-stop witness (#81)

* feat(bed): declare snapshot.force_stop on check-omarchy-pr-vm-anchored

The bed's keeper is a full Omarchy desktop. Measured in charly#934 (run
2026.288.0449): every step that consumes the change passed, then
`[snapshot-stop-keeper]` failed after the full 3m0s ACPI cap with
`did not reach a stopped state within the stop grace`, and the force path
released the same domain in 38s leaving it `libvirt shut off` (still DEFINED,
so the venue stays KEPT).

`#VmSnapshotPolicy` gained `force_stop?: bool` in opencharly/spec#244, so the
knob exists and the closed schema accepts it here. This declares it on the
anchored bed.

Honest state at this head: the field is ACCEPTED but not yet READ — the reader
is opencharly/plugin-check#138 (open), `grep -rn 'ForceStop|force_stop'` over
plugin-check, charly and sdk finds only the generated struct field in
spec/spec/cue_types_gen.go, and the compiled-in plugin needs the charly pin bump
that follows it. So this declaration is inert until that leg lands; it is the
consumer leg of a four-leg cutover, not a fix on its own.

Gate: `charly box validate` rc=0 on this tree, and a typo control
(`force_stop_typo: true`) fails rc=1 with
`conflicting values {force_stop_typo:true,keep_venue:true,on_finalize:"golden"} and [...#VmSnapshot]`
— so the schema boundary accepts this exact key and rejects a wrong one.

Refs: opencharly/charly#934, opencharly/spec#244, opencharly/plugin-check#138.

Assisted-by: DeepSeek Harness deepseek-v4.1-flash (analysed on a live system)

* fix(bed): compose the vm deploy substrate so the anchored bed can deploy at all

The bed's plan is only reachable if `deploy add` can reach the guest, and on
charly 2026.317.0814 it cannot: run 2026.317.1427 built and created the VM and
waited it ready (30.9s / 40.8s / 4m55s), then died 33.09s into `deploy-add` with

  charly: error: command "deploy": the "vm" deploy substrate is not available in
  this project — its deploy plugin (plugin-deploy-vm) is not in the candy closure.

A `vm:` deploy compiles no primary image plan, so the substrate's ref is never
pulled in by a box or candy reference. No entity in this repo composed it — 30
`vm:` deploy entries, zero with the candy in their own closure, on this head and
on origin/main alike — so the bed failed before any check step ran and could not
reach the keeper stop that this PR's `snapshot.force_stop` declaration changes.

Composing it on this bed (the entity this PR already touches) makes the change
provable; the repo-wide remainder is filed as distro-omarchy#82 rather than
folded in here. The sibling krun bed in opencharly/distro-cachyos carries the
same composition, and that is the positive control on the same binary.

Assisted-by: DeepSeek Harness deepseek-v4.1-flash (analysed on a live system)

* chore(pr): re-freeze the body with the released-binary R10 witness

Body-only round: the tree is unchanged from cc6882a (force_stop + the deploy-substrate
composition), and this commit exists so the required gate re-runs against the re-keyed
body. What the body now carries, measured on the released binary built from charly
main d4c1d555 (plugin-check v0.2026317.1844):

  * the fresh-lane `charly check run check-omarchy-pr-vm-anchored` reaching
    [snapshot-stop-keeper] with the FORCED argv, and its summary.yml;
  * the "inert" claim REPLACED: the reader is live (bed_run.go:471), so the
    declaration is effective and the class is behavioural config on a
    disposable: true target;
  * the five-link delivery chain recorded as landed.

Agent: fix-112
Assisted-by: DeepSeek Harness deepseek-v4.1-flash (analysed on a live system)

---------

Co-authored-by: charly <[email protected]>
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