Repository navigation
Description
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
- session state can disagree with the engine: paused after a resume that did happen, a stop overtaken in the worker, and an exit code that depends on event order #1361: three live defects the design's own runs reproduced (a session that says paused after a resume that did happen; a stop overtaken in the worker's thread backfill; an exit code that depends on the order of terminal events).
- session tree: an attached child's first pause is resumed as if it were a launch's entry stop, and a wait on a root says no breakpoint is armed when its child has one #1357: an attached child's first pause is resumed unseen.
- refactor(session): a session's state is read-only in the types #1368 measured what
readonlyleaves open: a cast, a write by key, and a mutable alias, which needs no cast. More scanning of names does not close these. The candidate remedy is at run time: the gate knows the state it last wrote, so it can report a state that changed without it. To be designed with the stage that removes the rollback exception.
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.
- Deadline, first three loops (feat(shared): one deadline for every wait that states a bound, and the first three loops on it #1365)
- Deadline: a request timeout carries a class across the worker's IPC, so that nothing classifies a timeout by its wording
- Deadline, the remaining loops
- Shadow table (feat(session): the transition table as data, checked in shadow mode beside the state gate #1363)
- Read-only state (refactor(session): a session's state is read-only in the types #1368)
- Stop record
- Stop reducer
- Hidden stop
- Endings
- Ending reservations
- Admission
- Waits
- Projections
Activity
feat(session): the transition table as data, checked in shadow mode b…
ci: reduce the structure guard to tools that are authorities
ci: the comment policy is enforced where no comment can switch it off…
ci: guard the adapter contract with a ratchet and language branches w…
refactor(session): a session's state is read-only in the types (#1368)
feat(shared): one deadline for every wait that states a bound, and th…
debugmcpdev commentedon Nov 29, 2026
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
src/proxy/proxy-manager.ts:713src/proxy/proxy-manager.ts:1176src/proxy/dap-proxy-connection-manager.ts:154connect()is unboundedsrc/proxy/child-session-manager.ts:808src/proxy/minimal-dap.ts:465src/proxy/minimal-dap.ts:486src/proxy/minimal-dap.ts:684src/proxy/js-stepper.ts:807src/proxy/js-stepper.ts:860src/session/attach/attach-verification.ts:53src/session/inspection/stop-anchor.ts:205src/session/execution/execution-controller.ts:1063wait_for_stop: the landing read and the snapshot are outside the boundsrc/utils/proxy-orphan-reaper.ts:255packages/adapter-cobol/src/shim/runtime-message.ts:80packages/adapter-cobol/src/shim/shim-core.ts:244src/proxy/cdp-function-breakpoint-bridge.ts:490src/cli/commands/doctor/diagnose.ts:212validate()left to the next step by handNot 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: athreadsanswer 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
thento a throwingconstructorgetter.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.
debugmcpdev commentedon Nov 29, 2026
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 throughfailure. For a checker that hangs without exiting, only the request timer's callback sets it. Aset_breakpointthat 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 answersunchecked. A late answer from the slow process in the same window is accepted instead of the process being ended.expired ||inCheckerProcess.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 readsDate.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 ontodeadline().