Skip to content

Harden attach and hotfix usability after #238 - #249

Merged
gilesknap merged 1 commit into
mainfrom
fix/238-usability
Sep 12, 2026
Merged

gilesknap merged 1 commit into
mainfrom
fix/238-usability

Conversation

@gilesknap

@gilesknap gilesknap commented Sep 12, 2026 •

Copy link
Copy Markdown
Member

Review of #238 found several ways the MVP could lose work, select the wrong seat, or report misleading results. This draft fixes the concrete failures while keeping the prototype small: no new dependencies or repository tests, every Python file remains below 300 lines, and the overall diff removes more lines than it adds.

Findings addressed

Priority Trigger and previous behavior Change
P1 Retry hotfix init after clone/sync failed before writing its manifest: find -delete removed the checkout, including local edits. Refuse existing work with a recovery message. Clone through a temporary directory on the claim, preserve lost+found, and never overwrite existing paths.
P1 Attach without --context, then change current context or reconnect from desktop VS Code without its terminal environment: SSH could select another cluster. Identical namespace/pod/seat names also overwrote generated files across contexts. Pin context and absolute kubeconfig paths in ProxyCommand; distinguish aliases, config files and host-key identities by connection.
P1 Retire a claim after an API/permission failure: a failed GET was reported as “gone.” A consumer mounting the PVC under a different volume name was missed. Use checked GETs with --ignore-not-found, honor explicit pvc/ references, and inspect every PVC volume before deletion.
P1 Pause BlueAPI at a breakpoint: its readiness probe returned success merely because the debug hold existed. Keep the liveness/startup hold, but always check application health for readiness. Select the named BlueAPI container even when a sidecar comes first.
P2 Attach to CA, then PVA, then return to CA: only the latest seat was considered. Hotfix init/reinstall could run in the PVA seat; attach created unnecessary new seats and ignored identity changes when reusing. Select the newest matching target/image/identity for attach, and matching target for hotfix operations. Internal seat creation also honors PODBENCH_IMAGE.
P2 Run status with an unreachable app, several hotfix containers, or a stopped seat replaced by a healthy one. Report unreachable apps as unavailable without aborting other rows; show all hotfix containers; retain stopped-seat history without making a healthy replacement fail status.
P2 Install a prerelease such as 0.12.0b2, or advance main after merging the prototype branch. Translate prerelease image tags to published SemVer (0.12.0-beta.2); publish the development image from main so it follows the development CLI.
P2 Enable a chart containing ioc-instance: # configuration. Recognize the commented mapping header and extend it rather than writing a duplicate YAML key.
P2 Attach with a missing SSH key, unavailable SSH capabilities, or a custom config directory; restart with a nonpositive deadline. Validate keys before landing a seat, print the exec fallback when SSH is unavailable, preserve --config-dir in recovery guidance, and reject invalid deadlines before contacting Kubernetes.

Ease of understanding

  • Replace Dockerfile commentary about deleted modules, commands and historical experiments with short explanations of the current design. Remove the unused /opt/podbench/debugpy installation and unused launcher helpers; remove the catch-all that silently accepted unsupported launcher keywords.
  • Ignore actual generated hotfix metadata/interpreter files in the seat's Git configuration, so Podbench's own files do not make a clean checkout look edited.
  • Explain installation from main, SSH/Remote-SSH connection, --target versus --container, floating-image refresh, init recovery, dependency reinstall and manual debugpy port forwarding in README.
  • Update the VPN helper's printed instructions to use the current attach command and pinned SSH configuration.

Validation

  • uv run --locked tox -p: passed pre-commit, Pyright and the existing test suite on the final source.
  • uv build and uvx twine check --strict dist/*: passed locally; distribution CI also passed on commit 892fe62.
  • Helm lint and an enabled-claim render passed; shell syntax checks passed for all three Kubernetes helper scripts.
  • Temporary local exercises, with no tests added to the repository: real Git initialization preserving recovered files and refusing an edited partial checkout; real generated-supervisor restarts with both TERM and forced KILL; target/image/identity selection; API-denied retirement; PVC consumers with renamed volumes; multi-container and unavailable status; commented YAML mappings; readiness/liveness separation; prerelease tag mapping; and CLI validation before cluster calls.
  • OpenSSH ssh -G accepted generated configuration with a kubeconfig path containing spaces; separate contexts produced separate aliases/files.
  • GitHub CI passed on commit 892fe62: lint/type checking, Python 3.11–3.14, distribution, Helm, and the container build plus CLI runtime check. Release/publication jobs were skipped as expected for a PR.
  • No live cluster changes. Docker/Podman is unavailable locally; container validation above is GitHub CI evidence. Kubernetes rollout/probe behavior and an actual Remote-SSH connection still need live acceptance before marking this ready.

Remaining review concerns

  • restart --reinstall still synchronizes the environment used by the running child before restarting it. A failed or slow sync can leave a partially changed runtime. Fixing this properly needs a staged-environment design and live probe-budget validation; this draft does not claim atomic reinstall.
  • The legacy make-claude-sa.sh --podbench tier interface still describes removed iterate/resize modes, and its hotfix tier lacks PVC deletion. The helper needs a separate permission-model cleanup; this draft deliberately does not broaden or rewrite provisioned access.
  • Helm editing remains deliberately limited to the supported block-style chart layouts. This is not a general YAML editor or a transactional deployment mechanism.

Summary by CodeRabbit

  • New Features

    • Attach workflows now validate SSH identities and show a fallback Kubernetes command when SSH capabilities are unavailable.
    • Kubernetes connection settings are preserved for more reliable IDE reconnections.
    • Hotfix status and seat handling now support multiple hotfix containers and better target matching.
    • Prerelease versions receive consistent image tags.
  • Bug Fixes

    • Improved hotfix initialization safety, restart validation, health checks, and status error reporting.
    • YAML mappings with inline comments are handled correctly.
  • Documentation

    • Expanded guidance for connecting, debugging, port forwarding, hotfix recovery, and command-line usage.

@coderabbitai

coderabbitai Bot commented Sep 12, 2026 •

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: d078b293-1bc0-41bd-a497-d2ae528ee6bf

📥 Commits

Reviewing files that changed from the base of the PR and between 80caf06 and 892fe62.

📒 Files selected for processing (15)
  • .github/workflows/_container.yml
  • .github/workflows/ci.yml
  • Dockerfile
  • README.md
  • k8s/vpn-api-tunnel.sh
  • src/podbench/attach_cli.py
  • src/podbench/hotfix.py
  • src/podbench/hotfix_blueapi.py
  • src/podbench/hotfix_enable.py
  • src/podbench/hotfix_runtime.py
  • src/podbench/hotfix_status.py
  • src/podbench/launcher.py
  • src/podbench/model.py
  • src/podbench/ssh_transport.py
  • src/podbench/status.py

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The changes update main-branch image publishing, attach connection handling, hotfix initialization and probing, multi-container status reporting, and related documentation.

Changes

Attach and hotfix workflow

Layer / File(s) Summary
Image publishing and runtime image setup
.github/workflows/*, Dockerfile, src/podbench/model.py
Container publishing now targets main. The image removes debugpy installation, updates git exclusions, and formats prerelease image tags.
Attach matching and SSH transport
README.md, k8s/vpn-api-tunnel.sh, src/podbench/attach_cli.py, src/podbench/launcher.py, src/podbench/ssh_transport.py
Attach validates SSH identities, matches seats by target and image, resolves Kubernetes context and kubeconfig paths, and creates connection-specific SSH configuration.
Hotfix probes and runtime safety
README.md, src/podbench/hotfix.py, src/podbench/hotfix_blueapi.py, src/podbench/hotfix_enable.py, src/podbench/hotfix_runtime.py
Probes apply hold handling by probe type. Restart validates deadlines and target containers. Initialization preserves existing claim contents and clones through a temporary directory.
Multi-container status and retirement
src/podbench/hotfix_status.py, src/podbench/status.py
Status and retirement now support multiple hotfix containers, combined state probes, PVC volume lookup, and ignore-not-found Kubernetes queries.

Priority: ➖ Normal

Estimated code review effort: 4 (Complex) | ~45 minutes

Change: Bug fix

Sequence Diagram(s)

sequenceDiagram
  participant attach_command
  participant read_public_key
  participant running_seat
  participant wire_ssh
  participant kubectl
  attach_command->>read_public_key: Validate SSH identity
  attach_command->>running_seat: Find matching seat
  attach_command->>wire_ssh: Build SSH configuration
  wire_ssh->>kubectl: Resolve Kubernetes context
  wire_ssh->>attach_command: Return connection-specific proxy settings
Loading

Merge Risk: ⚪ Minimal · up to 892fe

No actionable merge-blocking risk remains in the reviewed changes.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 12.50% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 24 functions across 11 files. (4 skipped:… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main purpose of the changes: improving attach and hotfix reliability and usability after issue #238.
Full details: Docstring Coverage

Explanation

Docstring coverage is 12.50% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 24 functions across 11 files. (4 skipped: 4 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/238-usability

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

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