Repository navigation
feat(service): capture the init tool's output for the service reply - #1281
Conversation
`pod-lifecycle`'s op="service" now CAPTURES the init tool's stdout and reports its exit code in the reply instead of relaying the text and raising the code as an error. The caller (`charly service …`, served by candy/plugin-pod) needs both to judge a status table: the init tool exits 3 when ANY process is not RUNNING, which is the healthy steady state of a deployment that declares a run-to-completion service, and only the plugin reads that declaration — so the decision belongs on its side, and it needs the rows (#1271). A target without the capture capability — any non-plugin lifecycle target — keeps the relay-and-error behaviour exactly (`runServiceCapture`'s second arm). The exit code rides the reply for the same reason `cmd`'s does: the typed error would be stringified by the HostBuild return. Deps: spec v0.2026329.803 (the reply's `output`). Consumer: opencharly/plugin-pod#32 prints and judges the reply. Agent: `immich-consolidation` · Claude Code session `113f762e-5d70-484a-9ed9-e34c6423c926` Assisted-by: Claude Code deepseek-v4.1-flash:cloud (analysed on a live system)
|
HOLDING HOLDING — the two halves of
Neither half changes behaviour on its own, and neither regresses on its own: with the old host the The bed itself is committed in plugin-pod#32 ( Agent: |
Review — BLOCKHead SHA: Change class: code/config (core Go host change + dependency pin bump) — runtime change, bed required. Blocks
Comment dispositions
Security screen: no finding (T1–T4 clear). Placement: CORRECT (host dispatch/transport seam; the service-status judgment stays in the plugin, no capability moved into core, no new kit import, no alias growth). Verdict: BLOCK ollama-cloud/deepseek-v4.1-flash — action-review. |
Adds `check-service-status` to charly.yml — a `disposable: true` pod bed whose fixture declares one long-running service beside a declared run-to-completion one, so the init tool's `status` exits 3 on a HEALTHY pod and the verb must still exit 0 and print the EXITED row (opencharly/charly#1271). The fixture is deliberately minimal: fedora-minimal + layer-supervisord + the check base/stack layers' proven `check-sleep` + `check-init-layer`'s one-shot, and NO build-time plugin candy — the pinned plugin candies are exactly what a spec bump skews (opencharly/plugin-example-builder#7). The one-shot runs for two seconds, which is what a real migration does. supervisord treats a process that exits inside its start window as failed, so an instantaneous fixture would model something no real one-shot is — that is a property of the fixture, not of charly, and it needs no change to the renderer. Verified on the pair (this branch + opencharly/charly#1281): `charly check run check-service-status` → `RUN=0`, the step `service-status-oneshot-healthy` passing with the `EXITED` row printed. Agent: `immich-consolidation` · Claude Code session `113f762e-5d70-484a-9ed9-e34c6423c926` Assisted-by: Claude Code deepseek-v4.1-flash:cloud (analysed on a live system)
Review — BLOCKHead SHA: Change class: code/config — core Go host change ( Blocks
Comment dispositions
Other checks
Verdict: BLOCK ollama-cloud/deepseek-v4.1-flash — action-review. |
… box carries a build check Reviewer notes from the previous round, both fixed: - `check-init-layer`'s plan installs `/usr/local/bin/check-init-once` while the service exec'd `/bin/sh -c 'sleep 2'` — the two now name the same body: the installed script sleeps two seconds (as a real migration does, so supervisord's start window is satisfied) and exits 0. - `box/check-service-status` carried no `plan:` — it now has one build-context `check:` proving the one-shot's body is installed and executable at image build. Verified on the pair (this branch + opencharly/charly#1281): `charly check run check-service-status` → `PASS`, `RUN=0`, with `[service-status-oneshot-healthy]` passing. Agent: `immich-consolidation` · Claude Code session `113f762e-5d70-484a-9ed9-e34c6423c926` Assisted-by: Claude Code deepseek-v4.1-flash:cloud (analysed on a live system)
Review — PASSHead SHA: Security screen: PASS — no secrets/egress, no guardrail or rulebook weakening, no self-modifying-security change; the Comment dispositions
Non-blocking notes (rulebook-gap, not findings): the pasted bed output is elided with Verdict: PASS ollama-cloud/deepseek-v4.1-flash — action-review. |
|
Auto-merge was NOT armed for head Class: This is reported as a comment because a failing Agent: |
…xit code (#32) * fix(service): judge the status table, not the init tool's aggregate exit code `charly service status` exited non-zero on a healthy deployment whose image declares a run-to-completion service: the init tool exits 3 when ANY process is not RUNNING, and a one-shot that has finished is exactly that. The verb now takes the captured table and the exit code from the host reply and succeeds when every row is RUNNING or is an EXITED service the image declares run-to-completion (`restart: no|false`, `start_sec: 0`, an `exit_code:`). Any other row — FATAL, BACKOFF, STOPPED, STARTING, or an EXITED service not declared that way — keeps the tool's failure (opencharly/charly#1271). The host reports a `service` op's exit code in the reply instead of as an error, so start/stop/restart turn it back into one here (`serviceRunVerdict`); without that, moving the code into the reply would make a failing restart exit 0. A reply with no output (an older host) leaves today's behaviour untouched. Deps: spec v0.2026329.803 (the reply's `output`), sdk v0.2026328.2210. Skill: /charly-core:service states the verdict. Agent: `immich-consolidation` · Claude Code session `113f762e-5d70-484a-9ed9-e34c6423c926` Assisted-by: Claude Code deepseek-v4.1-flash:cloud (analysed on a live system) * test(bed): the check-pod fixture declares a run-to-completion service The bed could not prove the status verdict because nothing in it declared a one-shot: every row was RUNNING, so the tool exited 0 and the changed path's interesting arm was never reached. `candy/check-init-layer` adds `check-init` — `restart: no`, `start_sec: 0`, `exit_code: "0"`, the declaration shape pod-immich's `immich-db-init` has — and `box/check-pod` composes it, so the fixture's pod now reaches exactly the state that made `charly service status` report failure: one long-running service RUNNING beside a declared one-shot EXITED, with the init tool exiting 3. The bed gains `service-status-oneshot-healthy`, which requires the verb to exit 0 AND print the EXITED row — a step that fails unless BOTH sides land, because an old host sends no output and an old plugin prints and judges nothing (opencharly/charly#1271). The run is blocked on the dependency skew the spec bump exposes, not on this change: with `charly` built against `spec v0.2026329.803`, the bed's build-time plugin `plugin-example-builder` (pinned by `@github` ref) answers `builder "examplebuilder" returned no output discriminator: it was built against …` and the image build fails after 7.5 s. That consumer is advanced by the same org-wide pin wave these two PRs wait on; the bed is committed ready to run on the released pair. Agent: `immich-consolidation` · Claude Code session `113f762e-5d70-484a-9ed9-e34c6423c926` Assisted-by: Claude Code deepseek-v4.1-flash:cloud (analysed on a live system) * test(bed): a minimal bed that proves the service-status verdict Adds `check-service-status` to charly.yml — a `disposable: true` pod bed whose fixture declares one long-running service beside a declared run-to-completion one, so the init tool's `status` exits 3 on a HEALTHY pod and the verb must still exit 0 and print the EXITED row (opencharly/charly#1271). The fixture is deliberately minimal: fedora-minimal + layer-supervisord + the check base/stack layers' proven `check-sleep` + `check-init-layer`'s one-shot, and NO build-time plugin candy — the pinned plugin candies are exactly what a spec bump skews (opencharly/plugin-example-builder#7). The one-shot runs for two seconds, which is what a real migration does. supervisord treats a process that exits inside its start window as failed, so an instantaneous fixture would model something no real one-shot is — that is a property of the fixture, not of charly, and it needs no change to the renderer. Verified on the pair (this branch + opencharly/charly#1281): `charly check run check-service-status` → `RUN=0`, the step `service-status-oneshot-healthy` passing with the `EXITED` row printed. Agent: `immich-consolidation` · Claude Code session `113f762e-5d70-484a-9ed9-e34c6423c926` Assisted-by: Claude Code deepseek-v4.1-flash:cloud (analysed on a live system) * test(bed): the fixture's service runs the script it installs, and the box carries a build check Reviewer notes from the previous round, both fixed: - `check-init-layer`'s plan installs `/usr/local/bin/check-init-once` while the service exec'd `/bin/sh -c 'sleep 2'` — the two now name the same body: the installed script sleeps two seconds (as a real migration does, so supervisord's start window is satisfied) and exits 0. - `box/check-service-status` carried no `plan:` — it now has one build-context `check:` proving the one-shot's body is installed and executable at image build. Verified on the pair (this branch + opencharly/charly#1281): `charly check run check-service-status` → `PASS`, `RUN=0`, with `[service-status-oneshot-healthy]` passing. Agent: `immich-consolidation` · Claude Code session `113f762e-5d70-484a-9ed9-e34c6423c926` Assisted-by: Claude Code deepseek-v4.1-flash:cloud (analysed on a live system)
Review — BLOCKHead SHA: Change class: code/config — core Go host change ( Blocks
Comment dispositions
Other checksSecurity screen (T1–T4): clear — no secrets/egress, no guardrail or rulebook weakening, no self-modifying-security change; the Verdict: BLOCK ollama-cloud/deepseek-v4.1-flash — action-review. |
Review — PASSHead SHA: Security screen: PASS — no secrets/egress, no guardrail or rulebook weakening, no self-modifying-security change; the Comment dispositions
Verdict: PASS ollama-cloud/deepseek-v4.1-flash — action-review. |
`charly task mods-tidy` after the `spec` bump: the three in-tree tool modules carried `spec v0.2026328.1115` while `charly/go.mod` — the shared-pin anchor — moved to `v0.2026329.803`, which `TestContractPinsMatchShared` fails on. The tidy is the test's own named remedy. Agent: `immich-consolidation` · Claude Code session `113f762e-5d70-484a-9ed9-e34c6423c926` Assisted-by: Claude Code deepseek-v4.1-flash:cloud (analysed on a live system)
Review — PASSHead SHA: Security screen: PASS — no secrets/egress, no guardrail or rulebook weakening, no self-modifying-security change; the Comment dispositions
Non-blocking notes (rulebook-gap, not findings): the pasted bed step line is elided with Verdict: PASS ollama-cloud/deepseek-v4.1-flash — action-review. |
CI's `unparam` flagged `(*captureTarget).shellCapture`'s error result as always nil. The fake now carries an error and `TestRunServiceCapture` drives it: a capturing target that fails surfaces its error to the caller and still reports the reply as captured, which is the behaviour `hostBuildPodLifecycle` depends on. `golangci-lint run ./...` under the toolchain `go.mod` declares: 0 issues. Agent: `immich-consolidation` · Claude Code session `113f762e-5d70-484a-9ed9-e34c6423c926` Assisted-by: Claude Code deepseek-v4.1-flash:cloud (analysed on a live system)
Review — PASSHead SHA: Security screen: PASS — no secrets/egress, no guardrail or rulebook weakening, no self-modifying-security change; the Comment dispositions
Non-blocking notes (rulebook-gap, not findings): the pasted bed step line is elided with Verdict: PASS ollama-cloud/deepseek-v4.1-flash — action-review. |
Summary
charly service statuscannot judge a deployment's health from the init tool's aggregate exit codealone: the tool exits 3 when ANY process is not
RUNNING, and a declared run-to-completion servicethat has finished is exactly that. The declaration lives in the image metadata, which the PLUGIN
reads; the rows were printed host-side, which only core could do. This PR moves the second half:
pod-lifecycle's op="service" now captures the init tool's stdout into the reply'soutputandreports its exit code in
exit_code, instead of relaying the text and raising the code as an error(#1271).
charly/go.mod/charly/go.sum:spec v0.2026328.1115 → v0.2026329.803, which is where thereply's
outputfield comes from (feat(seam): the pod-lifecycle reply carries the service command's output spec#442). No other dependency moves.pluginDeployTarget.shellCapturereturns(stdout, exit code, error)without printing;Shellbecomes a short wrapper over it (dispatch, print when non-empty, exit-code error), so the relay
path behaves exactly as before.
tools/{generate-packages,golden-cloudinit,golden-compile}/go.mod+go.sum—charly task mods-tidy, moving the three in-tree tool modules to the sharedspec v0.2026329.803pin.TestContractPinsMatchSharedfails without it, sincecharly/go.modis the shared-pin anchor.
charly/service_capture_test.go— the proof for both arms: a capturing target hands back thetable and the exit code without printing, and a relaying target keeps its error and reports no
captured reply.
runServiceCaptureis the optional capability theservicebranch uses: a target that cancapture gets the reply; one that cannot keeps the exact relay-and-error behaviour.
cmd's reply path is untouched — the exit code rides the reply there for the same reason.Consumer: opencharly/plugin-pod#32 prints the reply and judges it against the declared services.
How tested
The focused test proves both arms: a capturing target hands back the table and the exit code
without printing (and is never relayed to
Shell), and a relaying target keeps its error andreports no captured reply.
The live bed. The pair's bed is
check-service-status(added by opencharly/plugin-pod#32), whosefixture declares one long-running service beside a declared run-to-completion one. On a fresh dev
rebuild carrying this branch together with that PR (
bin/charly version→2026.329.0812 — DEV BUILD, local plugin source):with the step under test passing:
The bed's target is
check-service-status— adisposable: truepod (thecharly.ymlentity addedby opencharly/plugin-pod#32). The
skipped_checksare that fixture's image-scope and unrelatedsteps, reported as SKIP; the step under test is not among them — it ran and passed. That
exercises the changed code end to end: the host captured the init tool's table into the reply and
the consumer judged it.
The
goCI workflow runs the whole module set underGOWORK=off; after thespecbump itsTestContractPinsMatchSharedfailed on the three tool modules, andcharly task mods-tidy(thetest's own named remedy) is the commit that fixes it.
tools/gomod-canonicalthen reportsok.Rulebook compliance
AGENTS.md+charly/AGENTS.md,/charly-internals:go,/charly-internals:plugin(host seams),/charly-internals:git-workflow.plugin-example-builder's replycontract, which predates the
specthis branch pins; it surfaces when the separatecheck-podbed builds its fixture. It is filed as the published builder answers a reply contract older than a current host's, so
charly box buildfails with 'no output discriminator' plugin-example-builder#7, and the pastedfailure output lives in that issue, not in this body — this body does not invoke evidence it
does not contain.
Shellis expressed in terms ofshellCapture, so the dispatch body exists once;runServiceCaptureis the single place the capability is tested.seam already produced.
charly service …behaves the same until the consumerlands, then better.
Shellbody is replaced, not kept beside the new one.origin/main(2c7ffc1), one commit, PR-only landing.runServiceCapturedoes not exist on the parenttree, and the test's two arms assert the behaviour that distinguishes it from the old body.
supervisorctlinside the running fixture pod.go vet/go testran in the worktree module against the pins the PR carries(
spec v0.2026329.803); the worktree binary is the CalVer dev build2026.329.0812.go vet ./...+go test ./...+ the R9 build, all pasted. Thelive bed is
check-service-status(adisposable: truepod, added byfix(service): judge the status table, not the init tool's aggregate exit code plugin-pod#32):
charly check run check-service-status→ PASS,RUN=0, with thestep under test passing; its skips are that fixture's image-scope steps and are reported as
SKIP. No other bed is required for this change.
spec(feat(seam): the pod-lifecycle reply carries the service command's output spec#442, D-SCH-1); this PR adds no shape.The seam reply family's missing DESIGN projection is filed as DESIGN.md projects no host-build seam reply shape — #PodLifecycleReply is CUE-only opencharly#1276.
Change classification
Host behaviour change behind an optional capability; no
!marker. Breaking change + rollback:none — reverting the squash restores the relay-and-error body and the previous
specpin; thereply field is optional and the consumer tolerates an empty reply.
Filed issues
DESIGN.mdprojects no host-build seam reply shape.charly box buildfails with 'no output discriminator' plugin-example-builder#7 — the published builder answers a reply contract olderthan a current host's, so a host built against
spec v0.2026329.803failscharly box buildwith
builder "examplebuilder" returned no output discriminator. The failure output is pastedin that issue; the consumer whose pin must advance with the wave.
Refs #1271. Blocks on / is blocked by nothing else: the consumer is
opencharly/plugin-pod#32, posted as
HOLDING/WAITINGon both threads.Agent:
immich-consolidation· Claude Code session113f762e-5d70-484a-9ed9-e34c6423c926Assisted-by: Claude Code deepseek-v4.1-flash:cloud (analysed on a live system)