fix(pvc): kubelet-owned volume permissions — local-type PVs + fsGroup, no root chowns; harden paid smoke flows#610
Closed
bussyjd wants to merge 7 commits into
Closed
Conversation
Ship the agent config.yaml (hermes-config) and the Obol skills tree (new hermes-skills ConfigMap, a deterministic gzipped tarball in binaryData) to the Hermes pod, and extract them into the PVC from the init-hermes-data init container running as the container UID (10000). The host no longer writes the data PVC, so there is no wrong-owned scaffolding for the root init-hermes-perms chown to repair, removing the host-write + chown-repair pattern behind the recurring PVC-ownership bugs. - embed.SkillsTarball(): deterministic (sorted paths, fixed mode, zero mtime), excludes __pycache__/.pyc, so the ConfigMap and the Deployment hash change only when the skills themselves change. - Delete the host-side syncRuntimeFiles / syncObolSkills / removeLegacyHeartbeat path; config + skills now arrive via read-only ConfigMap volumes mounted into the init container. Skills still land at /data/.hermes/obol-skills (external_dirs), preserving the existing read-only consumption semantics.
OisinKyne
force-pushed
the
research/hermes-configmap-skills-delivery
branch
from
June 9, 2026 11:06
4d8102a to
51d58d6
Compare
bussyjd
marked this pull request as draft
June 9, 2026 13:21
…with #614 Applies the verified findings from the cross-review against PR #614 (every item adversarially confirmed against the refs; union merge-tree clean). PVC / upgrade path: - llm.yaml: restore container-level runAsUser/runAsGroup 1000 on x402-buyer. Clusters upgraded in place from <= rc12 keep hostPath-typed PVs where kubelet skips fsGroup; their /state dir is 1000:1000 with consumed.json written 0600 by UID 1000 — a 65532 sidecar cannot read it, Fatalf's on `load state`, and takes every paid/<model> route down. On fresh local-type PVs the explicit UID is harmless (fsGroup 65532 grants group access). embed_buyer_state_test.go updated to pin the new contract. - plans/volume-permission-hardening.md: new "Upgrading from <= v0.10.0-rc12" section — supported path is cluster recreation (wallet backup/restore), with a documented k3d chown escape hatch. troubleshooting.md gets the symptom->fix entry. The Hermes half of the legacy-PV breakage cannot be patched at runtime without reintroducing the chown machinery this PR removes, so it is a documented breaking change instead. Paid-route availability: - llm.yaml: Reloader annotation narrowed to litellm-config only. The buyer ConfigMaps (x402-buyer-config/x402-buyer-auths) are rewritten by the controller on every buy, top-up, auto-refill, and tombstone cleanup; with strategy Recreate + 1 replica the previous annotation bounced the entire inference gateway (all Hermes traffic, in-flight SSE streams) on every purchase event, inverting CLAUDE.md pitfall 7 (restart is fallback, not the default buy path). The buyer hot-reloads via /admin/reload. stack_test.go updated to pin litellm-config-only. Flow alignment with #614: - lib.sh: `stack down` -> `stack down --yes` in reset_flow_workspace. #614's flow-16 (now last in the single-stack array) intentionally leaves a live agent offer; without --yes the non-TTY ConfirmRunningServicesLoss gate refuses, graceful down is silently skipped (`|| true`), and teardown degrades to the raw k3d-delete fallback on every release-smoke run. - flow-11: post-register Ready poll 120s -> 300s to match flow-14's identical live-Base-Sepolia chain-watch path (pitfall 13 free-tier RPC throttling). Known follow-ups (not in this commit): flow-08 buy-retry top-up vs exactly-N assertions on rare partial failures; flow-11 lacks flow-14's remote-signer rolled guard; aztec PVC has no permission story (runs as root today); post-merge controller repin so released sub-agents pick up this PR's UID-1000 render (tracked in #614's pin-test note).
Records the options ladder for 'nodes joining my cluster' (far-future, not scheduled) so near-term permission decisions don't foreclose it: the host-FS-canonical coupling and its four conditions, the agent-homes-only scope, what breaks on day one of a join (WaitForFirstConsumer + no nodeSelector in any render), options 0-4 (home-node pattern -> NFS -> distributed storage -> API-mediated access -> hybrid by data class), join mechanics (native k3s server + remote agents; macOS stays k3d), and the decisions that bind today: group-1000 sharing over render-time UID matching, home-node pinning as a join prerequisite, inputs to API objects per Remaining Debt.
…-hardening fix: harden PVC permissions and paid smoke flows
bussyjd
marked this pull request as ready for review
June 9, 2026 22:58
…t fix The Shipped Changes bullet still described the pre-c667432 model (buyer inherits 65532). c667432 restored container-level UID/GID 1000 on the buyer for legacy hostPath-PV state compat; the bullet now matches llm.yaml and embed_buyer_state_test.go.
Contributor
Author
|
Superseded by the v0.10.0-rc14 release train: #616 — this PR's branch is merged there verbatim (merge commit preserved, full union build + test green). Closing in favor of the consolidated release PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replaces the stack's volume-permission patchwork (provisioner
chown -R 1000:1000, root chown init containers, theinternal/k8spermhelper, per-workload UID drift) with kubelet-owned permissions: local-path PVs are now provisioned aslocal-type volumes so the kubelet actually applies podfsGroupat mount, and every PVC consumer runs non-root with an explicit, documented identity. Also hardens the paid smoke flows (flow-06/08/11/13/14 + libs) and moves the QA runbook to CLI-first surfaces.Why permissions were "intermittent" for months: Docker Desktop's VirtioFS mounts the data dir with
fakeowner— it fakes ownership and skips POSIX permission checks, so every UID mismatch was invisible on macOS k3d. On any real Linux filesystem (native k3s, CI, remote QA boxes) the same workloads hitPermission denied. Green locally, red everywhere that matters. Verified empirically on a live node (seeplans/volume-permission-hardening.md).Ownership model: before → after
flowchart TB subgraph BEFORE["Before — chown patchwork (masked by VirtioFS fakeowner on macOS)"] P1["local-path provisioner<br/>chown -R 1000:1000 (hardcoded)"] --> V1["hostPath-typed PV<br/>(kubelet IGNORES fsGroup)"] V1 --> H1["Hermes UID 10000<br/>root chown init re-owns /data<br/>EVERY start"] V1 --> A1["Spawned agents UID 10000<br/>NO chown init → stuck<br/>Provisioning on Linux"] V1 --> B1["x402-buyer UID 65532<br/>nothing → EACCES on<br/>consumed.json (Linux)"] S1["CLI sync chowns tree to<br/>HOST uid (501 on macOS)"] -.->|flapping| V1 end subgraph AFTER["After — kubelet-owned (this PR)"] P2["provisioner: mkdir -m 0770 only<br/>StorageClass defaultVolumeType: local"] --> V2["local-typed PV<br/>kubelet applies fsGroup at mount"] V2 --> H2["Hermes + spawned agents<br/>UID/GID 1000, fsGroup 1000,<br/>fsGroupChangePolicy: Always<br/>(host-seeded editable .hermes state)"] V2 --> B2["litellm pod fsGroup 65532<br/>buyer container UID 1000<br/>(legacy hostPath-PV state compat)"] N2["no root containers anywhere<br/>internal/k8sperm deleted"] end BEFORE ==> AFTERFresh agent-home lifecycle under the new model
sequenceDiagram participant CLI as obol CLI (host) participant Prov as local-path provisioner participant Kub as kubelet participant Pod as Hermes pod (UID 1000) CLI->>CLI: SeedHostFiles — SOUL.md, skills,<br/>.no-bundled-skills into $DATA_DIR Pod->>Prov: PVC bound (WaitForFirstConsumer) Prov->>Prov: mkdir -m 0770 (no chown) Note over Prov: PV typed "local", not hostPath Pod->>Kub: mount Kub->>Kub: fsGroup 1000 ownership walk<br/>(fsGroupChangePolicy: Always —<br/>host re-seeds between mounts) Kub->>Pod: volume writable for 1000:1000 Pod->>Pod: non-root config-seed / profile-seed inits<br/>(replace the root chown init) Note over CLI,Pod: config change → checksum/hermes-config<br/>annotation rolls the podPV specs are immutable — existing clusters keep hostPath-typed PVs where the kubelet skips
fsGroup, and their Hermes data is owned10000:10000by the removed root init. An in-placeobol stack upwith this code breaks Hermes and the buyer on those clusters.flowchart LR Q{"Cluster created<br/>on ≤ rc12?"} -->|no| OK["nothing to do —<br/>fresh local-type PVs"] Q -->|yes| R["recreate (supported path):<br/>wallet backup → down → purge -f →<br/>init → up → wallet restore"] Q -->|"yes, must keep cluster"| E["k3d escape hatch:<br/>docker exec node chown -R 1000:1000<br/>over the PV backing dirs + restart pods"]Full instructions:
plans/volume-permission-hardening.md§ Upgrading from ≤ v0.10.0-rc12 and the new troubleshooting entry.Changes
Permission model
local-path.yaml: StorageClassdefaultVolumeType: local; setup hook reduced tomkdir -m 0770.hermes.go+agent_render.go: UID/GID 10000 → 1000,fsGroup: 1000,fsGroupChangePolicy: Always, root chown inits removed, non-rootconfig-seed/profile-seedinits,checksum/hermes-configannotation rolls pods on config change. Host-side ownership repair now targets the container UID (1000) on both backends.llm.yaml: litellm podfsGroup 65532; buyer keeps container UID/GID 1000 — pre-v0.10.0 state PVs holdconsumed.jsonwritten0600by UID 1000, a 65532 sidecar crashloops onload stateand takes everypaid/*route down.internal/k8spermdeleted; tests pin every contract (embed_local_path_test,embed_buyer_state_test,agent_render_test,hermes_test,stack_test).Paid-route availability (cross-review fix)
litellm-configonly. The controller rewrites the buyer ConfigMaps on every buy/top-up/auto-refill/tombstone; withstrategy: Recreate+ 1 replica the broad annotation bounced the entire inference gateway (all Hermes traffic, in-flight SSE) on every purchase event — inverting CLAUDE.md pitfall 7. The buyer hot-reloads via/admin/reload.Smoke flows
lib.shreset:stack down --yes— feat:agentpurchase type within hermes #614's flow-16 leaves a live offer, and the non-TTY safety gate otherwise refuses graceful teardown on every release-smoke run.Docs
obol-stack-devrunbook → CLI-first QA; troubleshooting entry for the upgrade breakage;plans/volume-permission-hardening.mdrewritten with thefakeownerroot cause, empirical validation, upgrade section, and a multi-node roadmap (host-FS coupling analysis, options ladder, decisions that bind today).Compatibility with #614
git merge-treeof this branch × #614 is clean, and the union was built and tested: Hermesv2026.6.5, the buyer04bebbcpin, flow-16, and this PR's securityContext changes all survive. Thestack down --yesand Reloader scoping above are the two semantic interactions the cross-review surfaced.Post-merge follow-up (shared with #614): the embedded
serviceoffer-controllerpin predates this PR — released clusters render sub-agents with the old UID-10000 model until the controller is rebuilt from the merge commit and repinned (tracked inembed_image_pin_test.go).Validation
go build ./..., fullgo test ./...green on the branch and on the simulated union with feat:agentpurchase type within hermes #614.bash -nover all changed flows; full release smoke withOBOL_LLM_MODEL=qwen36-deepincluding USDC, live OBOL, and fork OBOL paid flows (fix: harden PVC permissions and paid smoke flows #615 run).docker exec -umatrix (UID 10000/1000/65532 × chown states) — table in the plan doc.History
This branch first carried a ConfigMap-delivered config+skills experiment (the original PR title); #615 — merged into this branch — reverted that in favor of host-seeded files + kubelet-owned permissions after the editability tradeoff proved wrong for operator workflows. The net diff contains no ConfigMap delivery; the experiment's useful remnants (checksum-roll annotations, non-root seed inits) survive. The ConfigMap direction returns as option 3 of the multi-node roadmap when single-node stops being an invariant.
🤖 Generated with Claude Code