Repository navigation
fix(bootstrap): create the account the image DECLARES (name-guarded, all measured forms) - #657
Conversation
…all measured forms) The emitted account step asked whether uid 1000 was taken and answered by creating a name. On a base whose uid 1000 belongs to another account (ubuntu, a builder image, a distro whose base_user differs) the guard short-circuited, "user" was never created while the image still declared USER user - and every exec failed with: Error: unable to find user user: no matching entries in passwd file (opencharly/charly#1309, #655). Now the emitted creation matches the emitted contract on both userlands, trying the measured forms in order: shadow-utils: guard on the NAME; group guard accepts an existing group of that NAME at any gid; then -g GID / -o -g GID / -g NAME / -o -g NAME. busybox: -u UID / group-free / -G NAME (busybox creates its own same-named group and takes -G by name, so no group is pre-created). Every form answers a measured refusal: uid '1000' in use -> the next form group 'user' in use -> the group-named form group '1000' does not exist -> the -g NAME forms Live: all four scenarios were executed from the rendered fragment (uid taken; group user at gid 2000; busybox uid taken; busybox group pre-existing), and the image runs as the declared user in every one. Three red arms show each new test failing on an emitter without its form. *Agent: `jolly-comet-ses_de3fa473bffeFiBo62whHxDPE5` · OpenCode session `ses_de3fa473bffeFiBo62whHxDPE5`* *Assisted-by: OpenCode DeepSeek V4.1 Flash (analysed on a live system)*
Review — BLOCKHead SHA: Change class: code/config — Go library emitter ( Comment thread: empty (0 comments) — nothing to disposition. Blocks
Notes (non-blocking, but resolve while you're at it)
Verdict: BLOCK ollama-cloud/deepseek-v4.1-flash — action-review. |
Review — PASSHead SHA: Security screen: PASS — no scope creep, secrets, network, guardrail weakening, or supply-chain change; the diff is a self-contained Go emitter + test fix. Checklist: All applicable rules PASS or NA. The four-form shadow-utils chain and three-form busybox chain match their format args and the tests exactly; tests would fail on the prior emitters (red arms pasted with immutable SHAs); the four live Comment thread (1): prior Verdict: PASS ollama-cloud/deepseek-v4.1-flash — action-review. |
Summary
The bootstrap's account creation was guarded on the UID while everything downstream consumes the NAME. On a base whose uid 1000 already belongs to another account (
ubuntu, a builder image, a distro whosebase_userdiffers), the guard short-circuited,userwas never created — and the image went on declaringUSER user, so everypodman execfailed with:Field evidence: opencharly/charly#1309 (post-
charly updateoverlay step) and the same container-level shape on the agent channel'sterminal:tmuxround-trip (opencharly/distro-arch#85).This makes the emitted creation match the emitted contract, on both userlands, by trying the measured forms in order:
shadow-utils leg — the guard is the declared name; the group guard accepts an existing group of that NAME at any gid; then:
useradd -m -u UID -g GID …(the normal case),useradd -o -m -u UID -g GID …(uid 1000 taken by another account, group at GID present),useradd -m -u UID -g <user> …(group<user>exists at another gid —-g GIDwould fail),useradd -o -m -u UID -g <user> …(both unusual cases at once).Every shadow-utils form keeps
-u %d: this userland can hold the uid, so it never needs a uid-less form.busybox leg —
addusercreates its own same-named group and takes-Gby NAME; three forms:adduser -D -h DIR -u UID -s SHELL user(uid free),adduser -D -h DIR -s SHELL user(uid taken, group absent),adduser -D -h DIR -G user -s SHELL user(groupuserpre-exists, uid taken).A busybox userland has no
--non-unique, so the uid may move; the contract is the declared NAME resolving, which every form guarantees.Closes #655How tested
Red arms — each new assertion fails on an emitter without its form
All three arms use explicit SHAs (no
HEAD~N, which moves as rounds stack) and were run at this head:Restored:
ok github.com/opencharly/sdk/deploykit 0.006s.The name-guard test (three assertions) fails on the pre-fix emitter too:
The emitted block, executed live — shadow-utils, normal and uid-taken
The emitted block, executed live — shadow-utils, group
<user>at ANOTHER gidBase: no group at gid 1000, group
userat gid 2000, no accountuser. Complete, unfiltered build log of the RUN (--no-cache --progress=plain), so every attempt's own refusal is visible in order:Form 3 is the one that resolved it (uid 1000 was free, so
-owas never needed — an earlier draft of this body mislabelled it "form 4"); form 4 remains the-ocompanion for a base where the uid is taken as well.Identity contract, stated explicitly: on shadow-utils the uid is kept at 1000, so in the uid-taken scenario the account
usershares uid 1000 with the pre-existingotherandidprintsuid=1000(other)(first passwd match for the uid). That is intended: the exec-by-name fix is what matters (userresolves, sopodman execworks), and the uid stays stable for--userns=keep-idmapping. On busybox, where there is no--non-unique, the uid moves instead andidprintsuid=1001(user).The emitted block, executed live — busybox, uid taken + group absent
The emitted block, executed live — busybox, group
userPRE-EXISTS + uid takenMeasured facts the emission rests on (each command, its real output)
Gate
Spike
userabsent and bothadduser -G userforms dieunknown group user; the shadow-utils gid-keyed guard short-circuits on a base that ships groupuserat another gid.-G/-g GID. Rejected on measurement: busybox's pre-created group makes the group-free form diegroup 'user' in use; anduseradd -g GIDstill fails when no group has that gid.USER <uid>instead and stop resolving names. Rejected:ai.opencharly.user,HOMEandWORKDIRare name-based and the overlay restoresUSER <label>, so a numeric-only fix leaves the overlay and the agent channel resolving a name, and does not fix an image whose declared name is absent.-g GID,-o -g GID,-g NAME,-o -g NAME; busybox:-u UID, group-free,-G NAME. The diff implements exactly E; its proof is the four live executions and the three red arms above.Rulebook compliance
deploykitemitter area was worked with/charly-internals:go,/charly-internals:strict-policy(R1/R12),/charly-internals:root-cause-analyzerand/charly-internals:git-workflowloaded; the change is confined to that mechanism.uid '1000' in use,group 'user' in use,group '1000' does not exist,unknown group 1000), and a real creation failure still fails the build loudly.git statusclean before the branch; each round is an appended commit on the pushed branch (no amend, no force-push, no direct push tomain).ai.opencharly.*label, so the label-after-build assertion is N/A.podman build/podman runlocally.RUN; binary/source pair isgo build ./...from this worktree.podman build/podman runexecutions above, from this tree's emitted text.Review-round RCA (the missed controls, named against the ACTUAL prior block)
The prior review (
e1c6df7) blocked on two things, neither of them the busybox leg:useraddfallback" the diff does not emit. My gate compared the body against the fix I intended, not against the emitted bytes. Missed control: re-read the body's every verb and adjective against the rendered Containerfile fragment before the push — a claim about what the shell does is verifiable text, not prose.HEAD~N-relative, so they stopped reproducing as rounds stacked. My gate ran each command once, at the head where it was written. Missed control: a pasted command must name an immutable rev (<sha>, neverHEAD~N) and be re-executed at the head being pushed.This round applies both: every pasted command names a SHA and was re-run at this head, and the body's claims were re-derived from the rendered fragment (which is quoted verbatim in
### Spike-adjacent form above). The earlier round's RCA (that the busybox leg was asserted as text rather than executed on each refusal path) is also applied: all four scenarios now show the refusal line immediately before the form that resolved it.Change classification
Behavior fix in the emitted build bootstrap. No schema, no wire type, no API rename. Consumers get it on their next pin bump (opencharly/charly#1309 tracks the field impact).
Cross-repo confirmation (pasted in full on the other PR, not here): a
charlybuilt against this local sdk rancheck-tmux-pod— the bed that had been failingagent channel: FAIL terminal:tmux— and reported[tmux-roundtrip] exit=0,23 steps: 20 passed, 0 failed, 3 skipped,PASS (steps=16, skipped_checks=12),bed_exit=0. The full log belongs to opencharly/distro-arch#85 and is pasted there; this repo cannot reproduce that bed on its own.Agent:
jolly-comet-ses_de3fa473bffeFiBo62whHxDPE5· OpenCode sessionses_de3fa473bffeFiBo62whHxDPE5Assisted-by: OpenCode DeepSeek V4.1 Flash (analysed on a live system)