Skip to content

Compact hotfix wiring: mount the supervisor runtime from the claim chart - #270

Merged
gilesknap merged 6 commits into
mainfrom
compact-hotfix
Sep 15, 2026
Merged

gilesknap merged 6 commits into
mainfrom
compact-hotfix

Conversation

@gilesknap

@gilesknap gilesknap commented Sep 15, 2026 •

Copy link
Copy Markdown
Member

Summary

Closes #266. The claim chart now ships the Bash supervisor as a ConfigMap mounted at /podbench/runtime/podbench.sh, and workload args hold a one-line call into it instead of an inline loop. Regenerating wiring never nests supervisors, and a runtime fix becomes a chart bump.

Six commits, each independently reviewable:

  1. Mount the hotfix runtime from a ConfigMap (the Keep hotfix workload args compact; move lifecycle supervisor into a mounted script #266 implementation): chart files/podbench.sh + templates/runtime.yaml, lifecycle_supervisor.py reduced to invocation/mount generation, podbench_python / podbench_script startup helpers, IOC and BlueAPI adapters, docs, new runtime and wiring tests.
  2. Merge service-owned lists in hotfix enable instead of refusing: volumes/volumeMounts keep the service's entries and gain the generated ones; other generated keys are replaced by the marked block. Found on P47, where three of four real services were refused.
  3. Install the ptrace shim on hotfix restart --reinstall: claims initialised before the shim existed were undebuggable.
  4. Detach instead of kill when a native IDE session ends: hook-kill in the generated gdb script; the C++ extension's kill on Stop no longer kills the IOC.
  5. Ask for IDE headroom a small beamline node can grant: requests 500m/1Gi, limits 2 CPU/4Gi.
  6. Reserve IDE headroom as a ceiling, not a guaranteed request: no request increment, limits +2 CPU/+4Gi; the LimitRange ratio lifts requests only where a cluster enforces one. On P47 (node 3610m/3900m requested by other namespaces, quota limits.cpu 24.5/25) the request-based form was Deferred and the limits-only form was accepted within 5 s.

Live test on P47 (2026-09-15)

Run with the podbench-hotfix-e2e skill (#264) against p47-beamline, using headless VS Code over Remote-SSH inside the agent sandbox. Service wiring regenerated from pre-hotfix values with hotfix enable and deployed through epics-containers/p47-services (e3cac83, 98f0c84, a48ac0b; the chart is vendored there with a file:// dependency until this version is published).

Target Wiring/rollout Connect Breakpoint Edit Apply Observe Restore
p47-blueapi (Python) pass pass pass (health_probe, hit by the kubelet probe) pass pass, child replaced, 0 container restarts pass pass
bl47p-ea-fastcs-01 (Python under stdio-socket) pass pass pass (controllers.py:53, 0.2 s poll) pass pass pass (PV marker) pass
bl47p-mo-ioc-01 (native pmac IOC) pass pass pass (pmacController::poll, 2697) pass (iocMain.cpp + start.sh, rebuilt in claim) pass, IOC on claim binary pass pass
bl47p-ea-simdet-01 (native, claim shared by 3 pods) pass pass (limits-only headroom) pass (simDetector::computeImage, 777) pass pass, IOC on claim binary, -02/-03 untouched pass pass

Detach fix validated twice on mo-ioc and three times on simdet: Stop → kill → "The program is not being run", IOC pid and restart count unchanged, hold released.

Every rollout replacement pod carried the compact args and a mounted runtime whose sha256 matched the source; second hotfix enable passes reported every file unchanged.

Findings recorded, not fixed here

  • hotfix enable owns BlueAPI startup/readiness probes, so startup headroom cannot be set in service values #268 BlueAPI startup/readiness probes live inside the generated block, so services cannot set startup headroom durably.
  • ide vscode / attach can evict the target pod when ephemeral-storage headroom is exhausted #269 a seat can evict its target pod when ephemeral-storage is exhausted (BlueAPI's 1.7G venv emptyDir under a 2Gi limit).
  • Headroom is never released after an IDE session and a Deferred resize stays pending on the pod; seat preparation without headroom tripped a 1 s exec liveness probe and restarted an IOC (twice across attempts); seats die with the target container and cannot be removed.
  • status lists every container of a pod as a hotfix target and prints the whole exec probe when a container is restarting.
  • Prepare error "debugpy injection failed; check ptrace permissions" hides a missing shim; launcher lists include Attach entries for the pptty wrapper; the seat lacks the app toolchain, so native rebuilds run in the app container.
  • SEAT_HOME_VOLUME in model.py is dead code.
  • Headroom prints a non-round memory request as raw bytes (_format could round up to Mi); palette "Remove All Breakpoints" did not clear a function breakpoint while paused.

Evidence (screenshots, reports, diffs, kubectl snapshots) is kept locally under the worktree's tmp/hotfix-e2e/20260915-p47/.

🤖 Generated with Claude Code

gilesknap and others added 5 commits September 15, 2026 10:00
The podbench-hotfix-claim chart now ships one Bash library, mounted at
/podbench/runtime/podbench.sh. Workload args hold a one-line call,
`podbench_supervise "$1" HEALTH SAFE`, instead of an inline supervisor
loop, so regenerating wiring never nests supervisors and a runtime fix is
a chart bump. The library keeps stop/start/restart, holds, ownership,
Launch cancellation, health checks and child cleanup, snapshots the
exported environment so its own variables cannot leak into the
application, and preserves cwd, identity, umask, checkout PATH and an
existing LD_PRELOAD.

Startup helpers select an initialised checkout: podbench_python prefers
the claim's interpreter, podbench_script runs an editable script when
present. IOC and BlueAPI adapters keep their known paths; BlueAPI's
wrapper calls the same mounted runtime.

Closes #266.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
On P47, `hotfix enable` refused three of four services because their
values already set keys it generates: BlueAPI's `debug`, an IOC's own
`volumes`/`volumeMounts` for /dev/shm, fastcs's `args`. The documented
fallback was to print `hotfix values` and merge by hand, which is exactly
what the tool exists to avoid.

Now `volumes` and `volumeMounts` keep the service's entries and gain the
generated ones (names deduplicated), and every other generated key is
replaced by the marked block. The same rule upgrades unmarked wiring from
older releases without dropping user volumes. `hotfix values` with the
ioc-instance prefix applies the same editable start-script helper as
enable, so the two commands agree.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Only `hotfix init` installed .podbench-ptrace.so, so a claim initialised
before the shim existed could never be debugged: on P47 the fastcs claim
from August failed Attach with "debugpy injection failed; check ptrace
permissions". Rebuilding the claim environment now refreshes the shim too,
and the runtime preloads it on the restarted child.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Podbench's native Attach is a cppdbg launch-type session, and the C++
extension ends every such session, Stop or Disconnect, by sending gdb the
console command `kill`, ignoring its result. On T11 that killed the
attached IOC and restarted its container. The generated gdb script now
defines hook-kill to detach first; `kill` then fails harmlessly with "The
program is not being run" and the application keeps running. Verified on
P47 bl47p-mo-ioc-01: two Stop presses, IOC pid and restart count
unchanged, hold released.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Headroom requested 2 CPU and 4Gi as guaranteed requests on top of the
target container's own. A 4-core beamline node with a namespace quota
could not grant that, the resize sat Deferred and the seat never opened;
without headroom the seat's server install starved a 1 s exec liveness
probe and restarted the IOC. Request 500m and 1Gi with a 2 CPU / 4Gi
ceiling: the seat's server idles well under the floor, language servers,
debuggers and builds burst to the ceiling, and the LimitRange ratio logic
still raises requests where a cluster demands it. A 2 CPU / 2000Mi resize
was accepted immediately on P47 and carried a full native session.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
@coderabbitai

coderabbitai Bot commented Sep 15, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 40 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

This review ran on the open-source allowance, not this organization's plan, because the pull request author doesn't have an assigned seat. Waiting won't change this — ask an organization admin to assign them a seat, or add seats in Billing if every seat is already assigned, then retry.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 999ffbc3-db06-4c49-bae2-60da6d2255c9

📥 Commits

Reviewing files that changed from the base of the PR and between 37f09ff and fba5a40.

📒 Files selected for processing (14)
  • Charts/podbench-hotfix-claim/Chart.yaml
  • Charts/podbench-hotfix-claim/files/podbench.sh
  • Charts/podbench-hotfix-claim/templates/runtime.yaml
  • docs/how-to/enable-hotfix.md
  • src/podbench/hotfix_blueapi.py
  • src/podbench/hotfix_enable.py
  • src/podbench/hotfix_runtime.py
  • src/podbench/hotfix_values.py
  • src/podbench/ide_prepare.py
  • src/podbench/ide_resources.py
  • src/podbench/lifecycle_supervisor.py
  • tests/test_hotfix_enable.py
  • tests/test_hotfix_wiring.py
  • tests/test_lifecycle_runtime.py

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

Even 600m of extra CPU requests was refused on P47: other namespaces hold
most of the single node's request budget (3610m of 3900m), so no request
increment of useful size fits, while actual usage sits near 10 %. Ask for
no extra requests and raise only the limits; where a LimitRange enforces a
limit-to-request ratio the existing logic lifts requests just enough. On
P47 that gives a 2.5 CPU / 4352Mi ceiling with a 250m / 435Mi request,
which the node grants and which carried a full native session.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
@gilesknap
gilesknap merged commit 3133dbb into main Sep 15, 2026
12 checks passed
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.

Keep hotfix workload args compact; move lifecycle supervisor into a mounted script

1 participant