Skip to content

Carry a wrapped probe's timings, instead of silently dropping them - #176

Merged
gilesknap merged 1 commit into
mainfrom
fix/liveness-probe-timings
Aug 22, 2026
Merged

gilesknap merged 1 commit into
mainfrom
fix/liveness-probe-timings

Conversation

@gilesknap

Copy link
Copy Markdown
Member

Found on the first live cluster run of hotfix mode — podbench 0.6.0 against p47-beamline on pollux, 2026-08-22.

The defect

--print-values --liveness emits a wrapped probe carrying only exec.command. A chart that accepts a whole livenessProbe renders it wholesale, so anything the snippet omits is not "left as it was" — it becomes the Kubernetes default, and every default is in the direction that restarts things sooner.

ioc-instance is the measured case. Its 120s/30s live on a livenessExecutable branch that supplying livenessProbe takes instead of:

{{- with .livenessProbe }}
livenessProbe:
  {{- . | toYaml | nindent 10 }}
{{- else }}
{{- with .livenessExecutable }}
livenessProbe:
  exec:
    command: [/bin/bash, {{ . }}]
  initialDelaySeconds: 120
  periodSeconds: 30
{{- end }}
{{- end }}

So adopting the wrapper moved bl47p-mo-ioc-01 — a compiled pmac IOC — from 120s/30s to 0s/10s. It would have been probed from the moment it started, before it had reached its brick: a startup restart loop, on the one mode whose entire purpose is avoiding restarts. It was caught by hand-writing the two fields back into the values; nothing in podbench would have said so.

The fix

  • --liveness-probe JSON takes the target's whole probe as kubectl reports it — kubectl get pod POD -o jsonpath='{.spec.containers[0].livenessProbe}' — wraps its exec command and carries every scalar field through in Kubernetes' own field order.
  • --liveness CMD stays for the simple case, but the emitted comment now says it carries no timings and names the flag that does. A snippet that quietly used the defaults was the actual defect, so the bare path had to stop being quiet, not merely stop being the default.
  • A non-exec probe is refused rather than wrapped. An httpGet or tcpSocket check answers from the application, which is exactly what is down while a pod is held — there is nothing the hold file could short-circuit.

Verification

Reproduces the values that were hand-written during the live run:

livenessProbe:
  exec:
    command:
      - bash
      - -c
      - 'if [ -e /tmp/podbench-hold ]; then exit 0; fi; exec /bin/bash /epics/ioc/liveness.sh'
  initialDelaySeconds: 120
  periodSeconds: 30
  timeoutSeconds: 1
  successThreshold: 1
  failureThreshold: 3

1532 passed, 73 skipped. ruff clean, pyright strict clean.

No overlap with #175, which touches only agent.py.

A chart that accepts a whole `livenessProbe` renders it wholesale, so a
timing the snippet omits is not "left as it was" — it becomes the
Kubernetes default, and every default is in the direction that restarts
things sooner.

Measured on p47-beamline, 2026-08-22, on the first live run of hotfix
mode. `ioc-instance` keeps its 120s/30s on a `livenessExecutable` branch
that supplying `livenessProbe` takes *instead of*, so the wrapped probe —
carrying only `exec` — moved a compiled pmac IOC from 120s/30s to 0s/10s.
That IOC would have been probed from the moment it started, before it had
reached its brick: a startup restart loop, on the one mode whose whole
purpose is avoiding restarts. It was caught by hand-writing the two
fields back; nothing in podbench would have said so.

So `--print-values` grows `--liveness-probe JSON`, which takes the
target's whole probe as `kubectl` reports it, wraps its exec command and
carries every scalar field through in Kubernetes' own field order.
`--liveness` stays for the simple case but now says in the emitted
comment that it carries no timings, and names the flag that does — a
snippet that quietly used the defaults was the actual defect, so the
bare path had to stop being quiet rather than merely stop being default.

A non-exec probe is refused rather than wrapped: an httpGet or tcpSocket
check answers from the application, which is exactly what is down while
a pod is held, so there is nothing the hold file could short-circuit.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01UEBcMGtABGqozHVby4smNw
@coderabbitai

coderabbitai Bot commented Aug 22, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 0477a2df-5625-4657-9abd-8bc5ed2107c3

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@gilesknap
gilesknap merged commit fc636d5 into main Aug 22, 2026
30 checks passed
gilesknap added a commit that referenced this pull request Aug 23, 2026
`--no-from-pod` is the exact route that produced #176: a chart renders a
supplied `livenessProbe` wholesale, so a timing nobody typed becomes the
Kubernetes default and the target is probed sooner and more often than it
was. Its own help had to talk you out of using it, which is a flag that has
already failed. "A pod that does not exist yet" is close to vacuous for a
mode applied to something running and broken, and what it emitted was
strictly lower fidelity - hand-supplied fields lose the probe's timings, the
gid and the real entrypoint.

So it goes, with no alias and no hidden spelling, and `--liveness CMD` goes
with it: it could carry an exec command and no timings, which is #176's
shape, and `--liveness-probe JSON` covers the same ground with the timings
attached. `--entrypoint`, `--gid` and `--liveness-probe` stay as overrides
*on top of* the read - stating the one field the pod cannot answer for,
which is what makes `--entrypoint` the answer to an image-ENTRYPOINT target
without giving up the other two.

`FROM_POD_ESCAPE` keeps its #176 sentence even though the flag it warned
about is gone, because that sentence is now the *reason* there is nothing to
fall back to rather than the price of falling back. Without it a reader who
cannot reach the cluster takes the read for a convenience, and their next
move is to hand-write the five keys into the chart anyway - the same
footgun, off the tool and unwarned. What changes is beat three: the way on
is to make the read work, or to state one field on top of it.

Around eight CLI-level tests drove the emitter offline through the flag so
the run touched no cluster. They now read a fixture pod through the injected
runner, which is the pattern `_build_app(runner)` already threads through, so
the suite stays cluster-free: with kubectl off PATH and KUBECONFIG pointing
nowhere, 1668 pass and none error.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WAGABUogwWJ68k1Dh28ZBS
gilesknap added a commit that referenced this pull request Aug 23, 2026
`TARGET_ROOT_UNREADABLE`, `TARGET_HAS_NO_PROJECT` and `FROM_POD_ESCAPE`
were each carrying a paragraph of *why* onto the terminal, because until
now there was nowhere else for it to live. The reader of an error wants
the fact and the flag; the taxonomy of image layouts, what a missing
ptrace rung is, and how a chart renders a supplied `livenessProbe` are all
things somebody meets once, while reading about the mode.

So each keeps its three beats - what happened, whether it matters here,
what to do - and the removed sentences land in the docstring beside the
constant, which now names `docs/how-to/hotfix-a-running-pod.md` as where
they went. Nothing is lost, and the docstrings are where the next person
editing these strings will look.

What each message must not lose is unchanged and deliberate:
`TARGET_HAS_NO_PROJECT` still names neither ptrace nor doctor and still
prints the in-image path rather than the `/proc/1/root/...` form (#178),
the two remain two messages from two probes, and `FROM_POD_ESCAPE` keeps
the consequence of hand-supplying the values because that consequence is
#176 and is the reason the read is not optional.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WAGABUogwWJ68k1Dh28ZBS
gilesknap added a commit that referenced this pull request Aug 23, 2026
Six review findings against Phase 6b, all of them a message or a page
claiming more, or other, than what was measured.

The how-to put the claim's checkout at /podbench/app/src, which is the
retired layout: `checkout_path` returns HOTFIX_APP_PATH unchanged, and
section 4's `cd` was therefore an instruction to enter a directory that
does not exist, in the one section a reader types into a live seat during
an emergency. The init transcript around it is corrected the same way,
including the interpreter line, which prints a version and not a path.

The status block was the one report on the page not rendered by its
formatter: `format_status` prints the row's detail under it, which for a
healthy row is "N commit(s) ahead of the image", not a repeat of the row's
own summary - the very thing #205 item 4 complains about. Rendered through
the real formatter it now matches byte for byte, base sha included.

FROM_POD_ESCAPE said the target "was restarted for it". #176 was caught in
review and hand-corrected before it deployed; no target was restarted. It
now states the direction, which is what invariant 3, cli.md and the how-to
all state, and the docstring records why the stronger claim is the more
expensive one.

TARGET_ROOT_UNREADABLE asserted that this seat lacks the ptrace rung from
a single `ls` exit status. Any non-zero reaches it, and asserting the rung
before sending the reader to `doctor` is #178's shape exactly. It now names
what the listing needs and lets `doctor` be the measurement.

IMAGE_HAS_NO_PROJECT is the same finding as TARGET_HAS_NO_PROJECT reached
through the container rather than the seat, and `check`'s contract is to
say `init`'s refusals in `init`'s terms; their shared remedy sentence had
drifted apart into two spellings. Realigned, not merged - the halves that
differ are what each one measured.

Finally, the consolidate summary counted "the five values" plus the claim,
where the checklist names four keys and the claim is the fifth act.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WAGABUogwWJ68k1Dh28ZBS
gilesknap added a commit that referenced this pull request Aug 23, 2026
#203's rule, applied as one pass rather than 33 edits: a user-facing note
gets what happened, whether it matters here, and what to do about it.
Anything that is *why podbench is confident this is fine* goes to the
docstring; anything that is *how the thing works* is already said once in
docs/how-to/ or docs/reference/cli.md, which is what Phase 6b bought and
what makes this a move rather than a loss. Every sentence taken off a
string lands in that string's docstring, naming the page that carries
the mechanism.

35 constants across launcher.py, hotfix.py and editor.py: 1715 words of
terminal text down to 1319, read end to end as a body before it was
applied, because the property is consistency across the set and that is
invisible one constant at a time. One voice, the same beats in the same
order, and one spelling per concept - "unmeasured" where a reading could
not be taken, "an ephemeral container's X cannot be added to from here"
wherever that is the reason, "the block above" wherever a measurement
already stands.

Two of the cuts are structural rather than verbal. A resize is now three
reports of one event that each say only what the others cannot: the
intent, try_resize's outcome, and the residual hazard - and none of them
repeats the memory row's "used of limit". _SEAT_INSTALL_RELOAD_NOTE
stops being the block's one paragraph, because the page its docstring
asked for now exists.

What did not move: TARGET_HAS_NO_PROJECT and TARGET_ROOT_UNREADABLE stay
as Phase 6b left them, EXISTING_MOUNTS_WARNING is still printed under
--from-pod and still suppressed under --values, and the claim's mount is
still named. FROM_POD_ESCAPE keeps #176 and its direction: Phase 4 took
the offline route away, so that cost is no longer the price of a flag -
it is the reason there is nothing to fall back to, which is invariant 3
in its post-Phase-4 form. VERSION_SKEW_WARNING,
CAPABILITY_STRIPPED_WARNING and HOTFIX_CLAIM_UNMOUNTABLE_NOTE keep every
detail their next action depends on; the rule bounds beat three, it does
not delete it.

The rule itself is now in the terminal-reports skill, where the plan
said it belongs.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WAGABUogwWJ68k1Dh28ZBS
gilesknap added a commit that referenced this pull request Aug 24, 2026
`--no-from-pod` is the exact route that produced #176: a chart renders a
supplied `livenessProbe` wholesale, so a timing nobody typed becomes the
Kubernetes default and the target is probed sooner and more often than it
was. Its own help had to talk you out of using it, which is a flag that has
already failed. "A pod that does not exist yet" is close to vacuous for a
mode applied to something running and broken, and what it emitted was
strictly lower fidelity - hand-supplied fields lose the probe's timings, the
gid and the real entrypoint.

So it goes, with no alias and no hidden spelling, and `--liveness CMD` goes
with it: it could carry an exec command and no timings, which is #176's
shape, and `--liveness-probe JSON` covers the same ground with the timings
attached. `--entrypoint`, `--gid` and `--liveness-probe` stay as overrides
*on top of* the read - stating the one field the pod cannot answer for,
which is what makes `--entrypoint` the answer to an image-ENTRYPOINT target
without giving up the other two.

`FROM_POD_ESCAPE` keeps its #176 sentence even though the flag it warned
about is gone, because that sentence is now the *reason* there is nothing to
fall back to rather than the price of falling back. Without it a reader who
cannot reach the cluster takes the read for a convenience, and their next
move is to hand-write the five keys into the chart anyway - the same
footgun, off the tool and unwarned. What changes is beat three: the way on
is to make the read work, or to state one field on top of it.

Around eight CLI-level tests drove the emitter offline through the flag so
the run touched no cluster. They now read a fixture pod through the injected
runner, which is the pattern `_build_app(runner)` already threads through, so
the suite stays cluster-free: with kubectl off PATH and KUBECONFIG pointing
nowhere, 1668 pass and none error.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WAGABUogwWJ68k1Dh28ZBS
gilesknap added a commit that referenced this pull request Aug 24, 2026
`TARGET_ROOT_UNREADABLE`, `TARGET_HAS_NO_PROJECT` and `FROM_POD_ESCAPE`
were each carrying a paragraph of *why* onto the terminal, because until
now there was nowhere else for it to live. The reader of an error wants
the fact and the flag; the taxonomy of image layouts, what a missing
ptrace rung is, and how a chart renders a supplied `livenessProbe` are all
things somebody meets once, while reading about the mode.

So each keeps its three beats - what happened, whether it matters here,
what to do - and the removed sentences land in the docstring beside the
constant, which now names `docs/how-to/hotfix-a-running-pod.md` as where
they went. Nothing is lost, and the docstrings are where the next person
editing these strings will look.

What each message must not lose is unchanged and deliberate:
`TARGET_HAS_NO_PROJECT` still names neither ptrace nor doctor and still
prints the in-image path rather than the `/proc/1/root/...` form (#178),
the two remain two messages from two probes, and `FROM_POD_ESCAPE` keeps
the consequence of hand-supplying the values because that consequence is
#176 and is the reason the read is not optional.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WAGABUogwWJ68k1Dh28ZBS
gilesknap added a commit that referenced this pull request Aug 24, 2026
Six review findings against Phase 6b, all of them a message or a page
claiming more, or other, than what was measured.

The how-to put the claim's checkout at /podbench/app/src, which is the
retired layout: `checkout_path` returns HOTFIX_APP_PATH unchanged, and
section 4's `cd` was therefore an instruction to enter a directory that
does not exist, in the one section a reader types into a live seat during
an emergency. The init transcript around it is corrected the same way,
including the interpreter line, which prints a version and not a path.

The status block was the one report on the page not rendered by its
formatter: `format_status` prints the row's detail under it, which for a
healthy row is "N commit(s) ahead of the image", not a repeat of the row's
own summary - the very thing #205 item 4 complains about. Rendered through
the real formatter it now matches byte for byte, base sha included.

FROM_POD_ESCAPE said the target "was restarted for it". #176 was caught in
review and hand-corrected before it deployed; no target was restarted. It
now states the direction, which is what invariant 3, cli.md and the how-to
all state, and the docstring records why the stronger claim is the more
expensive one.

TARGET_ROOT_UNREADABLE asserted that this seat lacks the ptrace rung from
a single `ls` exit status. Any non-zero reaches it, and asserting the rung
before sending the reader to `doctor` is #178's shape exactly. It now names
what the listing needs and lets `doctor` be the measurement.

IMAGE_HAS_NO_PROJECT is the same finding as TARGET_HAS_NO_PROJECT reached
through the container rather than the seat, and `check`'s contract is to
say `init`'s refusals in `init`'s terms; their shared remedy sentence had
drifted apart into two spellings. Realigned, not merged - the halves that
differ are what each one measured.

Finally, the consolidate summary counted "the five values" plus the claim,
where the checklist names four keys and the claim is the fifth act.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WAGABUogwWJ68k1Dh28ZBS
gilesknap added a commit that referenced this pull request Aug 24, 2026
#203's rule, applied as one pass rather than 33 edits: a user-facing note
gets what happened, whether it matters here, and what to do about it.
Anything that is *why podbench is confident this is fine* goes to the
docstring; anything that is *how the thing works* is already said once in
docs/how-to/ or docs/reference/cli.md, which is what Phase 6b bought and
what makes this a move rather than a loss. Every sentence taken off a
string lands in that string's docstring, naming the page that carries
the mechanism.

35 constants across launcher.py, hotfix.py and editor.py: 1715 words of
terminal text down to 1319, read end to end as a body before it was
applied, because the property is consistency across the set and that is
invisible one constant at a time. One voice, the same beats in the same
order, and one spelling per concept - "unmeasured" where a reading could
not be taken, "an ephemeral container's X cannot be added to from here"
wherever that is the reason, "the block above" wherever a measurement
already stands.

Two of the cuts are structural rather than verbal. A resize is now three
reports of one event that each say only what the others cannot: the
intent, try_resize's outcome, and the residual hazard - and none of them
repeats the memory row's "used of limit". _SEAT_INSTALL_RELOAD_NOTE
stops being the block's one paragraph, because the page its docstring
asked for now exists.

What did not move: TARGET_HAS_NO_PROJECT and TARGET_ROOT_UNREADABLE stay
as Phase 6b left them, EXISTING_MOUNTS_WARNING is still printed under
--from-pod and still suppressed under --values, and the claim's mount is
still named. FROM_POD_ESCAPE keeps #176 and its direction: Phase 4 took
the offline route away, so that cost is no longer the price of a flag -
it is the reason there is nothing to fall back to, which is invariant 3
in its post-Phase-4 form. VERSION_SKEW_WARNING,
CAPABILITY_STRIPPED_WARNING and HOTFIX_CLAIM_UNMOUNTABLE_NOTE keep every
detail their next action depends on; the rule bounds beat three, it does
not delete it.

The rule itself is now in the terminal-reports skill, where the plan
said it belongs.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WAGABUogwWJ68k1Dh28ZBS
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