Repository navigation
Description
Category
category:delivery
Type
type:fix
Remedy / files the remedy will touch
candy/plugin-pod/command.go (the charly service status exit-code path) and its tests — exempt image-declared one-shot services from the aggregate verdict, and make the printed tool exit and charly's own exit agree.
Cited design decision or org-rulebook rule (or none)
none — a CLI verb's exit-code contract is not covered by a D-id or a rulebook rule; cited behavior is /charly-core:service's documented supervisorctl-exit-3 note.
What happens
charly service status <image> exits non-zero on a deployment where every long-running service is healthy, because the image declares a ONE-SHOT service that has finished.
Measured 2026-11-24 against a live immich-cdi deployment (image ghcr.io/opencharly/immich-cdi:2026.328.1448, built from distro-cachyos/box/immich-cdi at pin pod-immich v2026.327.0043):
$ charly service status immich-cdi
dbus RUNNING pid 51, uptime 0:23:35
immich-db-init EXITED Nov 24 03:13 PM
immich-ml RUNNING pid 61, uptime 0:23:35
immich-server RUNNING pid 56, uptime 0:23:35
postgresql RUNNING pid 52, uptime 0:23:35
redis RUNNING pid 54, uptime 0:23:35
charly: error: command "service": exit code 3
$ echo $?
1
The EXITED row is BY DESIGN and the image says so: the same live-check run that exercises this deployment passes the step that declares it —
PASS check immich-db-init is declared as a one-shot service that must exit 0 [immich-db-init-declared]
and the same deployment's authoritative gate is fully green (charly check live immich-cdi → 80 steps: 65 passed, 0 failed, 15 skipped), including immich-ml-service-running, immich-http-ping (status=200) and immich-ml-internal-ping.
Why it matters
A status verb's exit code is its scriptable verdict. charly service status immich-cdi && echo healthy reports failure on a healthy deployment, so no script can use the verb as a gate, and an operator reading a non-zero exit is told to look for a fault that is not there. The charly status tool probe already neutralizes exactly this: /charly-core:service records that "supervisorctl status exits with code 3 when any service isn't RUNNING … the probe's Snippet ends with || true", and classifies the output instead. The standalone verb has no such exemption and additionally prints the raw tool exit ("exit code 3") while itself exiting 1, so the two numbers disagree.
RCA
- Expected: a healthy deployment's
charly service statusexits 0, or exits non-zero only for a service state that indicates a fault. - Actual: exit 1 (message naming the tool's exit 3) with a declared one-shot in
EXITED. - Mechanism: the verb forwards the init tool's aggregate exit code, and the tool counts any service not currently RUNNING — a finished one-shot is not RUNNING — as failure. The image's one-shot declaration (
immich-db-init is declared as a one-shot service that must exit 0) is not consulted when the verb computes its verdict. - Missed control: no arm asserts the verb's exit code on a deployment carrying a declared one-shot; the only covered shape is "all long-running services RUNNING" (which exits 0).
- Blast radius: every deployment that declares a one-shot init service (immich-cdi here; any other image with a one-shot init/migration step), and every script that treats the verb's exit code as a health signal.
- Root fix: exempt services the image declares as one-shots from the aggregate verdict (a one-shot that exited 0 is healthy; exited non-zero is a fault), and make the printed code and the returned code agree.
Blocking or non-blocking
Non-blocking for the deployment that surfaced it (that deployment is healthy by every other measure); the defect is the verb's verdict. Filed unclaimed.
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)
Activity
aitrawog commentedon Nov 25, 2026
STATUS
Reconnaissance for the fix, so the next run does not re-derive it.
charly service statusbuildssupervisorctl statusincandy/plugin-pod/pod_cmd.go(ServiceStatusCmd.Run) and forwards it throughhostPodLifecycle("service", …)→ thepod-lifecycleHostBuild seam. The verb's verdict is therefore the rawsupervisorctlexit code, andsupervisorctl statusexits 3 whenever any process is not RUNNING — which an image-declared one-shot is by design once it has finished.The blocker for the obvious fix:
spec.PodLifecycleReplycarries onlyExitCode(no output rows), so the plugin cannot tell which services are non-running, and therefore cannot distinguish "a one-shot finished" from "a long-running service died". Two legal shapes:PodLifecycleReplywith the status rows (or aNonRunning []string), and decide inServiceStatusCmd.Runagainst the image's declared one-shots (deploykit.ExtractMetadata→ the services whose plan step isoneshot).pod-lifecycleop="service" body, where both the output and the resolved deploy's metadata are already in scope, and return exit 0 for a status run whose only non-running services are declared one-shots — keeping the printed rows and charly's own exit code in agreement.Shape 2 touches the host seam but needs no wire change; shape 1 needs a schema/
cue-genchange plus the decision in the plugin. Either way this is a two-layer change, not a one-line exemption, which is why it is still open.Next update: when the fix PR is open, or 2026-11-25, whichever comes first.
Agent:
immich-consolidation· Claude Code session113f762e-5d70-484a-9ed9-e34c6423c926Assisted-by: Claude Code deepseek-v4.1-flash:cloud (analysed on a live system)
aitrawog commentedon Nov 25, 2026
STATUS
STATUS — the fix shape is now decided from the code, not from a hunch, and it is a three-repo leg.
What the code says (read at
charlypin2c7ffc1,plugin-podandspecat their pins):pluginDeployTarget.Shell(charly/unified_targets.go:451) printsreply.Outputand then turnsreply.ExitCodeinto*exitcode.ExitCodeError. The plugin neversees the text.
spec.PodLifecycleReply(spec/schema/seam.cue:1005) carriesexit_codeonly, and its commentstates the intent explicitly: "op-specific progress prints host-side … and failure signals via
the error return". So today there is no way for
candy/plugin-podto judge the rows.pod-immich'simmich-db-initisrestart: no,start_sec: 0,exit_code: "0", anddeploykit.ExtractMetadataexposes those fields on everymeta.Serviceentry.So the decision cannot be host-side (the host has the rows but not the declaration) and cannot be
plugin-side today (the plugin has the declaration but not the rows). The minimal honest change:
spec— addoutput?: stringto#PodLifecycleReply(CUE first,charly task cue-gen), andupdate its comment: captured stdout for op="service" too, printed by the PLUGIN so it can judge.
charly—pluginDeployTargetgains a package-private capture (the dispatch reply already hasOutput);hostBuildPodLifecycle'sservicecase returns{ExitCode, Output}and no errorwhen the target can capture, keeping
lt.Shell's path for targets that cannot.plugin-pod—ServiceStatusCmd.Runprints the reply's output, and on exit 3 treats the run ashealthy iff every non-
RUNNINGrow is a declared run-to-completion service (Restartin{
no,false} andStartSec == 0with anExitCode) inEXITEDstate; anything else keeps theexit-code error. ONE predicate for "run-to-completion", used by the verb and its tests.
Producer-first order is
spec → charly → plugin-pod(plugin-pod's module pin moves incharly),then one umbrella wave. I am not starting it in the same change as the pin wave in flight
(opencharly/opencharly#1274); the next session picks it up from this comment.
Agent:
immich-consolidation· Claude Code session113f762e-5d70-484a-9ed9-e34c6423c926Assisted-by: Claude Code deepseek-v4.1-flash:cloud (documentation reviewed)
test(seam): prove the service reply carries the init tool's output
feat(seam): the pod-lifecycle reply carries the service command's out…
test(bed): the check-pod fixture declares a run-to-completion service
test(bed): a minimal bed that proves the service-status verdict
fix(service): judge the status table, not the init tool's aggregate e…
feat(service): capture the init tool's output for the service reply (#…