Skip to content

Cover IDE reconnect and resource resize regressions - #275

Merged
gilesknap merged 3 commits into
mainfrom
ide-regressions
Sep 15, 2026
Merged

gilesknap merged 3 commits into
mainfrom
ide-regressions

Conversation

@gilesknap

@gilesknap gilesknap commented Sep 15, 2026 •

Copy link
Copy Markdown
Member

Summary

Add 42 regression cases across the two agreed areas, reusing the ownership coverage from #274:

  • IDE sessions: fresh process resolution on reconnect, ambiguous or missing targets, process snapshots, listener reuse, acquisition/injection failure cleanup, release retries, and replacement during Python/native preparation.
  • Resource headroom: reconnect idempotence, unlimited budgets, Guaranteed and Burstable budgets, sidecar preservation, LimitRange ratios and API rejection, pending allocation, infeasibility, timeout, and concurrent pod changes.

The tests exposed three races, fixed with nine net production lines:

  • Reject a replacement pod before issuing its resize patch.
  • Reject a changed pod specification rather than overwrite a concurrent resource increase.
  • Check process identity across preparation rather than record a replaced process as ready for Attach.

Live acceptance on P47 (#277) found two more defects, fixed in the last two commits:

  • 0430274: re-Attach to a Python process that was already debugged now fails immediately with debugpy is already loaded in PID N from an earlier session; run podbench restart to attach again. debugpy can listen only once per process and its adapter exits on Disconnect, so this previously failed after a 5 s wait with debugpy did not open its listener.
  • 6c9a40a: generated native launchers set targetArchitecture (x64/arm64) from the target executable's ELF header. Without it cppdbg refused to start with (Parameter 'arch'), visible only in a hidden native dialog.

No broader refactor or feature removal.

Verification

  • Full suite: 114 tests passed on Python 3.11; each new test fails without its fix.
  • Ruff lint and formatting passed.
  • Pyright: zero errors or warnings.
  • Commit hooks and diff whitespace checks passed.
  • Coverage: IDE preparation 90%, process handling 91%, resource resizing 93%.
  • Kubernetes API interactions use a stateful test double.
  • Live acceptance on P47 with headless VS Code, recorded in Record focused live acceptance for recent lifecycle and IDE changes #277: Python IDE Attach, CLI Python injection and restart + reconnect passed on 4500a7c; native IDE Attach and reconnect (including the new fail-fast message) passed on 6c9a40a; headroom reserved once and not increased on reconnect.

Summary by CodeRabbit

  • Bug Fixes
    • Attach preparation now detects when the target process changes during setup and asks you to retry instead of recording an invalid session.
    • Resource resizing now verifies that the pod is unchanged before applying updates, preventing stale or unsafe changes.
    • Reconnecting to an existing injection now validates the listener identity and rejects conflicting listeners without triggering supervisor actions.
    • Failed preparation and release operations now preserve state for safe retry.

@coderabbitai

coderabbitai Bot commented Sep 15, 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: 4e5b1748-817d-4076-a55b-f75ad67b4932

📥 Commits

Reviewing files that changed from the base of the PR and between 13d8cd0 and 4500a7c.

📒 Files selected for processing (5)
  • src/podbench/ide_prepare.py
  • src/podbench/ide_resources.py
  • tests/test_debug_holds.py
  • tests/test_ide_resources.py
  • tests/test_ide_sessions.py

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


📝 Walkthrough

Walkthrough

The preparation flow now verifies process stability before recording sessions. Resource reservation now verifies pod identity and specification before resizing. New tests cover session reconnects, process replacement, resource calculations, resize polling, and unsafe resize cases.

Changes

IDE session safety

Layer / File(s) Summary
Process identity and reconnect validation
src/podbench/ide_prepare.py, tests/test_debug_holds.py, tests/test_ide_sessions.py
Preparation captures one process marker, rechecks it after injection, and records stable session data. Tests cover listener matching, process replacement, hold cleanup, release retries, process resolution, and reconnect behavior.

Pod resource safety

Layer / File(s) Summary
Resource reservation validation
src/podbench/ide_resources.py, tests/test_ide_resources.py
Resource reservation rejects pod replacement or specification changes after baseline recording. Tests cover resource budgets, LimitRange ratios, resize conditions, allocation failures, resource-version handling, and unsafe resize cases.

Priority: ⬇️ Low

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

Change: Bug fix

Merge Risk: ⚪ Minimal · up to 4500a

The attach and resize paths now reject changed process or pod identities before committing unsafe state. No actionable merge risk remains.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 2.94% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 34 functions across 5 files. 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 changes: IDE reconnect coverage and resource resize regression fixes.
  • 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 ide-regressions

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

gilesknap and others added 2 commits September 15, 2026 13:54
debugpy.listen() runs once per process, and its adapter exits when the IDE
disconnects. A later Attach to the same process found no listener,
re-injected, and failed after a 5 s wait with "debugpy did not open its
listener" while debugpy printed a traceback on the application console.
Seen in the #277 live acceptance run on P47 fastcs.

Fail fast before GDB or holds when the recorded injection belongs to the
same process start, and tell the user to restart the application.

Co-Authored-By: Claude Opus 5 <[email protected]>
cppdbg cannot map GDB's "i386:x86-64" and refused to start the generated
native Attach with "Specified argument was out of the range of valid
values. (Parameter 'arch')", shown only in a native dialog while the Debug
Console reported exit code 42. Seen in the #277 live acceptance run on P47
simdet-01.

Read the ELF machine field of the target executable and set
targetArchitecture to x64 or arm64 when it is known.

Co-Authored-By: Claude Opus 5 <[email protected]>
@gilesknap
gilesknap merged commit 153cf1b 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.

1 participant