Skip to content

podbench vscode actually debugs - #214

Merged
gilesknap merged 7 commits into
mainfrom
vscode/actually-debugs
Aug 24, 2026
Merged

gilesknap merged 7 commits into
mainfrom
vscode/actually-debugs

Conversation

@gilesknap

@gilesknap gilesknap commented Aug 24, 2026 •

Copy link
Copy Markdown
Member

Executes .claude/plans/vscode-actually-debugs.md, the successor to
hotfix-becomes-easy-to-drive.md — which ended by naming two field failures
rather than fixing them. Every claim below has a measurement behind it in
.claude/evidence/phase7-vscode-and-the-two-failures.md (the 2026-08-24 redo,
against a genuinely hotfixed bl47p-ea-fastcs-01-0 on p47).

Failure 2 — "debugging does not start" — is not one defect. On a hotfixed pod it
is a cascade with three independent links, each fatal on its own:

--provision writes to /opt/podbench-debugpy   <- root-owned; degraded seat is uid 37887
        |                                        EACCES
        v
no debugpy importable by the target
        |
        v
_configurations() returns []  ------------->  extensions_for([]) == []
        |                                        so the seat gets no debug adapter either
        v
[warn] no launch.json: nothing above could be turned into one
        |
        v                     ... and even when it can be turned into one:
merge refused: the app's committed .vscode/launch.json is JSONC
        |
        v                     ... and even when it is written:
adapter accepts TCP, never answers `initialize`

Slices

  • 1 — a fixed editor limit, because the current one ratchets. Fixes #166.
    Measured: two podbench vscode runs against one pod took its limit
    1Gi -> 2Gi, because the target was computed from live free memory and
    live free memory is what the editor is consuming. Replaced with a flat
    EDITOR_LIMIT of 6Gi; EDITOR_HEADROOM still decides whether, and
    --resize still wins. A pod already above it is never shrunk.

  • 4 — failure 1 is a message, and only a message. UNREACHABLE_CAUSES
    is reached only from the vscode verb, yet two of its four bullets told
    the reader to run podbench attach --new. Now names the flag, not another
    verb. No behaviour change; authorized_keys is still never mutated, for
    the reason the plan gives.

  • 2 — provision where the seat can actually write, and stop explaining
    the failure as if the seat were root. /opt is drwxr-xr-x root root and
    the degraded seat is uid 37887 with an empty effective set, so the install
    is refused by ordinary file permissions and the whole cascade follows. The
    destination is now chosen from the seat's own volumeMounts — the claim
    on a hotfixed pod, /opt otherwise — with no fallback in either
    direction, and the report names which was chosen. The EACCES message
    stops opening by ruling out file modes on the strength of a
    CAP_DAC_OVERRIDE the degraded seat does not hold.

  • 3 — merge into a real project's .vscode, which is JSONC — preserving
    the user's committed file rather than round-tripping it. New
    podbench.jsonc: parsing is for deciding, and every write is a textual
    edit of the spans podbench owns, so the user's comments, key order and
    formatting survive byte-for-byte. Members go in after the opening brace
    because appending has to put a comma after the last value, and where a
    // comment trails that line the comma lands inside the comment. No new
    dependency — typer is still the whole runtime list. extensions.json is
    included: the plan named the two merges it had measured, and the fourth
    committed file in that directory has the same defect for the same reason.

  • 5 — why does the adapter never answer initialize? Answered in two
    halves, kept apart. Measured: the redo's own §4 misread the mechanism.
    --for-server <n> is the debuggee's transient endpoints listener, bound
    by api.listen, handed to the adapter it spawns, and closed about a second
    later — not the adapter's server-facing port. Its absence from the socket
    table, and "three socket fds", were reproduced here on sessions that attach
    and enumerate threads, so neither is evidence of a wedge; and initialize
    is answered by the adapter locally out of a capability table, so it could
    never have been diagnostic of a missing debuggee. Driven through podbench's
    own --provision against a virgin pid, with no instrumentation and no
    hand-fixes, the whole chain works: pydevd is connected to adapter,
    initialize in 0.00s, attach in 4.00s, threads returning the app's
    four. Still not measured, and stated as such: why the redo's client got
    zero bytes — it did not reproduce in six attempts, four of them deliberate
    wedges, and the seat that saw it is gone (podbench-home is an
    emptyDir). Both candidates the plan named — hostNetwork's 127.0.0.1
    and the gdb-across-namespaces interpreter split — are ruled out by
    measurement rather than argument. Evidence:
    .claude/evidence/phase8-why-the-adapter-never-answers.md; the superseded
    section of the earlier file now carries a pointer at its head.

  • 5b — stop reporting success from an exit code. The success line was
    returned whenever the injector exited 0; measured, that exit code was 0,
    the port was open, and no session could start. inject_debugpy now asks
    the adapter the first question VS Code asks it and reports four distinct
    outcomes, of which only an answered initialize is success. It closes the
    socket without a DAP disconnect, because the adapter serves one client
    and disconnect_request calls stop_serving() — a polite goodbye would
    close the listener the probe exists to prove.

  • 6 — prove it on the live target, one seat, no hand-fixes. Five of six
    checks pass; the sixth is a bridge limitation, not a seat one.

    | check | verdict |
    |---|---|
    | `launch.json` exists, app's two configurations survive with comments | **pass** — diff purely additive, zero removed lines, four `//` comments and the trailing comma intact |
    | `ms-python.debugpy` in the seat | **pass** — 2026.6.0 |
    | `vsc.py debug` returns `started: true`, `dap.*` events follow | **half** — `started: true` measured; no `dap.*`, because the bridge's tracker runs in the laptop's extension host while this adapter runs in the seat's |
    | breakpoint in `controllers.py` binds and is hit | **pass** — stopped at `update_voltages:99` with the workload's real `controller`/`index`/`self`, continued, re-hit; also proves the `pathMappings` |
    | memory limit unchanged by a second identical run | **pass** — 6Gi after run 2 and run 3, no resize attempted on either |
    | `restartCount` still 0 on both app containers | **pass** — 0/0 throughout |
    
    **Phase 8's open thread is closed.** The seat's `ms-python.debugpy` log
    goes one line past where the redo's stopped — `Received 'debugpySockets'
    event` after `Connecting to DAP Server` — beside an ESTABLISHED pair on
    the port and a fourth socket fd on the adapter. And 5b's one unmeasured
    assumption is now measured: podbench probed the port and closed without a
    DAP `disconnect`, VS Code then attached to that same port and hit a
    breakpoint, so the probe does not burn the adapter.
    
    **The run was not clean, and is not reported as such.** The *first*
    `podbench vscode` resized the pod 256Mi→6Gi and then lost a 409 adding its
    own ephemeral container, landing no seat and saying nothing about the
    resize it had just made. An explained retry is still a retry, so run 1 is
    recorded as a fail. That is #136, reproduced on `vscode` — and the flat
    6Gi makes it *more* reachable, since the first run against any pod under
    6Gi now resizes. Evidence:
    `.claude/evidence/phase8-vscode-actually-debugs-on-p47.md`.
    

Deliberately not in scope

Mutating authorized_keys; retiring the p47 target; hotfix init's missing
--image/--pull passthrough (a real defect, but a hotfix one — now filed
as #215); Tier 1 GUI-free e2e (#212).

Raised while doing the work

🤖 Generated with Claude Code

https://claude.ai/code/session_01WAGABUogwWJ68k1Dh28ZBS

gilesknap and others added 2 commits August 24, 2026 09:25
`editor_limit` computed its target as the shortfall of EDITOR_HEADROOM
against *live* free memory, rounded up to the next GiB - and live free
memory is what the editor is consuming. Every reconnect therefore sized
the pod from the consequences of the last one: measured 2026-08-24, two
`podbench vscode` runs against one pod took it 1Gi -> 2Gi, and a third
would have gone again. `vscode` is the only verb that resizes a pod
nobody asked it to, which makes a non-idempotent target the worst place
for one.

EDITOR_LIMIT is a constant, so a second run is a no-op by construction,
and 6Gi is a number a reader can check against the 1215 MiB the editor
actually costs. EDITOR_HEADROOM is untouched: it still decides whether a
resize is needed at all and it is still what the warning quotes - only
the target stops being arithmetic. A current limit already at or above
the constant answers None rather than a reduction, so a generously sized
container is never shrunk to make room for an editor.

`--resize MEMORY` still wins; it is what makes a flat default defensible,
and it now has a test saying so. The three how-to and reference passages
that described the shortfall are corrected in the same commit, because a
docs build cannot catch prose that is merely no longer true.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WAGABUogwWJ68k1Dh28ZBS
UNREACHABLE_CAUSES is interpolated only into check_reachable's refusal,
which is reached only through open_seat from the vscode verb; attach
never prints it. Two of its four bullets nonetheless offered `podbench
attach --new`, including the one that fires in the field, so a reader
who had just run `podbench vscode` was told to go and run something
else.

`--new` is spelled the same on both verbs, so dropping the verb is
correct wherever this prints and costs nothing: naming the verb that was
actually run would mean threading the invoked name from the launcher
into a module-level constant for one word. The launcher's
_KEY_REMEDY_SEAT already reached the same wording from the same
constraint, and it is left alone.

This is the string and nothing else. An ephemeral container's
authorized_keys is immutable, so the last bullet is still describing the
only way the key can change, and podbench still does not try to mutate
it; the constant's new docstring records that so the next reader does
not take the bullet as a TODO.

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

coderabbitai Bot commented Aug 24, 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: 8f6329ca-8e41-46a9-8c9b-e1852b1c6fce

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.

PROVISION_DEST is /opt/podbench-debugpy, and on the beamline pod measured
on 2026-08-24 that directory is drwxr-xr-x root root while the degraded
seat is uid 37887 with an empty effective set. The install is refused by
ordinary file permissions, and everything downstream of it follows: no
importable debugpy, no configurations, no launch.json, and no debug
adapter installed into the seat either. Pointed at the claim instead,
every step succeeded.

So the destination is chosen from the pod before anything is written. The
claim is the right answer there and not a workaround: it is the same
inode at the same path in both mount namespaces, which is what
gdb-across-namespaces demands, it is writable without being root, and it
is a volume. It is chosen from the seat's own volumeMounts rather than
from is_hotfixed, for editor_folder's reason - a pod can carry the layout
while this seat carries no mount, and the property being relied on is
gone there. There is no fallback in either direction: a destination that
changed after a refusal turns a permissions bug into a mystery about
which path is live. The report names the one that was chosen, beside the
line that already names where the claim was mounted.

The refusal message stops assuming the seat is root as well. It opened by
ruling out the target's file modes on the strength of CAP_DAC_OVERRIDE
and sent the reader to PTRACE_MODE_READ and LSMs - correct on the full
rung, and on the degraded one it excluded the entire cause. The seat now
reads its own /proc/self/status and branches on it.

One caveat was half-false as a result and is reworded rather than left:
on a PVC the install survives a container restart while the injection
still does not.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WAGABUogwWJ68k1Dh28ZBS
gilesknap and others added 3 commits August 24, 2026 10:16
On a hotfixed pod `podbench vscode` opens the claim - the application's
own checkout - and a real project ships all four .vscode/*.json
committed. Measured 2026-08-24 on bl47p-ea-fastcs-01-0: both merges
refused, launch.json on the // comments VS Code's own scaffold writes and
settings.json on a trailing comma before }. Both files are valid JSONC.
That is the common case there, not an edge case, and it is fatal on its
own - no launch.json means no F5 however well everything upstream of it
works.

So read JSONC. The obvious follow-on - parse the dialect, then json.dumps
the result - would be a worse outcome than the refusal it replaces: these
are the user's committed files, and they would come back reformatted with
their comments gone. Parsing is therefore for deciding only, and every
write is a textual edit of the spans podbench owns. The bridge's shim
reached the same shape for the same reason.

New members go in after the opening brace rather than at the end, which
is not taste: appending has to put a comma after the last value, and
where a // comment trails that line the comma lands inside the comment
and the file stops parsing. Arrays are still appended to, because order
is meaning there, but the comma goes immediately after the last item's
value for the same reason.

extensions.json goes through it too. The plan named the two merges it had
measured; the fourth committed file in that directory has the same defect
for the same reason, and fixing three of four would have been arbitrary.

No new dependency - typer is still the whole runtime list, and the
scanner is ~200 lines against json.raw_decode for scalars, which is also
what keeps a // or a comma inside a string literal from ever being seen
as syntax. Text that is not JSONC either still raises, with json's own
wording, so the sentence a user is shown is unchanged.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WAGABUogwWJ68k1Dh28ZBS
`--provision`'s success line was returned whenever the injector subprocess
exited 0. Measured on 2026-08-24 against the hotfixed
bl47p-ea-fastcs-01-0, that exit code was 0, the port was open and in
LISTEN, and a debug session still could not start: the adapter accepted
the TCP connection and never answered `initialize` (15s, 0 bytes). So
podbench claimed a working debugger from evidence that does not support
one, and the redo's criticism tightens to "an open port is not proof
either".

inject_debugpy now finishes by asking the adapter the first question VS
Code asks it, over a loopback socket in the pod's own network namespace,
and reports what came back as four distinct sentences rather than one.
Only an answered `initialize` is a success line; an open port that says
nothing names the half that is established (the injection ran, the port
is open) and the half that is not (no session of any kind), which is the
state the live target was in.

The handshake closes its socket without sending a DAP `disconnect`: the
adapter serves one client, and disconnect_request calls stop_serving(),
which would close the listener this probe exists to prove. Bounded at
five seconds - the injection itself cost 8.7s and the wedged adapter
answered nothing in fifteen, so a longer bound only reproduces the hang.

Injected.ok stays the injector's verdict rather than the proof's, because
the caller re-probes for a listener on that basis and would otherwise
print "nothing is listening" over a port that genuinely is open - the
same class of untrue sentence this commit exists to remove.

The client is a new stdlib module, testable on its own against a loopback
server the suite owns, and reaches inject_debugpy through an injected
seam so no unit test opens a socket to anything it does not control. One
runtime dependency, and it is still the CLI.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WAGABUogwWJ68k1Dh28ZBS
Slice 5 of the plan, and the answer is in two halves that must not be
run together.

Named and measured: the redo's section 4 misread the mechanism.
`--for-server <n>` is the *debuggee's* transient endpoints listener -
debugpy's api.listen binds it, hands the port to the adapter it spawns,
accepts one connection carrying the endpoints, and closes it in the
finally about a second in. It is not the adapter's server-facing port. So
its absence from the socket table is the normal state of a healthy
adapter, and so is "three socket fds": client listener, server listener,
accepted server connection. Both observations were reproduced here on
sessions that attach and enumerate threads. `initialize` is also answered
by the adapter locally, out of a capability table, without consulting the
debuggee - so it could never have been diagnostic of a missing debuggee
half in the first place.

Driven through podbench's own --provision against a virgin pid, with no
instrumentation and no hand-fixes, the whole chain works: the target logs
`pydevd is connected to adapter at 127.0.0.1:41095`, `initialize`
answers in 0.00s, `attach` in 4.00s, and `threads` returns the
application's four.

Still not measured, and stated as such: why the redo's client got zero
bytes. It did not reproduce in six attempts, four of them deliberate
wedges. The evidence that would have settled it is gone - podbench-home
is an emptyDir, so that seat's vscode-server and extension-host log died
with the pod. Two candidates are recorded as candidates: the redo's own
hand-rolled client's framing, and the VS Code side alone, which this run
could not test because driving VS Code needs the GUI.

Both candidates the plan named are ruled out by measurement rather than
by argument: hostNetwork's 127.0.0.1 (the ESTABLISHED pair is in the
shared netns table) and the gdb-across-namespaces interpreter split (the
debugpy tree is the claim's, one inode on both sides, and the adapter is
spawned by the target's own interpreter).

The superseded section of the earlier file gets a pointer at its head, so
the next reader does not re-derive the inference this one falsifies.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WAGABUogwWJ68k1Dh28ZBS
Slice 6, and the plan's last one: one run, one seat, no hand-fixes. Five
of the six checks pass, and the sixth is a limitation of the bridge
rather than of the seat.

launch.json's diff against fastcs-example's committed file is purely
additive - zero removed lines, four `//` comments and the trailing comma
intact - which is slice 3's falsification condition stated as a property
and then measured. ms-python.debugpy 2026.6.0 is in the seat. A
breakpoint in controllers.py binds and is hit at update_voltages:99 with
the workload's own controller, index and self in scope, is continued, and
is hit again with fresh frame ids - which also proves the pathMappings.
The memory limit is 6Gi after the second run and 6Gi after the third,
with no resize attempted on either, which is slice 1's idempotence on a
real pod. restartCount is 0 on both application containers throughout.

The dap.* events are absent because the bridge's tracker runs in the
laptop's extension host while this adapter runs in the seat's. The
session itself is measured by every other check in that row.

Phase 8's open thread is closed. The seat's ms-python.debugpy log goes
one line past where the redo's stopped - `Received 'debugpySockets'
event` after `Connecting to DAP Server` - beside an ESTABLISHED pair on
the port and a fourth socket fd on the adapter. Slice 5b's one unmeasured
assumption is measured too: podbench probed the port and closed without a
DAP disconnect, and VS Code then attached to that same port and hit a
breakpoint, so the probe does not burn the adapter.

Two defects the run found are filed rather than fixed here, because both
are outside this plan. The first `vscode` resized the pod and then lost a
409 adding its own ephemeral container, landing no seat and saying
nothing about the resize it had just made - #136, reproduced on `vscode`
and made more reachable by the flat 6Gi, commented there. Re-provisioning
a pid that already serves debugpy exits 0, starts nothing, and rewrites
launch.json's live port with a dead one - #218, newly visible because
5b's handshake correctly printed the refusal a success line used to hide.
An explained retry is still a retry, so run 1 is recorded as a fail.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WAGABUogwWJ68k1Dh28ZBS
@gilesknap
gilesknap marked this pull request as ready for review August 24, 2026 10:05
@gilesknap
gilesknap merged commit 5b13581 into main Aug 24, 2026
30 checks passed
@gilesknap
gilesknap deleted the vscode/actually-debugs branch August 24, 2026 10:27
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