Repository navigation
refactor(process): own gdb and rizin debugger sessions in one registry - #10735
Merged
Merged
Conversation
The session map, start reservations, the shared in-flight stop, retained cleanup failures, cleanup retry and close-all move into OwnedDebuggerSessionRegistry. Each debugger keeps its protocol, detach and stop-reason policy and supplies only its seal and stop hooks.
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Contributor
[Low impact] The PR appears safe to merge; no actionable issues were found in the shared lifecycle extraction. SummaryMoves shared GDB and Rizin session bookkeeping into
Diagram%%{init: {'theme': 'neutral'}}%%
flowchart TD
G[GDB manager] --> R[OwnedDebuggerSessionRegistry]
Z[Rizin manager] --> R
R --> A[Reserve slots and own sessions]
R --> S[Seal session and share stop attempt]
S --> P[stopOwnedDebuggerProcess]
P --> C{Cleanup confirmed?}
C -->|No| K[Keep session and cleanup errors]
K -->|Retry| S
C -->|Yes| E[Resolve retained cleanup errors]
E --> D[Keep published ID or remove session]
Reviews (2) · Last reviewed commit: "refactor(process): own gdb and rizin deb..." · Reviewed by Greptile |
11 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
GDB and Rizin each kept their own copy of persistent debugger session bookkeeping: the session map, start reservations against the session cap, one shared in-flight stop per session, cleanup failures retained until a stop is confirmed, cleanup retry, and close-all. This moves that bookkeeping into one owner,
src/process/OwnedDebuggerSessionRegistry.ts, and both managers use it. Behavior is unchanged.Workstream W4 (lifecycle) of the structural cleanup plan; no linked issue.
Problem and expected behavior
The two managers had drifted copies of the same lifecycle rules (
stopAttempt,cleanupFailures,#sessionReservations, the retry loop and#retainCleanupFailure). A fix in one did not reach the other. One owner should hold these rules, and each debugger should keep only its protocol, detach and stop-reason policy.Change and scope
OwnedDebuggerSessionRegistry<Session>holds the map, reservations (reserve()returns an idempotent release),stop()(shared attempt; a thrown stop becomesincompletewith the debugger's prefix; a confirmed stop resolves every retained failure),retain/retainCleanupFailure,retryCleanupFailures(keepAddressable)andcloseAll().sealSession(GDBcleanupStarted, Rizinclosing), which runs on every stop request. Before, retry and close-all reached the stop through the manager's wrapper. Now the registry applies the seal itself, so the separate "seal every session" loops in bothcloseAll()methods are gone.stopAttempt,cleanupFailures, the reservation counter, the#stopProcessfield, the duplicated retry loop and#retainCleanupFailure.LldbCallTraceris a serialized one-shot tracer with one pending-cleanup owner, not a pool of addressable sessions. Moving it onto this registry would add an abstraction without removing complexity there.closeOwnedDebuggerSessionsstays inownedDebuggerSession.ts, where its boundary tests live. The registry delegates to it.Contribution scope: internal refactor within existing boundaries; not applicable.
Contract and boundary impact
OwnedDebuggerSessionRegistrynow owns persistent debugger session lifecycle bookkeeping. Consumers areGdbSessionManagerandRizinDebugSessionManager. The superseded per-manager copies were removed.gdbandrizin.Evidence and regression coverage
GDB_PROVIDER_IDENTITY.id(gnu.gdb) for retained failures failed 2 tests inGdbSessionManagerCoverage.test.ts, which shows the suites pin the retained-failure contract. It was restored togdb.Validation performed
npm run test:focused -- tests/boundary/providers/GdbSessionManagerCoverage.test.ts tests/boundary/providers/GdbSessionReviewRegressions.test.ts tests/boundary/providers/GdbSessionManagers.test.ts tests/boundary/providers/RizinDebugSessionReviewRegressions.test.ts tests/boundary/providers/RizinDebugSessionAdmission.test.ts tests/boundary/providers/RizinDebugSessionManagers.test.ts tests/boundary/process/ownedDebuggerSession.test.ts tests/boundary/providers/RizinDebugSessionCoverage.part{1..5}.test.ts tests/boundary/providers/RizinTtyCleanup.test.ts tests/boundary/providers/RizinDebugSessionInferiorStdin.test.ts tests/boundary/providers/GdbCommandQueue.test.ts tests/boundary/mcp/gdbCancellationMcp.test.ts tests/boundary/mcp/gdbCloseDisposition.test.ts tests/boundary/cli/gdbStartupCleanupCli.test.ts: 18 files, 403 passed, 10 skipped.npm run check:fast: passed.Compatibility, safety, and release
stopOwnedDebuggerProcess.Author readiness
Human owner:
Before merge
type(scope): outcome.