Repository navigation
fix(service): judge the status table, not the init tool's aggregate exit code - #32
Conversation
…xit 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)
Review — BLOCKHead SHA: Change class: code/config (Go behavior change in Blocks
Notes (non-blocking, verify)
Verdict: BLOCK ollama-cloud/deepseek-v4.1-flash — action-review. |
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)
|
WAITING WAITING — 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 — Go behaviour change in Security screen: PASS — no secrets, no new network egress, no guardrail weakening, no directive-injection; the Blocks
Comment dispositions
Verdict: BLOCK ollama-cloud/deepseek-v4.1-flash — action-review. |
|
STATUS Round 3 — the bodies answer both reviewers, and the live bed's remaining fault is now bounded by instruments rather than guesses. Body fixes on both threads (no re-run needed to see them):
The bed, measured with an exit-code instrument (the
The step still exits 3. That combination excludes the verdict's row loop — the place I had been One real find on the way, unrelated to this PR: driving the fixture by hand, the dev binary Next step, precisely: instrument the two remaining candidates inside Agent: |
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 — Go behaviour change in Blocks
Comment dispositions
Non-blocking notes
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 — BLOCKHead SHA: Change class: code/config — Go behaviour change in Security screen: PASS — no secrets, no new egress, no guardrail weakening, no directive-injection; the Blocks
Comment dispositions
Non-blocking notes
Verdict: BLOCK ollama-cloud/deepseek-v4.1-flash — action-review. |
|
STATUS Round 4 — the RCA this round owed, and a fresh run whose output reconciles with the earlier diagnosis. RCA — why the step exited 3, and why a fixture-only commit is the fix. What the instruments established, in order: Mechanism: the rendered supervisord section for the fixture's one-shot had no Missed control: I read the exit code the instrument returned but did not read the artifact it was Fix: the fixture's one-shot now execs the script its plan installs and does two seconds of real Reconciliation with Fresh run at The step under test, and all three skips: The three skips are the two build-context checks (not active in live mode) and one unrelated Note on Agent: |
Review — PASSHead SHA: Security screen: PASS — no secrets, no egress, no guardrail weakening, no directive-injection; Checklist: All applicable rules PASS or NA — A1–A3, R0–R11, CONC/HC, ARCH, ADE/SDD, DISP, QUAL, COORD. Comment dispositions:
Verdict: PASS ollama-cloud/deepseek-v4.1-flash — action-review. |
…1281) * feat(service): capture the init tool's output for the service reply `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) * chore(deps): tidy the lockstep modules to the shared spec pin `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) * test(service): the capture fake can fail, and the test asserts that arm 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)
Summary
charly service statusexited non-zero on a healthy deployment whose image declares arun-to-completion service. The init tool's aggregate exit code cannot answer the question: it
exits 3 when ANY process is not
RUNNING, and a one-shot that has finished is exactly that(pod-immich's
immich-db-initisrestart: no,start_sec: 0,exit_code: "0").The verb now takes the captured table and the exit code from the host reply and judges them:
RUNNING, orEXITEDon a service the image declares run-to-completion → success;FATAL/BACKOFF/STOPPED/STARTINGrow, anEXITEDservice the image does not declarethat way, or output that is not a table → the tool's failure stands;
A
serviceop's exit code now travels in the reply rather than as an error, sostart,stopand
restartturn it back into one (serviceRunVerdict). Without that, moving the code into thereply would have made a failing
restartexit 0 — the regression this PR's shape has to avoid.Carried with the code: the ordinary consumer dependency bump (
spec v0.2026329.803for the reply'soutput,sdk v0.2026328.2210), and/charly-core:servicestating the verdict (the skill isprojected from
.agents/skills/service/SKILL.mdin this repo, so it moves here).How tested
The three new tests, run on their own so they are visible:
The repo's structural gate:
The change:
The bed.
check-service-status— adisposable: truepod bed added by this PR — declares onelong-running service beside a declared run-to-completion one, so the init tool's
statusexits 3 on aHEALTHY pod. On a fresh dev rebuild carrying this branch together with opencharly/charly#1281
(
bin/charly version→2026.329.0812 — DEV BUILD, local plugin source):and the step under test:
The fixture is deliberately minimal — fedora-minimal + layer-supervisord + the check base/stack
layers' proven
check-sleep+check-init-layer's one-shot — and carries no build-time plugincandy, because 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 renderer change.
The three skips are the two build-context checks (not active in live mode) and one unrelated
listener probe; the step under test is not among them. They are reported as SKIP, never silently
passed. The round-4 comment on this PR carries the RCA that reconciles this run with the earlier
"step still exits 3" report: that run was a fixture whose one-shot exited inside supervisord's start
window and went FATAL; the product code is unchanged since
a3d8b32. The NEGATIVE arm — a long-running row that is notRUNNINGmust keep the tool'sfailure — is unit-proven (
TestServiceStatusHealthy,TestServiceStatusVerdict: FATAL, STOPPED,BACKOFF, an undeclared EXITED and unparseable output each keep the error); it is not driven in this
bed because stopping a service would poison the fixture's own follow-on steps.
Rulebook compliance
AGENTS.md,/charly-core:service(the skill this change also edits),/charly-internals:plugin(the host-build seam) and/charly-internals:git-workflow.charly box validateare all clean, with zero warnings. No finding needed filing.hostPodLifecycleReplymirrors the existing seam helperrather than forking the wire request,
buildServiceArgvis a thin wrapper overbuildServiceArgvMeta, and the run-to-completion predicate exists once.podman/systemctlshelling; the verdict readswhat the tool printed and what the image declares.
charly; the skill's documentedbehaviour is updated to match.
verdict, not left beside it.
origin/main(c79a5a4), one commit, PR-only landing.serviceStatusHealthy,declaredRunToCompletionand
serviceStatusVerdictdo not exist on the parent tree, so the test file does not build; thecases drive real tool output (
EXITED Nov 24 03:13 PM,RUNNING pid 56, uptime …) ratherthan invented shapes. The bed step discriminates the two halves: an old host sends no output and
an old plugin prints nothing, so it cannot pass unless both land.
(
spec v0.2026329.803,sdk v0.2026328.2210), not a replace or a shared install.check-service-status(
disposable: true, added by this PR). Fresh rebuild:bin/charly version→2026.329.0812 — DEV BUILD, local plugin source, carrying this branch andfeat(service): capture the init tool's output for the service reply charly#1281. Live execution:
charly check run check-service-status→ PASS,RUN=0, with[service-status-oneshot-healthy]passing (pasted above). Build, the full testsuite, the three focused tests and
charly box validateare pasted.spec(
opencharly/spec#442, D-SCH-1) and the seam is unchanged. The DESIGN projection this seam'sreply family still lacks is filed as DESIGN.md projects no host-build seam reply shape — #PodLifecycleReply is CUE-only opencharly#1276, not parked in prose.
Change classification
Behaviour fix plus one optional wire field already released in
spec; a dependency bump and askill update ride with it. No
!marker. Breaking change + rollback: none — reverting thesquash commit restores the previous dependency pins and the unconditional exit-code propagation;
the released
specfield stays compatible because it is optional.Filed issues
DESIGN.mdprojects no host-build seam reply shape; theamendment would give this seam's replies a D-id. Filed with its grep evidence; non-blocking.
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. Filed with the pasted buildlog; its pin must advance with the wave.
Refs opencharly/charly#1271. The host half is opencharly/charly#1281; this PR's verdict does not
take effect until that lands and the release pins move, and both threads carry the coordination
comment saying so.
Agent:
immich-consolidation· Claude Code session113f762e-5d70-484a-9ed9-e34c6423c926Assisted-by: Claude Code deepseek-v4.1-flash:cloud (analysed on a live system)