Skip to content

Session state: one transition table, one stop record and one deadline per session tree (tracking) #1362

Backlog

Description

@debugmcpdev

Why

A session's state is written from thirty places, and no table says which transitions exist: each transition is whatever its call site wrote. The same shape repeats around it. A stopped event is reshaped in several layers before an answer reads it. An ending is classified in many functions from whichever terminal event arrived first. Each wait that states a bound keeps its own timing.

Defects of these shapes have been fixed one site at a time, and each fix was careful, but the count of sites kept growing. This issue tracks the repair of the structure itself, in stages. Each stage is one pull request that changes one thing and says what can no longer happen after it.

Stages

Stage What it does What cannot happen after it Closes
Deadline One primitive for every wait that states a bound: its sleeps end at the deadline, its requests get the time that remains, and what is still in flight is abandoned at a fixed boundary An answer later than its stated bound plus a fixed grace; a timer left behind after an early return; a message naming a bound that was not kept #1339 (closed by #1365, which moved the first three); seventeen more loops are listed in a comment below, moved one layer per pull request
Shadow table The transition table as data; every state write names its event; a check runs beside today's code and records what the table says. Strict in the unit suite. No change in behaviour A transition the table does not list passing the unit suite none by itself
Read-only state state is readonly on a managed session, on the public session type and on the slices of a session that shipped code declares; the store writes it; tests set it through one helper. No change in behaviour An assignment to state, spelled on a managed session or the public type, compiling (ten forms are pinned by a compile-only file in the source type check). A cast, a write by key and a mutable alias still compile: #1368 lists them none by itself
Stop record One record per stop, with an id and a sequence number stamped where the event is received; an answer pins the stop it describes One answer mixing two stops; an older stop applied after a newer event #1348
Stop reducer One function decides a stop's reason, thread, anchor and whether it is shown A reason decided without knowing the operation in flight none by itself
Hidden stop The entry stop the server resumes unseen stops being a state anyone can read A transient pause visible to a reader none by itself
Endings The terminal events are kept as observations and one classifier decides what happened to the program A fate claimed without an observation; an exit code lost or replaced by the order of arrival #1350, #1306, parts of #1321 and #1262
Ending reservations An ending reserves its subtree before its first wait Overlapping endings that are not joined #1345
Admission One table decides, at dispatch, whether a call may start A control, breakpoint or evaluate call running under an ending none by itself
Waits Every wait is until(scope, select, deadline) over the machine's records A wait on raw events none by itself
Projections Each answer is a projection of the tree's records An answer field that no record carries #1329, part of #1278

The order is as listed, except that the deadline stage is independent of the others.

Found while this was being designed

Status

Each pull request of the series links here, says which stage it is and names the next one. This list is updated as they merge.

Activity

  1. added
    enhancement
    in-progress
    on Nov 28, 2026
  2. debugmcpdev commented on Nov 29, 2026

    @debugmcpdev
    CollaboratorAuthor

    Deadline: what is left after #1365

    #1365 moves three loops onto the primitive. The reviews of it listed what remains, each with the line it was read at (02be0549; the files are unchanged since).

    Seventeen loops that state a bound and check it between steps

    # Where The bound
    1 src/proxy/proxy-manager.ts:713 pending-request drain
    2 src/proxy/proxy-manager.ts:1176 worker start: five acknowledgement waits under the 30 s start timeout
    3 src/proxy/dap-proxy-connection-manager.ts:154 connect window; each connect() is unbounded
    4 src/proxy/child-session-manager.ts:808 60 s adoption deadline; the retry sleep can cross it
    5 src/proxy/minimal-dap.ts:465 active-child wait counts fixed sleeps
    6 src/proxy/minimal-dap.ts:486 child-target readiness counts fixed sleeps
    7 src/proxy/minimal-dap.ts:684 stack-trace child wait counts fixed sleeps
    8 src/proxy/js-stepper.ts:807 verdict ceiling, checked after a request with its own 5 s timeout
    9 src/proxy/js-stepper.ts:860 settle ceiling
    10 src/session/attach/attach-verification.ts:53 thread poll after attach, with a hand-made grace
    11 src/session/inspection/stop-anchor.ts:205 sibling scan budget (and it is handed a budget read before the thread list is fetched)
    12 src/session/execution/execution-controller.ts:1063 wait_for_stop: the landing read and the snapshot are outside the bound
    13 src/utils/proxy-orphan-reaper.ts:255 escalation cap counts requested sleeps
    14 packages/adapter-cobol/src/shim/runtime-message.ts:80 2 s message read
    15 packages/adapter-cobol/src/shim/shim-core.ts:244 connect deadline, checked on socket error
    16 src/proxy/cdp-function-breakpoint-bridge.ts:490 a two-step handoff that computes what is left by hand
    17 src/cli/commands/doctor/diagnose.ts:212 the toolchain probe hands what validate() left to the next step by hand

    Not searched: the Java bridge's own source, scripts/, tools/, tests/.

    Three places where an answer is accepted by a flag that only a timer writes (the defect #1365 fixed in the inspector wait; reproduced by the final review on unchanged code):

    • src/session/attach/attach-verification.ts:113, :135: a threads answer after the grace can win before the timer fires (accepted at 400 ms for a 100 + 250 ms bound).
    • src/proxy/minimal-dap.ts:962: the child mirror accepts while the timer-written flag is still false (accepted at 4,000 ms for a 3,000 ms bound).
    • src/proxy/throwaway-release.ts:64: the handshake continues after a late connect (at 400 ms for a 100 ms bound).

    For the next change to the primitive itself (two notes from the final review, neither on a path shipped code takes): say in the header that a value's resolution is delivered after aborts queued in the same entry, so an abort listener's reaction can run before the answer's; and extend the sentence about a throwing then to a throwing constructor getter.

    Also open: the no-answer message under a deadline does not carry the recovery instructions the ordinary timeout message has. No caller shows it to a user today; it needs them before one does.

  3. debugmcpdev commented on Nov 29, 2026

    @debugmcpdev
    CollaboratorAuthor

    Two more for the list of remaining loops, from the second cross-family review of #1371 (the Python logpoint check). The checker's process manager (src/session/log-message-checkers.ts) carries a hand-made time helper (bounded), and two decisions in it read a flag that only a timer's callback writes:

    • this.gone, read through failure. For a checker that hangs without exiting, only the request timer's callback sets it. A set_breakpoint that arrives after that checker's time is up on the clock but before the callback has run is (a) given the warm 2 s budget instead of the 5 s one for a start (budgetFor), and (b) queued on the process that is about to be failed instead of on the run's replacement (processFor); it then answers unchecked. A late answer from the slow process in the same window is accepted instead of the process being ended.
    • expired || in CheckerProcess.ask. The turn asks the clock first (added in that change) and keeps the flag so that a question whose caller has already been answered is never sent if the wall clock steps back. It reads Date.now(); on the deadline's clock the flag is not needed.

    What a caller sees today is bounded and true (unchecked, within the stated time), so #1371 did not change it. Both go away when the checker's waits move onto deadline().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementin-progress

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions