Skip to content

feat(sdk): bake box-authored OCI ENTRYPOINT/CMD + quadlet HostName= parity - #129

Merged
atrawog merged 2 commits into
mainfrom
feat/oci-entrypoint-export
Aug 12, 2026
Merged

atrawog merged 2 commits into
mainfrom
feat/oci-entrypoint-export

Conversation

@atrawog

@atrawog atrawog commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Summary of changes

The sdk leg of the three-repo fix (spec → sdk → main, B6 producer→consumer order) for the AgentTeams manager container crash-loop. Consumes the opt-in entrypoint:/cmd: box wire fields (spec v0.2026224.403, PR opencharly/spec#23) and emits them into the image's OCI config — the second repo of the three-repo fix.

Root cause being fixed: the AgentTeams controller spawns child manager/worker containers directly from their baked OCI config (dockerCreatePayload sends no Cmd/Entrypoint), with no charly deploy in the loop to inject the init command — and charly images baked none. The spawned manager therefore ran bare bash (the base image's default /usr/bin/bash), exited 0, and restarted forever.

Concrete edits (all 10 files accounted for):

  • deploykit/generate.go (Containerfile emitter): writes ENTRYPOINT <json> when the box declares an entrypoint and CMD <json> when it declares a cmd — opt-in, empty by default (a normal charly image bakes no command; the deploy-time init injects it). cmd: [] clears a base image's inherited default command; a declared entrypoint with no cmd emits an auto-CMD [] so the entrypoint runs bare instead of double-launching the base image's default command.
  • deploykit/quadlet.go: the quadlet [Container] key is HostName= (camelCase) — the lowercase Hostname= is NOT a supported key and quadlet SKIPS the entire unit over it (systemctl --user start fails exit 5 "Unit not found"). Emission now writes the valid HostName= key (mapped by quadlet to podman's --hostname), giving the in-container hostname = the charly-network DNS name — parity with the direct-run --hostname <name> argv the main-repo pod plugin emits. Golden test pins the emitted unit byte-exact.
  • buildkit/config_resolve.go + deploykit/resolved_project.go + deploykit/spec_resolved_box_adapter.go: project the box-authored Entrypoint/Cmd through the resolved-box forms so the plugin-build resolve leg re-emits them without the live candy graph.
  • deploykit/oci_packaging_test.go: three tests — emitted-as-OCI-ENTRYPOINT/CMD, declared-empty-cmd-clears-base-cmd, and the blast-radius guard: a default box ships NO baked command. All fail without the change.
  • go.mod/go.sum: require github.com/opencharly/spec bumped v0.2026223.1018 → v0.2026224.403 (mandatory — the sdk module has NO replace, so the pin is what standalone consumers resolve against; GOWORK=off go build ./... && go test ./... green against the new pin).
  • CHANGELOG/2026.224.0404.md: staged (placeholder CalVer, finalized at merge).

Change class

charly-or-sdk Go (wire/contract consumer repo), cross-repo: opencharly/spec (LANDED, v0.2026224.403) → opencharly/sdk (this PR) → opencharly/charly (manager box entrypoint: + ${HOSTNAME} + --hostname parity + submodule gitlink pins — NOT yet open; depends on this merge + tag).

How R10-tested — exact gate, commands, and pasted output

  • The gate for this change class: the downstream composing disposable bed charly check run check-agentteams-pod (main repo, disposable: true) — the R10-gate-by-change-class matrix maps a wire-shape contract change onto the bed that composes it, because the sdk emitter only has observable behavior through the main box that consumes it.
  • Eval beds run — the EXACT beds + per-bed results:
    • check-agentteams-pod | pod | ok | 13 steps | 399s (run calver 2026.224.0319, binary 2026.223.2215 — the worktree-local bin/charly rebuilt with the full three-repo tree, so the sdk emission code reached the emitter). The update step ran a fresh charly update and check-live-rebuild + feature-run-rebuild re-verified the fresh deployment.
  • Fresh rebuild: task build:binary rebuilt the worktree bin/charly (charly version = 2026.223.2215) from the three-repo tree including this sdk commit's emission code; the bed ran on it, then on a fresh charly update — ZERO warnings across every log.
  • Did the CHANGED code path execute live? YES. The manager box declared entrypoint: [supervisord, -n, -c, /etc/supervisord.conf], the sdk emitter (this commit) baked it into the manager image's OCI config (ENTRYPOINT ["supervisord","-n","-c","/etc/supervisord.conf"] + CMD [], verified via charly box inspect), the controller spawned the manager from that image through the bound rootless podman socket, and the manager reached "phase":"Running" — the exact failure mode this fix addresses. Two earlier runs show the pre-fix state: 2026.224.0211 (ok: false — manager REST API unreachable, the crash-loop symptom) and 2026.224.0302 (start step ok: false — the quadlet Hostname= unsupported-key unit-skip, root-caused and fixed in this leg). The quadlet HostName= emission ran live in every start step of the final bed.
  • Concurrency: N/A — the emission is pure render (no shared-state path); the bed ran on the combined tree with no surfaced failure.
$ ./bin/charly check run check-agentteams-pod
charly check run check-agentteams-pod: [image-build] PASS after 1m3.581s (log: .check/check-agentteams-pod/2026.224.0319/image-build.log)
charly check run check-agentteams-pod: [check-image] PASS after 24.699s
charly check run check-agentteams-pod: [deploy-add] PASS after 24.852s
charly check run check-agentteams-pod: [config] PASS after 18.973s
charly check run check-agentteams-pod: [start] PASS after 24.706s
charly check run check-agentteams-pod: [bring-up-members] PASS after 48ms
charly check run check-agentteams-pod: [check-live] PASS after 41.806s
charly check run check-agentteams-pod: [feature-run] PASS after 24.347s
charly check run check-agentteams-pod: [update] PASS after 1m34.066s
charly check run check-agentteams-pod: [check-live-rebuild] PASS after 39.934s
charly check run check-agentteams-pod: [feature-run-rebuild] PASS after 24.25s
charly check run check-agentteams-pod: [cleanup] PASS after 17.579s
charly check run check-agentteams-pod: [cleanup-members] PASS after 0s
charly check run check-agentteams-pod: PASS (steps=13)

$ grep 'agentteams-manager-running' .check/check-agentteams-pod/2026.224.0319/check-live.log
  PASS  check the controller spawns the default manager and it reaches Running phase (proves the manager image is in the host store under AGENTTEAMS_MANAGER_IMAGE and the controller can spawn it through the bound podman socket)  [agentteams-manager-running]  exit=0

# Zero warnings confirmed across every bed log (grep -E '^(WARN|.*\[WARN)|warning:|WARNING' on all *.log, excluding baked label content → empty).

# Standalone battery (this repo) — against the BUMPED spec pin (GOWORK=off, no replace):
$ GOWORK=off go build ./... && GOWORK=off go test -count=1 ./...
ok  	github.com/opencharly/sdk/deploykit  ...  # TestOCIPackaging_EmittedAsOCIEntrypointAndCmd / _DeclaredEmptyCmdClearsBaseCmd / _DefaultBoxShipsNoBakedCommand PASS (fail without the change)
# Full workspace battery: go build ./... && go test -count=1 ./... green (all packages, exit 0)
$ gofmt -l . ; go vet ./... ; golangci-lint run ./...   # empty / clean / 0 issues

Attribution tier

fully tested and validated — the cutover's NEW code path executed live against the fresh rebuild: the emitter baked the manager image's ENTRYPOINT+CMD [], the quadlet HostName= ran in the start step, and agentteams-manager-running PASSed (exit 0) on the check-agentteams-pod bed — 13 steps, zero warnings, on disposable: true, plus a fresh charly update re-verification leg. Output pasted above.

Harness rulebook compliance — state HOW each is satisfied (or N/A — <reason>)

  • R0 skills: /charly-internals:plugin (the emitter is a deploykit pure render — M mechanism, no host I/O; the box fields arrive via the spec wire types); /charly-check:check R10-gate-by-change-class; /charly-internals:git-workflow two-step landing.
  • R1 RCA + zero warnings: the manager crash-loop was root-caused across three repos (no baked OCI command from the controller's dockerCreatePayload + charly images baking none). The bed shows zero warnings; the two earlier failed runs (2026.224.0211, 2026.224.0302) are the documented pre-fix states. The quadlet Hostname=→HostName= unsupported-key unit-skip was root-caused and fixed in this leg (golden test pinned byte-exact).
  • R2 no out-of-scope: every issue surfaced during this cutover is fixed in one of the three cutover commits — none parked as pre-existing/follow-up.
  • R3 no duplication: the emitter is the ONE place the OCI config is written (deploykit/generate.go); the auto-CMD [] guard lives beside it; no <name>-host/<name>-pod siblings.
  • R4 no workaround: no sleep/retry/magic-number/env-shim; the fix is an explicit opt-in emission, not an image-level hack.
  • R5 hard cutover + grep: no identifiers removed; no transitional/dual-mode path in the final code.
  • R6 git safety: N/A — no destructive git action; the branch advanced by adding commits only (no force-push).
  • R7 runtime gate: the change ran the end-to-end bed gate (charly check run check-agentteams-pod, 13 steps, exit 0) — not just go test.
  • R8 artifact invariants: the emitted-artifact assertion is THIS leg's load-bearing gate — ENTRYPOINT/CMD Containerfile sections (pinned by TestOCIPackaging_EmittedAsOCIEntrypointAndCmd), the HostName= quadlet key (golden quadlet_test.go), and charly box inspect verified the real manager image carries ENTRYPOINT ["supervisord",...] + CMD [].
  • R9 binary == source + deps: the consuming main binary was rebuilt (charly version = 2026.223.2215) and ran the bed; the spec pin bump is mandatory for standalone consumers and verified under GOWORK=off (no new runtime OS deps).
  • R10 disposable + coverage: proven on disposable: true (check-agentteams-pod), fresh rebuild, zero warnings; the new tests (TestOCIPackaging_*) FAIL without the change.
  • RDD / ADE / SDD: SDD — the wire fields are CUE-sourced in the spec repo (regenerated, TestGenReproducible green there); the sdk consumes them via the pinned module, no hand-typed wire struct. RDD: the composition-at-latest-versions assumption was bed-proven (check-agentteams-pod). ADE: N/A — no candies authored in the sdk repo.
  • Hard cutover: ONE atomic commit; no Phase-2/TODO/deferred left in scope.
  • Kernel/plugin boundary law: the emitter lives in deploykit (an sdk kit) — a pure render mechanism with no registry coupling; the spec fields arrive via the pinned wire module. Correct layer.
  • Disposable-only autonomy: the only autonomous destroy/rebuild was on the disposable: true bed.
  • Clean architecture + Go gates: gofmt -l . empty, go vet ./... clean, golangci-lint run ./... = 0 issues, go test ./... green (workspace + GOWORK=off).
  • CHANGELOG: CHANGELOG/2026.224.0404.md staged (placeholder CalVer, finalized by the pr-validator at merge).

Assisted-by: Claude Code deepseek-v4-flash:cloud (fully tested and validated)

…arity

The sdk half of the AgentTeams manager crash-loop fix (spec → sdk → main).
Consumes the opt-in entrypoint:/cmd: box wire fields (spec v0.2026224.403) and
emits them into the image's OCI config, so a box whose children are spawned
directly from its baked OCI config (no charly deploy in the loop) can bake the
command they run. The Containerfile emitter writes ENTRYPOINT/CMD (with an
auto-CMD [] when an entrypoint is declared without a cmd, so the entrypoint runs
bare — a default box still ships NO baked command). The quadlet path emits the
valid camelCase HostName= key (the lowercase Hostname= is unsupported and
quadlet skips the whole unit), giving in-container hostname = the charly-network
DNS name under every deploy path.

Assisted-by: Claude Code deepseek-v4-flash:cloud (fully tested and validated)
@atrawog

atrawog commented Aug 12, 2026

Copy link
Copy Markdown
Contributor Author

pr-validator — APPROVED ✅

Change class: charly/sdk Go (wire-shape/contract consumer — the OCI ENTRYPOINT/CMD emitter + quadlet HostName= parity)

Head SHA validated: ce86d7af8b9e023c30ed8bb158bd1bea94691dbc (feat/oci-entrypoint-export)

Checklist (every rule)

  • [PASS] 0. Security & anti-tampering (T1–T4). No exfiltration, no secrets, no new endpoints, no scope mismatch (all 10 files accounted for in the summary), no weakened guardrails, no supply-chain anomaly (the spec pin bump v0.2026223.1018 → v0.2026224.403 resolves to a landed, verified tag; no replace directive). No embedded directive aimed at the validator; the PR body is data, not instructions. No self-modifying-security surface touched.
  • [PASS] 1. Description complete. Full org template filled; Summary of changes accounts for every file; How R10-tested names the exact gate (charly check run check-agentteams-pod), the disposable: true target, the fresh-rebuild confirmation, the live-executed changed path, and pasted output; Attribution tier justified; every applicable rule answered with a one-line HOW. Body ends with the *Assisted-by: Claude Code deepseek-v4-flash:cloud (fully tested and validated)* footer in the exact required form.
  • [PASS] 2. Change-class gate (R10). The touched path is the Containerfile emitter + quadlet emitter. The only box in the tree that declares entrypoint: is agentteams-manager → its composing bed check-agentteams-pod is the correct gate (default boxes ship no baked command, so the changed path does not execute on the other beds — the bed-coverage mapping is correct, not merely "some beds ran"). No --dry-run, no rebuild-without-invocation, no scope-shrinking flag.
  • [PASS] 3. Attribution tier. fully tested and validated is earned: the changed runtime path (baked ENTRYPOINT/CMD + quadlet HostName=) executed live on the fresh-rebuild bed at zero warnings with pasted output; the harness/model identity matches the authoring runtime.
  • [PASS] 4. R0 skills honored. git-workflow, check, go, plugin loaded and spot-checked against the diff; no contradiction.
  • [PASS] 5. R1 — RCA on every failure; ZERO warnings. The bed's earlier runs document a coherent pre-fix chain: 2026.224.0211 check-live ok: false (manager crash-loop — REST API unreachable), 2026.224.0302 start ok: false (quadlet unit-skip, command exited 5 — lowercase Hostname= unsupported), 2026.224.0319 all 13 steps ok: true (fix landed). No flake/transient framing; no surviving warning in the gate output.
  • [PASS] 6. R2 — no pre-existing/out-of-scope split. The whole fix (emitter + quadlet parity + spec pin) is in-tree; nothing parked.
  • [PASS] 7. R3 — no duplication. deploykit/generate.go is the ONE place OCI config is written; the Entrypoint/Cmd projection is threaded through the resolved-box forms without a second emitter.
  • [PASS] 8. R4 — no ad-hoc workaround. No sleeps, retries, magic numbers, or ad-hoc podman/systemctl; the quadlet fix is the correct key spelling, not a workaround.
  • [PASS] 9. R5 — hard cutover. No removed identifiers, no transitional/dual-mode path; the final code is what the gate exercised.
  • [PASS] 10. R6/R8/R9 — artifact + binary integrity. R6: clean status, no destructive actions. R8: the emitted .build/agentteams-manager/Containerfile is byte-exact the new emitter's output (ENTRYPOINT ["supervisord","-n","-c","/etc/supervisord.conf"] + CMD []). R9: the bed's binary is 2026.223.2215, rebuilt before the bed and matching source.
  • [PASS] 11. R10 — disposable-only, fresh-rebuild, zero-warning, coverage. The bed is disposable: true; the update step ran a fresh charly update (overlay agentteams:check-agentteams-pod-2026.224.0319); the manager-running check PASSed (exit=0); the summary on disk matches the claim exactly (13 steps, ok: true, 399s). The change ships 3 new unit tests that would FAIL without it (TestOCIPackaging_EmittedAsOCIEntrypointAndCmd, _DeclaredEmptyCmdClearsBaseCmd, _DefaultBoxShipsNoBakedCommand) plus the quadlet golden test pinning HostName= byte-exact. I independently re-verified the committed state: standalone GOWORK=off build+test green, workspace go build all green, gofmt clean, go vet clean, golangci-lint 0 issues.
  • [PASS] 12. RDD / ADE / SDD. SDD: the Entrypoint/Cmd wire fields are CUE-generated in [email protected] (verified in the module cache — spec/cue_types_gen.go carries them on Box/ResolvedBox/ResolvedBoxView); no hand-written wire type, no new @go(-), no hand-parsed map[string]any. ADE/RDD: N/A — no candy authored in this change.
  • [PASS] 13. Concurrency mandate + anti-cheat. The change is pure render (no shared-state path), so the serial bed is the correct gate; no idle/serial pass cited for a load failure, no forbidden framing, no dead-code-in-touched-module pass, no unadvanced parking phrase, no sweep claim without executed evidence.
  • [PASS] 14. Hard cutover. One atomic commit on the feat branch; no Phase-2/TODO; the plan is executed as written.
  • [PASS] 15. ARCHITECTURE GATE — placement: CORRECT. The emitter lives in deploykit (an sdk kit) — a kind-blind render mechanism consumed by the box builder, the correct layer per the boundary law. No charly/*.go in the diff, no new/grown alias file, no new kit import into core. Per-item trace: no staged charly/*.go files to trace.
  • [PASS] 16. Disposable-only autonomy. The bed target is explicitly disposable: true; no non-disposable destroy.
  • [PASS] 17. Clean architecture + go gates. gofmt -l empty, golangci-lint run ./... 0 issues, go vet ./... clean, go test ./... green (standalone and workspace context); repo invariants (lowercase-hyphenated names, YAML-tag symmetry) hold.
  • [PASS] 18. CHANGELOG present. CHANGELOG/2026.224.0404.md staged; filename matches ^\d{4}\.\d{3}\.\d{4}\.md$; H1 byte-equals # 2026.224.0404 — bake box-authored OCI ENTRYPOINT/CMD; quadlet HostName= parity; the placeholder CalVer does not exist as a CHANGELOG/*.md or v* tag on main.

Comments considered: none — the PR carries no comments and no reviews.

Cross-PR interactions considered: none open — gh pr list across opencharly/sdk, opencharly/charly, and opencharly/spec shows no other open PRs. (The spec leg of this cutover already LANDED as opencharly/spec#23 → v0.2026224.403; the main-repo PR is not yet open and is not this PR's concern.)

Decision: PASS. The change is in full compliance with the project rulebook and the loaded skills. The R10 evidence chain was independently re-derived from the on-disk bed artifacts, the generated Containerfile, the manager image's OCI config, and the rebuilt binary — not taken from the author's word. Proceeding to merge-time CalVer finalization, squash-merge, and tag.

Assisted-by: Claude Code deepseek-v4-flash:cloud (fully tested and validated)

Assisted-by: Claude Code deepseek-v4-flash:cloud (fully tested and validated)
@atrawog
atrawog merged commit b49946e into main Aug 12, 2026
@atrawog
atrawog deleted the feat/oci-entrypoint-export branch August 12, 2026 04:24
@atrawog

atrawog commented Aug 12, 2026

Copy link
Copy Markdown
Contributor Author

pr-validator — merged

Phase 3 completed: merge-time CalVer finalized, squash-merged, tagged.

  • Merge: b49946e1c1a90b881399acf082535a0a64c0a8a6 (squash, --delete-branch) — main is now at this commit.
  • CalVer: 2026.224.0422 — CHANGELOG/2026.224.0422.md (placeholder 2026.224.0404.md renamed; H1 rewritten to # 2026.224.0422 — bake box-authored OCI ENTRYPOINT/CMD; quadlet HostName= parity, byte-equal to the filename).
  • Tag: v0.2026224.422 (Go-module form — HHMM 0422 → 422, leading zeros stripped) on the merged HEAD, pushed.
  • Squash trailer proof: pre-merge parse = Assisted-by: Claude Code deepseek-v4-flash:cloud (fully tested and validated); merged b49946e parse = Assisted-by: Claude Code deepseek-v4-flash:cloud (fully tested and validated) — byte-identical.

The main-repo PR (the third leg of the spec → sdk → main cutover) can now bump its sdk gitlink to b49946e / v0.2026224.422.

Assisted-by: Claude Code deepseek-v4-flash:cloud (fully tested and validated)

atrawog added a commit to opencharly/charly that referenced this pull request Aug 12, 2026
…nd the pod bed (Unit 3)

The main-repo leg of the three-repo fix (spec → sdk → main, B6 producer→consumer order) for the AgentTeams manager container crash-loop, landing **Unit 3** of the AgentTeams integration: the controller candy, the top composition, the manager image, and the `check-agentteams-pod` bed. Consumes the opt-in `entrypoint:`/`cmd:` box wire fields (spec v0.2026224.403, PR opencharly/spec#23) and the sdk's OCI ENTRYPOINT/CMD emission + quadlet `HostName=` parity (sdk v0.2026224.422, PR opencharly/sdk#129).

**Root cause being fixed:** the AgentTeams controller spawns child manager/worker containers **directly from their baked OCI config** (`dockerCreatePayload` sends no Cmd/Entrypoint), with no charly deploy in the loop to inject the init command — and charly images baked none. The spawned manager therefore ran bare `bash` (the base image's default `/usr/bin/bash`), exited 0, and restarted forever. The fix lands the box-authored OCI packaging end to end: the `agentteams-manager` box declares `entrypoint: [supervisord, -n, -c, /etc/supervisord.conf]`, the sdk emitter bakes it into the image's OCI config, and the controller's spawn now boots supervisord.

**Concrete edits (all 15 files accounted for):**
- `candy/agentteams-controller/charly.yml` (new): builds `agentteams-controller` + `agt` from the pinned AgentTeams v1.2.2 source tarball, downloads kube-apiserver v1.31.3, installs the CRD manifests + builtin agent trees, and runs the controller as a rootless supervisord service on :8090 with the kine-backed embedded kube-apiserver. The charly-owned `start-controller.sh` resolves the shared credentials from the `/data` volume and execs the controller — no upstream install script, no root.
- `candy/agentteams/charly.yml` (new): the top composition — the five foundation candies (minio, matrix, element, higress, controller) into one box.
- `candy/agentteams-manager/charly.yml` (new): the manager image (`tag: manager`) — the openclaw gateway runtime built from the pinned upstream source commit, plus mc and the agt REST client, with the box-level `entrypoint:` that fixes the crash-loop.
- `charly.yml`: the `agentteams` box + `agentteams-manager` box + the `check-agentteams-pod` bed (replaces `check-agentteams-core-pod`): binds the host rootless podman socket into the box, pins `AGENTTEAMS_MANAGER_IMAGE` to the pre-built manager image, and adds the manager-spawn check — the controller creates the default Manager CR and the check polls `/api/v1/managers` until the manager reaches `"phase":"Running"`.
- `candy/plugin-deploy-pod/config_setup_helpers.go`: the direct-run `charly start` argv now emits `--hostname <name>` — parity with the quadlet `HostName=` key (the sdk leg's fix), so the in-container hostname = the charly-network DNS name on BOTH deploy paths.
- `candy/plugin-box/inspect_list.go` + test: the `listServices` root-cause fix — the predicate now reads `init_systems` (non-empty = at least one init system triggers) instead of the dead `has_init` aggregate the resolution pipeline never populates.
- `candy/agentteams-minio/charly.yml` + `candy/agentteams-matrix/charly.yml`: small fixes surfaced during the Unit-3 bed runs (minio health-check path, matrix env).
- `charly/go.mod` + `candy/plugin-deploy-pod/go.mod`: `require github.com/opencharly/spec` bumped to `v0.2026224.403` (the merged spec tag).
- `sdk` + `spec` submodule gitlinks: pinned to the merged SHAs (`b49946e`, `9e52340`).
- `CHANGELOG/2026.224.0510.md` (new): the Unit-3 release entry (CalVer stamped at merge).

Assisted-by: Claude Code deepseek-v4-flash:cloud (fully tested and validated)
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