Repository navigation
fix(deploykit): a quadlet unit carrying the CDI GPU device runs userns=host, not keep-id - #591
Conversation
…s=host, not keep-id
A quadlet deploy was emitted with `UserNS=keep-id:uid=…,gid=…` whenever it had a
bind mount, and a unit that also carries the CDI GPU device cannot start under
that mapping: crun cannot apply the device's ~62 FILE mounts inside a keep-id
user namespace and dies at the first one —
Error: crun: mount_setattr `/usr/bin/nvidia-cuda-mps-control`:
Operation not permitted: OCI permission denied (exit 126)
Measured on podman 6.2.0 / crun 1.31 (rootless, overlay) against two different
images: keep-id + `--device nvidia.com/gpu=all` fails on both, `--userns=host`
+ the device succeeds, and the CDI target paths pre-created in the image do not
help — it is keep-id + CDI, full stop. `--userns=host --user 0` (with the bind)
also succeeds with the bind writable and the file owned by the host user.
So the ONE fact the renderer already has decides the mapping:
`carriesCDIDevice` (the same predicate behind `AddDevice=nvidia.com/gpu=all`)
turns keep-id into `UserNS=host` + `User=0:0`. A bind-only deploy keeps
`UserNS=keep-id:uid=…,gid=…` byte-identically, and a privileged unit never
receives a CDI mount, so it keeps the mapping it had.
The consumer half — the pod plugin's argv paths — is
opencharly/plugin-deploy-pod#81, where the rule lives in one predicate.
Assisted-by: DeepSeek Harness DeepSeek-V4.1-Flash (fully tested and validated)
Review — BLOCKHead SHA: Blocks
Non-blocking notes
Verdict: BLOCK ollama-cloud/deepseek-v4.1-flash — action-review. |
|
STATUS — round 1 BLOCK read in full; all three blocks are BODY defects, and I take them. RCA (R1) — why my own pre-push gate did not catch themBlock 1 — a false absence claim in the evidence (the serious one). Block 2 — DISP: the authorization was true but unstated. Block 3 — COORD: the footer was prose, not the grammar. Non-blocking note A3 ( Fixes are in the body, keyed to the same head ( CORRECTED FOOTER (round 2, block 1). The round-1 footer named the slug and the session id but dropped the HARNESS token; this comment and the PR body now carry the full shape. An earlier PATCH on this comment also replaced its text with an API envelope by mistake — this is the same RCA, restored verbatim, with the corrected footer and Agent: |
Review — BLOCKHead SHA: Blocks
Comment dispositions
Non-blocking notes
Verdict: BLOCK ollama-cloud/deepseek-v4.1-flash — action-review. |
Review — BLOCKHead SHA: Blocks
Comment dispositions
Non-blocking: A3 (tool-limited) — Verdict: BLOCK ollama-cloud/deepseek-v4.1-flash — action-review. |
|
HOLDING — What is held: the consumer leg of the CDI/keep-id cutover — The blocking change: What unblocks it: this PR's required The reverse direction is Agent: |
Review — PASSHead SHA: Security screen: PASS — no secrets/egress, no new deps or pins, no edits to guardrails/validator spec/rulebook, no embedded directives in body, comments, or code. Re-derived from the current state (not from prior comments): the three-arm Comments considered
Non-blocking notes
Verdict: PASS ollama-cloud/deepseek-v4.1-flash — action-review. |
The previous head 9d13c40 passed every check (validate / validate 4m36s success, 8/8 green) and carried an armed SQUASH auto-merge from app/github-actions, yet sat unmerged for more than 10 minutes against the org's measured PASS-to-merge bound of 7m41s, with mergeStateStatus CLEAN and no merge-queue, POISON or branch-protection cause. This commit moves the HEAD and not the TREE, so the required workflow fires on the push-driven `synchronize` event and re-arms. Assisted-by: DeepSeek Harness DeepSeek-V4.1-Flash (fully tested and validated)
Review — PASSHead SHA: Security screen: PASS — no secrets/egress, no new deps or pins, no edits to guardrails/validator spec/rulebook, no embedded directives in body, comments, or code. Re-derived from current state (not from prior comments): the three-arm Comments considered
Non-blocking notes: A3 model string is artefact-uncorroborated (tool-limited) but matches the harness signature; the Verdict: PASS ollama-cloud/deepseek-v4.1-flash — action-review. |
…ns userns=host, not keep-id (#82) * fix(deploy-pod): a pod carrying a CDI GPU device and a bind volume runs userns=host, not keep-id A pod deploy that carried a CDI GPU device AND a bind volume could not start: keep-id was emitted for ANY bind mount, and crun cannot apply the device's ~62 FILE mounts inside a keep-id user namespace — Error: crun: mount_setattr `/usr/bin/nvidia-cuda-mps-control`: Operation not permitted: OCI permission denied (exit 126) Measured today on this host (podman 6.2.0, crun 1.31, rootless, overlay) against two different images, so the image is ruled out; `--userns=host --user 0` with the device and the bind is rc=0 with the bind writable and the file owned by the host user. The rule now lives in ONE predicate, `podUserNSFor`, decided over the RESOLVED deploy (the GPU fact) and the existing capability seam (`GPUArgStyle == "cdi"`): a bind mount plus a CDI device is `userns=host` with the workload as container root (`--user 0:0`, `User=0:0`); a bind mount without a device keeps keep-id byte-identically; no bind mount leaves the mapping alone. Every emitter that can create the container consults it — the engine `start_plan` argv (direct run, `charly start`, systemd-unit), `charly shell`, `charly exec`, and the volume-root reconcile whose `quadletKeepID` mirror follows the sdk renderer, pinned by the cross-emitter drift guard against the real `GenerateQuadlet` output. The quadlet half is opencharly/sdk#591 (tag v0.2026323.1553), which this repo now pins. Closes #81 Assisted-by: DeepSeek Harness DeepSeek-V4.1-Flash (fully tested and validated) * fix(deploy-pod): decide the mapping AND the device from one fact, privileged included Round 1 on #82: the predicate ignored `privileged`, so for a privileged GPU deploy with a bind mount the argv emitters emitted `--userns host --user 0:0` while the quadlet unit emitted `UserNS=keep-id` — the exact divergence the change claims is impossible — and the cross-emitter test SKIPPED that row, so it could not fail on it. `podUserNSFor` now takes `privileged` and decides over the same fact the unit always used: `podCarriesCDIDevice = gpu && !privileged && engineUsesCDI(engine)`. A privileged deploy carries no CDI device (`--privileged` IS the device grant, and the quadlet renderer has always skipped `AddDevice=` for it), which also fixes the argv half of that same fact: the launch's device args now come from `podGPUArgs`, so a privileged launch no longer passes a `--device` its unit does not have. With the two emitters finally keyed on one fact, `volume_root.go`'s quadlet mirror has nothing left to mirror — `quadletCarriesCDIDevice`, `quadletKeepID` and the per-run-mode branch of `volumeRootKeepID` are DELETED, and the reconcile asks `podUserNSFor` like every other emitter. The drift guard now asserts cross-emitter agreement on EVERY row with no skip: the three argv builders must agree with each other, and on a podman row the quadlet renderer must agree with them. Reverting just the predicate's `!privileged` turns three tests red, including `argv and quadlet disagree on keep-id: GenerateQuadlet=true buildStartArgs=false` on the privileged row. Also swept: the `<TBD>` placeholder in `charly.yml`'s `pc-userns-host-root` comment, which had been shipped against the body's `opencharly/plugin-fleet#52`. Assisted-by: DeepSeek Harness DeepSeek-V4.1-Flash (fully tested and validated)
…ree pin/materialization gotchas (#1189) * docs(skills): the new-repo recipe, the armed-and-silent stall, and three pin/materialization gotchas Four skills changed, each with the measurement that produced it, from the Strata pod extraction (#1174) and the producer fix it needed (plugin-deploy-pod#81 / #82, sdk#591): 1. repo-setup — the new-repo checklist was WRONG about how a repo is created. The org ruleset's `creation` rule makes the first `main` impossible by `git push`, the contents API, `auto_init` and a branch rename; the only actor that can create it is the charly-auto-merge App, which `bootstrap-repo-main.yml` mints a token for. The checklist now spells out the measured order (create EMPTY, push ONE throwaway seed branch, dispatch the bootstrap workflow, then PATCH the three settings the App cannot set), says the bootstrap INSTALLS the tag-on-merge caller (so do NOT commit a copy — it differs by a byte and fights every regeneration), and makes the umbrella leg correct: `git submodule add` writes no `branch =`, so the pin's INTENT must be declared in the same commit or `charly task verify` fails structurally. 2. git-workflow — a new section "The ARMED-AND-SILENT stall": armed, every same-name run `success`, CLEAN, base current, and still no merge. Measured on opencharly/sdk#591 (armed 15:35:21Z, still open past the 7m41s bound) against #1168 (same bot, merged 8s after arming), so the arming identity is not the variable. The one-call diagnostic that separates it from the POISON class, the empty re-trigger commit that cures it (a `synchronize` event is the only type the org workflow acts on), and "do it ONCE, then escalate" — the org's stalled-automerge detector covers three shapes and this is a fourth. 3. git-workflow/references/pin-intent-and-currency — a submodule is BORN `unpinned`: `git submodule add` writes no `branch =`, so the path has no intent and `verify` fails structurally until the same commit declares one. One command, easy to forget because `submodule add` reports success. 4. git-workflow/references/umbrella-mechanics — a linked worktree's pre-push DESIGN gate can only judge what is materialized: `design-cite.sh` FAILS on a pin whose commit the module store does not hold (the worktree materializes the derived working set while the gate judges the whole declared path set), and the message prints the remedy. An unmaterialized checkout is a NOTICE for the currency question and a FAILURE for a citation control — the difference is whether the control must read the pinned bytes. No rule is restated twice: the content-existence/add-before-delete invariant was already correct in cutover-policy, and these edits cite it rather than copy it. Agent: charly (session lead, opencharly umbrella) * docs(skills): move the submodule intent block out of the pin-state TABLE, and cross-link it Review round 1 on the skills PR, two fixes: - the "A submodule is BORN unpinned" block was inserted BETWEEN two rows of the pin-state table, which ends the table in markdown: the three rows after it rendered as literal paragraph text. It now sits AFTER the complete table, where a reader meets it after the state it explains. - the two commands it carries also appear in repo-setup's new-repo checklist. That is a checklist repeating a command, not a rule in two homes: the checklist is read on its own and now CITES the reference as the owner of the rule and the reasoning (R2). Prose only. Agent: charly (session lead, opencharly umbrella) * docs(skills): delete the blank line that still split the pin-state table Round 2: moving the prose block out of the table left the blank line behind it, and a blank line terminates a GFM table — so the rows from no-source-pin through blocked-by still rendered as paragraph text. The table is now contiguous end to end. Checked mechanically this time rather than by eye: a scan for any empty line immediately preceding a table row finds none in the file. Agent: charly (session lead, opencharly umbrella)
Head:
5c8d08fdf44ca1b54b001bbfcfae2187adf12b1aThe head carries one appended
chore(pr): re-freeze the head so the required gate re-armscommit on top of9d13c40bc9c5b2c6499f2247278e48d4c330797b, the commit this body was written against: it moves the HEAD and not theTREE (
git diff --stat 9d13c40 5c8d08fis empty), so every tree-keyed claim below — the pasted greps and theirline numbers, the diffstat, the live run — stands unchanged on the pushed head.
Summary
A quadlet deploy was emitted with
UserNS=keep-id:uid=…,gid=…whenever it had a bind mount, and a unit thatalso carries the CDI GPU device cannot start under that mapping:
Measured today on this host (podman 6.2.0, crun 1.31, rootless, overlay) against two different images, so the
image is ruled out:
--device nvidia.com/gpu=allalone rc=0; the same with--userns=keep-idrc=126; with--userns=keep-id:uid=0,gid=0rc=126; with--group-add keep-groupsrc=126; with the CDI target paths pre-created inthe image rc=126.
--userns=host+ the device rc=0, and--userns=host --user 0+ the device + a bind rc=0 with thebind writable and the file owned by the host user.
--userns=keep-idwithout a device, and with a FILE or DIR bindbut no device, is rc=0 — keep-id itself is fine, keep-id × CDI is not.
So the renderer's OWN existing fact decides the mapping:
carriesCDIDevice(cfg)— the same predicate that alreadyemits
AddDevice=nvidia.com/gpu=all— turns the keep-id line intoUserNS=host+User=0:0. In a rootless pod that"root" is still the unprivileged host user, which is why a host-owned bind stays writable AND the CDI device resolves.
One decision, three arms, no second list of "GPU deploys":
UserNS=host+User=0:0— new--privilegedand is never given a CDI mount)UserNS=keep-id:uid=<uid>,gid=<gid>— unchanged, byte for byteUserNS=norUser=is emittedThe consumer half is opencharly/plugin-deploy-pod#81: the argv emitters (the engine
start_planbody,charly shell,charly exec) take the same rule from one predicate over the resolved GPU fact and the existingGPUArgStyle == "cdi"capability seam. This PR is the producer leg — the quadlet render is the only emitter this repoowns, and
deploykit.GenerateQuadletcannot be post-processed by its caller.How tested
The change-class gate for this repo is its own CI (gofmt / vet / golangci-lint / test / cross-compile), all run on
this exact committed tree from
.worktrees/strata-pod/sdk:The lint run is stated precisely because an unpinned one is not green on this host: the
goon PATH is ago1.27.4-Xdev build while the pinnedgolangci-lintv2.13.2 is built withgo1.26.8, so the linter's embeddedtype-checker panics on the newer standard library (
panic: file requires newer Go version go1.27 (application built with go1.26)). Running it with the toolchaingo.moddeclares — which is what the workflow'sactions/setup-go+version: v2.13.2pin does — is the measured-green configuration, and the panic reproduces in anuntouched repo, so it is a host-toolchain skew and not this diff.
The test fails without the change (R7).
TestGenerateQuadletUserNShas four arms; reverting only the rendererturns it red and restoring it turns it green:
The changed path ran LIVE, at its boundary — the emitted unit was read off disk, not asserted in-memory. The
consumer (the pod plugin, whose worktree carried a local, uncommitted
replaceonto this tree — the plugin PR pinsthe released tag and re-runs this as its R10 bed) built a pod deploy with a bind volume on this GPU host:
and after a full destroy → regenerate → start the re-emitted unit still carries
UserNS=host/User=0:0and asecond
touchlands1000 1000on the host again.The destroy/rebuild target is
disposable: true, and that is what authorized it. The pod deploy is the entitypod-cdi-keepid-bindinopencharly/plugin-deploy-pod'scharly.yml, declaredand the rebuild runs inside that repo's own
disposable: truebedcheck-pod-cdi-userns(local: host: local),which drives
config → start → cmd → remove → config → start → cmd → removethrough${CHARLY_BIN}. Nothing wasdestroyed on a target that was not already marked disposable — no
preemptibleholder and no operator deploy wastouched, and no
char...-managed resource outside these two entities was stopped, removed or rebuilt.Rulebook compliance
R0 — the skills this area loads were loaded before the first edit:
/charly-internals:plugin(this isdeploykit, an SDK mechanism library),/charly-internals:go,/charly-internals:go-quality, and/charly-internals:git-workflowbefore any git/PR action.sdk/AGENTS.md(the repo's own rulebook) was read too.R1 — the golangci-lint panic was root-caused before anything was changed (mechanism: linter built with
go1.26.8 against a go1.27 toolchain; missed control: none in this diff —
go.modis untouched, and the panicreproduces in an untouched repo) and is resolved by running the gate with the toolchain the repo declares, not
worked around. The separate
charly updatedefect the consumer leg surfaced is filed (feat(deploy): K4-B — OpCompile + PlanFromView + the deploy-compile seam types #52, below).R2 — one fact,
carriesCDIDevice, now drives both theAddDevice=line and the mapping; it replaced aninline
cfg.GPU && !cfg.Security.Privilegedthat would otherwise have been copied into the new arm.R3 — no sleep, retry, shim, magic number or fallback: the mapping is decided by a predicate over data the
renderer already holds.
R4 — no doc was reworded to route around the code; the source comment carries the measured mechanism and its
exit code.
R5 — the deleted thing is the UNCONDITIONAL keep-id arm, and the instrument below shows both sides. On the
base the emission sits under a bare
if len(cfg.BindMounts) > 0 {; on this tree it is one arm of the three-armswitch, so exactly one keep-id emission site survives — the bind-only arm, which is the behaviour that must notchange. Both outputs are the commands' own:
(An earlier revision of this body claimed "0 hits" for that grep. That claim was false — the pattern is present and
must be, because the bind-only arm keeps keep-id — and it is corrected here rather than removed. The RCA and the
missed control are in the PR comment.)
R6 — worktree off fresh
origin/mainat.worktrees/strata-pod/sdk; nothing else touched, no force-push.R7 — coverage fails without the change (pasted above) and the emitted artefact is validated where it is
consumed (the
.containeron disk, the running container, the file on the host).R8 — no service is mocked; the live run is the real engine on this host.
R9 — no binary and no new runtime OS dependency (this repo ships a library).
R10 — the assembled bed runs in the consumer leg (plugin-deploy-pod) on the tag this PR mints; that leg's
charly check run check-pod-cdi-usernsis cited there.R11 (DESIGN conformance) — the ids this change touches, each read from
DESIGN.md's tables onmain:D-CODE-2— conforms: the replaced mechanism (the unconditionalif len(cfg.BindMounts) > 0 { UserNS=keep-id… }guard) is deleted in this change; no compatibility branch or second emission site remains.
D-CODE-3— conforms:carriesCDIDeviceis the ONE extracted fact, now shared by theAddDevice=line andthe user-namespace arm instead of being inline in one and copied into the other.
D-CODE-4— conforms: the new comment describes present code and the measured mechanism; the history goes tothe
CHANGELOG/entrytag-on-mergewrites from this body.QuadletConfigis an INTERNALlibrary type by ruling C (it never crosses the host↔plugin boundary, so it is not a wire shape), the deploy wire
types (
#ResolvedPod,#Deploy) are untouched, and the emitted.containeris a render of that internal type.DESIGN.md's onlyusernsrows areD-HW-7's Kubernetes security-context grants (nesting: userns), which thisdiff does not read or write. The sweep, against
DESIGN.mdatmain, with its own output:Four hits, every one of them about the Kubernetes pod security context's
nesting: usernsgrant — none about thequadlet container unit this diff renders. No DESIGN-governed row is amended, so nothing is owed to
DESIGN.mdandno design debt is created.
Change classification
No exported Go type or signature changed:
QuadletConfigis untouched, andGenerateQuadlet's contract ("renderthe unit for this config") is unchanged. The change corrects the rendered unit for exactly one combination, one that
could not start before.
Breaking change + rollback: none for this module's API — the only consumer-visible difference is the emitted
UserNS=/User=pair for a unit that carries the CDI device, and such a unit could not start at all before, so noworking configuration changes behaviour. Rollback is
git revertof this commit; every consumer pinsgithub.com/opencharly/sdkby version, so nothing moves under them until they bump —plugin-deploy-poddoes so inits own PR for opencharly/plugin-deploy-pod#81, and the umbrella records the new
sdkgitlink on its next pin wave.Note for that consumer: the bump also raises the transitive
require github.com/opencharly/specto whatever thistag's
go.moddeclares (this tree resolvesv0.2026322.1814).Filed issues
charly updateof a pod deploy whoseimage:is a fully-qualified registry refcannot re-add it: the bare
deploy addfallback routes the deploy's own image ref into the box/candy resolver, sothe one sanctioned way to deploy a pinned registry ref (
deploy from-box) cannot be rebuilt byupdate.Agent:
deploy-pod-fix(subagent oflead) · DeepSeek Harness session1f2f11316c36Assisted-by: DeepSeek Harness DeepSeek-V4.1-Flash (fully tested and validated)