Skip to content

feat(schema): add force_stop to #VmSnapshotPolicy — the keeper-stop knob its own error already names - #244

Merged
github-actions[bot] merged 1 commit into
mainfrom
feat/vm-snapshot-force-stop
Oct 15, 2026
Merged

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

Conversation

@aitrawog

Copy link
Copy Markdown
Contributor

Summary

#VmSnapshotPolicy gains force_stop?: bool @go(ForceStop) — the knob that the keeper-stop's own error message already tells readers to reach for, and that no bed could express until now.

$ git diff --stat origin/main..HEAD
 schema/_common.cue    | 12 +++++++++++-
 spec/cue_types_gen.go | 13 ++++++++++++-
 2 files changed, 23 insertions(+), 2 deletions(-)

$ git diff origin/main..HEAD -- schema/_common.cue
 #VmSnapshotPolicy: {
 	...
 	keep_venue?:         bool @go(KeepVenue)
+	// force_stop: stop the keeper with a FORCE stop (kill the domain process)
+	// rather than a graceful ACPI shutdown, when the finalize releases the
+	// venue lock. ...
+	force_stop?:         bool @go(ForceStop)
 }

$ git diff origin/main..HEAD -- spec/cue_types_gen.go | grep ForceStop
+	ForceStop bool `yaml:"force_stop,omitempty" json:"force_stop,omitempty"`

Why a knob was needed, measured on the tree that failed (distro-omarchy's check-omarchy-pr-vm-anchored, run 2026.288.0449) — every step that consumes the change passed, and the run still reported ok: false, because the finalize's stop could not express the remedy its own message prints:

[snapshot-stop-keeper] FAIL after 3m0.476s: exit 1
charly: error: command "vm": VM charly-check-omarchy-pr-vm-anchored: did not reach a stopped state within
  the stop grace (still running) — use 'charly vm stop --force' if the guest ignores ACPI:
  stop domain charly-check-omarchy-pr-vm-anchored: poll: absolute cap exceeded (cap 3m0s)

And the force path is safe, proven on a live disposable: true target before any of this was written:

$ charly vm stop --force check-omarchy-pr-vm-anchored
Stopped VM charly-check-omarchy-pr-vm-anchored          # 38 s, where ACPI had failed for 3m0s
$ charly vm list | grep omarchy
charly-check-omarchy-pr-vm-anchored  libvirt  shut off  # shut off, still DEFINED

The venue stays KEPT either way — a force stop releases the process, not the domain definition — which is exactly what snapshot-stop-keeper is for (releasing the golden's exclusive qemu write lock after the capture).

This is the producer leg of a four-leg cutover, and the chain is the reason it is one change:

  1. spec (this PR) — the field exists.
  2. plugin-check — the keeper-stop step honours it, and falls back to a force stop when the graceful one fails, reporting which path it took.
  3. charly — a pin bump, so the new step reaches a bed at all (plugin-check is compiled in).
  4. distro-omarchy — the bed declares force_stop: true, and its finalize is the single R10 witness for all four legs.

The field is additive and optional, so no authored wire key changes and no migration machinery is involved (AGENTS.md: a pure @go() annotation preserves the wire key; the closed schema makes an unknown key a hard field not allowed error, which is why the producer must land before any consumer declares it — hence the order above).

How tested

charly task cue-gen on this tree, with the worktree-local build (charly version → 2026.287.2312), both steps pass including the repo's own reproducibility gate:

task cue-gen: 2 step(s), 0 failed
  [pass] run — gengotypes + schemagen the generated Go
  [pass] check — regen is reproducible — TestGenReproducible passes on the committed tree

and the module's own gates (AGENTS.md):

$ gofmt -l .                  # empty — clean
$ GOWORK=off go build ./...   # rc=0
$ GOWORK=off go vet ./...     # rc=0
$ GOWORK=off go test ./...    # rc=0, 0 FAIL
ok  github.com/opencharly/spec/schema        10.675s
ok  github.com/opencharly/spec/spec           1.494s
ok  github.com/opencharly/spec/transport      0.219s

The generated artefact is validated at its boundary: the diff is exactly one field, with the force_stop wire key, and the second cue-gen run is a no-op.

Rulebook compliance

  • R0 — skills loaded before acting: /charly-internals:go (SDD + the schema-change recipe), /charly-internals:plugin, /charly-check:check, /charly-internals:vm-spec, /charly-internals:git-workflow, /charly-internals:strict-policy; and this repo's own AGENTS.md (Part II feat(spec): CUE-source ResolvedBox/BuilderMap/AggregatedCandyCaps (#55 step3 unit 3a) #4).
  • R1 — the anomaly (a bed failing after its change-consuming steps all passed) was root-caused before any fix: the step that needs --force is the step that cannot pass it, and every alternative was rejected on measurement, not taste (a graceful→force fallback alone would make every keeper stop pay ~3 min of dead ACPI wait; evicting another session's scratch was refused earlier in this campaign and filed separately). Filed as charly#934; the field is the producer half of its fix.
  • R2/R5 — additive: one new optional field, no duplicate path, nothing deleted, no shim, no replace, no go.work in the shipped tree.
  • R3 — no workaround: the consumer honouring this field is a real opt-in, and the fallback lives in the step that owns the stop.
  • R6 — a fresh worktree off fresh origin/main; git status clean before the commit; branched beside spec#242 (feat/plugins-carry) in a disjoint file area, verified before the first edit.
  • R7/R10 — the emitted artefact (the generated Go type) is verified after regeneration, the reproducibility gate is the repo's own, and the runtime R10 for this field is the consumer chain's bed, named above and in each leg.
  • SDD — CUE first, Go generated, a clean regeneration is a no-op.

Change classification

  • Diff: schema/_common.cue + the generated spec/cue_types_gen.go — one optional field on #VmSnapshotPolicy.
  • Change class: contract/library module — this repo's own committed CI (build, test, gofmt, lint) plus the org charly/pr-validator is the gate; this repo carries no per-repo candy gate.
  • Behaviour change: none on its own — the field is inert until a consumer reads it; the consumer legs are named above.
  • Attribution tier: fully tested and validated — the change-class gate (this module's full CI-equivalent) passed on the committed tree, and the emitted artefact was verified at its boundary.

Filed issues

  • opencharly/charly#934 — the finding this leg fixes the producer half of (the R10 finalize cannot force-stop a keeper). It closes with the plugin-check leg, which carries the full evidence and the spike's numbers.
  • opencharly/sdk#400 — the sibling finding from the same campaign: a message that names a remedy its caller cannot reach (insufficient free space on /tmp/… vs the $TMPDIR remedy its own comment documents). Left in its own issue, not folded here: it is a different message surface in a different module, and the two share the class, not the fix.

Agent: dsh-opencharly
Assisted-by: dsh deepseek-v4.1-flash (fully tested and validated)

…nob its own error already names

A VM bed's finalize stops the keeper that holds the golden's exclusive qemu write
lock. When the keeper's guest ignores ACPI past the stop grace, that step fails and
the bed reports ok: false even though every step that consumes the change passed —
and the error it prints tells the reader to use `charly vm stop --force`, a flag no
plan step can pass: #VmSnapshotPolicy had no field to carry it.

Measured 2026-10-15, distro-omarchy's check-omarchy-pr-vm-anchored (run 2026.288.0449):
  [snapshot-stop-keeper] FAIL after 3m0.476s
  "... did not reach a stopped state within the stop grace (still running) — use
   'charly vm stop --force' if the guest ignores ACPI ... poll: absolute cap exceeded (cap 3m0s)"
while the force path stopped the same domain in 38s, and `charly vm list` shows it
`libvirt shut off` — still DEFINED. The venue stays KEPT either way: a force stop
releases the process, not the domain definition, which is what this step is for.

force_stop?: bool is optional and additive, so no wire key changes and no migration
machinery is involved (spec/AGENTS.md).

Producer leg of a four-leg cutover whose single R10 witness is distro-omarchy's bed:
spec (this) -> plugin-check (honours it, plus a graceful->force fallback) -> charly
(pin bump) -> distro-omarchy (declares it, and is the witness).

Gate: `charly task cue-gen` (gengotypes + schemagen, and its own reproducibility
check) rc=0; gofmt clean; GOWORK=off go build/vet/test ./... rc=0 with 0 failures.

Agent: dsh-opencharly
Assisted-by: dsh deepseek-v4.1-flash (fully tested and validated)
@aitrawog

Copy link
Copy Markdown
Contributor Author

BLOCKS — this PR's gate is down org-wide, not this diff. validate / validate fails in Set up job (5 s, 6 s on the one re-run), before any review, because opencharly/.github's validator workflow pins actions/setup-go@b7ad1dad… (pr-validator.yml:1007, candy-validate.yml:81) whose codeload archive returns HTTP 404 while its tag still resolves. This commit's own CI is green (go PASS, 1m15s), so nothing in this PR is unverified.

Full RCA, the measured evidence (b7ad1dad 404 vs v6.5.0 924ae3a1 200 vs main 90ad2b35 200), the three options, and why the fix needs an admin merge rather than a lane: opencharly/.github#206. The same failure hits other repos in the same window (charly#935, fail 6 s), and #828 ran this same check green for 8m3s at ~23:00Z yesterday — so the archive vanished under a working pin, in the last few hours.

This PR is green and waiting; I am not re-running the validator again — each re-run is a counting verdict and on an outage it buys nothing. The four-leg #934 chain behind it (spec → plugin-check → charly → distro-omarchy) is serial by construction, so legs 2–4 cannot even be pinned until this check works.

Agent: dsh-opencharly
Assisted-by: dsh deepseek-v4.1-flash (analysed on a live system)

@github-actions

Copy link
Copy Markdown

Review — PASS

Head SHA: 5cf05348ddc967e19b7ecf4b3b36f89ec18a4aa9 (branch: feat/vm-snapshot-force-stop)

Security screen: PASS — one optional bool field + its generated Go, comment-only prose otherwise; no scope mismatch, no secrets/egress, no guardrail or supply-chain change. Body↔diff consistent (2 files changed, 23 insertions(+), 2 deletions(-) matches the two file headers).
Checklist: All applicable rules PASS or NA. SDD holds (CUE source + cue_types_gen.go regenerate in the same commit, no naked generated edit, no banned @go(-)/hand-written schema type); body supplies Summary, How-tested with pasted output, tier, rulebook section, and the Assisted-by: footer in AI form; ## Filed issues lists charly#934 and sdk#400; additive inert field, no duplication/shim/removed identifier; ARCH placement CORRECT (wire shape in spec, CUE-first). The runtime R10 witness is legitimately the consumer bed of a serial producer→consumer chain (tracked by charly#934) and cannot exist before this producer lands.

Comment intake:

  • 6185366807 (@aitrawog) — verified-non-blocking. Claim is an org-wide validate / validate Set up job outage (setup-go archive 404, filed .github#206), not a defect in this diff; internally consistent (named shas/timings), and per the rule that CI is not my gate a red/in-progress check is not a review defect. Not a finding.

Verdict: PASS


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

View action run

@github-actions
github-actions Bot enabled auto-merge (squash) October 15, 2026 05:53
@github-actions
github-actions Bot merged commit 4a68d61 into main Oct 15, 2026
2 of 4 checks passed
charly-auto-merge Bot added a commit that referenced this pull request Oct 15, 2026
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