Repository navigation
feat(debugger): share GDB and Rizin session caps as REA_ settings - #8056
Conversation
Move the duplicated deadline guidance into the owned debugger helper and replace the shared session, queue, output, and 120s command caps with launch settings that name their value, source, and range.
|
@gensokyo-dev @dandgabr Shared GDB and Rizin deadline guidance and session caps are now one helper. The four launch settings are declared once in |
Codex Review SummaryThis 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. |
The retained-output limitation now names REA_DEBUGGER_MAX_COMMAND_OUTPUT_BYTES instead of the old fixed-cap sentence.
A truncated GDB exit now carries the command-output setting, value, and source on the cleanup error. The coverage test reads those fields.
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
[Medium impact] The PR appears safe to merge; no new blocking issue was found. SummaryShares four launch-only debugger settings and their recovery facts across GDB and Rizin. Defaults and fixed startup deadlines stay unchanged.
Diagram%%{init: {'theme': 'neutral'}}%%
flowchart TD
E["Four debugger launch settings"] --> P["debuggerSessionLimits"]
B["analysisResourceLimits: defaults and bounds"] --> P
P --> V["environment: startup checks"]
P --> G["GDB limits"]
P --> R["Rizin limits"]
G --> H["ownedDebuggerSession: error facts and recovery"]
R --> H
C["Separate fixed control-reply budget"] --> G
C --> R
Reviews (3) · Last reviewed commit: "test(debugger): throw typed Result error..." · Reviewed by Greptile |
…budgets Point the session-cap mutation target at DEFAULT_DEBUGGER_MAX_SESSIONS. Give startup and cleanup replies a fixed 16 MiB budget so a small caller output cap cannot truncate them. Lower the command-output maximum so escaped Evidence JSON stays under Node's string ceiling, and keep GDB startup timeout diagnostics when the error is rebuilt.
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
Success cases no longer assert ok and return. They throw the typed error first, then check session, deadline, and close fields.
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
Summary
GDB and Rizin each carried a copy of
fixedDeadlineGuidanceand the same session, queue, command-output, and 120s command caps. Those caps are now one helper and four launch settings. Unset values keep today's limits. An invalid value is a configuration error. A limit refusal names the setting, the effective value, whether it came from the default or the setting, the allowed range, and that REA must be restarted.Problem and expected behavior
The two debugger managers repeated the same deadline sentence and the same hardcoded caps (
8sessions,16pending commands,16 MiBof command output,120000ms). Operators could not raise a cap, and the refusal said the release had no runtime override.Unset settings still admit 8 sessions, 16 pending commands, 16 MiB of command output, and a 120000 ms command deadline.
REA_DEBUGGER_COMMAND_DEADLINE_MSis 1..2147483647 ms.REA_DEBUGGER_MAX_SESSIONSis 1..64.REA_DEBUGGER_MAX_PENDING_COMMANDSis 1..256.REA_DEBUGGER_MAX_COMMAND_OUTPUT_BYTESis 1..89303718 bytes. A value outside that range fails configuration and does not fall back. GDB's 10s startup timeout and Rizin's 30s startup timeout stay fixed. GDB startup and detach MI, and Rizin cleanup readback, use a separate 16 MiB control-reply budget that the caller output cap does not lower.Change and scope
src/config/debuggerSessionLimits.tsis the only declaration of each setting name, schema, and recovery facts. Numeric bounds live insrc/domain/analysisResourceLimits.ts. Startup validation spreads that schema intoenvironment.ts. The settings are not also listed inanalysisSettings.tsoranalysisSettingDefinitions.ts: those catalogs are the runtimeupdate_analysis_settingssurface, whose unit union has no session or command count and whoserea_restart_requiredflag is false. These caps apply to the next REA process.fixedDeadlineGuidancefor the fixed startup deadlines, and the configurable command-deadline and capacity errors, live insrc/process/ownedDebuggerSession.ts. GDB and Rizin call that helper. Rebuilding a GDB startup timeout keeps the command-deadline diagnostics. A truncated GDB command that exits before cleanup finishes puts the command-output setting, effective value, and source on the error diagnostics. The reverse-tools mutation target for the session default now points atDEFAULT_DEBUGGER_MAX_SESSIONSinanalysisResourceLimits.ts. Provider code stays in the debugger managers.Follow the contribution scope.
Unresolved scope, authority, side effects, or required verification block
integration. Link the required maintainer scope decision for new providers or
capabilities involving target execution, injection, mutation, or protection
recovery; ordinary fixes within existing boundaries may state "not applicable".
Draft PRs may leave the scope decision pending and the readiness and merge checklists
unchecked. Maintainers can help resolve open questions.
Contract and boundary impact
debuggerSessionLimits.tsparses the four launch settings. GDB and Rizin session managers consume that result when they admit a session, queue a command, retain caller command output, or arm a command deadline. Control replies use the fixed 16 MiB budget owned next to those limits. The duplicated local helpers are gone. Startup deadlines stay owned by each manager.resource_constraintorprovider_timeout.reported_limitsanddiagnosticsnow includesetting,effective_value,source,minimum,maximum,unit, andrestart_required. Existingmax_sessionsandmax_pending_commandsfields remain. A truncated GDB exit whose cleanup is incomplete usescleanup_incompleteand the same command-output diagnostics.JSON.stringifyof that text, including a 6-code-unit escape of every character, plus a 1 MiB document reserve, fits Node's 536870888 code-unit string ceiling. Identity and partial output are unchanged.docs/public/product-catalog.json), package, or installation impact (CI generates and validates ignored catalogs andskills/; edit authored instructions in.agents/skills/reverse-engineer-anything/and never commit build outputs): none. These settings are not runtime analysis-settings catalog entries.Expected effects (check known effects; use documentation-only on its own).
Unchecked items do not establish absence; leave uncertainties visible.
Evidence and regression coverage
src/config/debuggerSessionLimits.test.tsassertsconfiguration_invalidandresource_constraintwithsetting,effective_value,source, and bounds. SuccessfulResults throw the typed error before the value is read; unexpected acceptance throws instead of returning. Two Rizin managers both useREA_DEBUGGER_MAX_SESSIONS=1; the second manager failsinvalid_requeston the missing terminal while the first manager's second start isresource_constraint. The command-output maximum test locks the 6-code-unit JSON escape and the string-ceiling formula. GDB startup timeout coverage asserts deadline diagnostics, includingcodeprovider_timeout. A small caller output cap still accepts GDB TTY readback and Rizin cleanup readback; a control-reply budget of 80 bytes still rejects a truncated TTY readback. Rizin timeout evidence compares the limitation to the shared helper and assertssetting,value, andsourceon the deadline object.fixedDeadlineGuidancebody and the same 8 / 16 / 16 MiB / 120000 ms constants in both managers. CI run 40945050799 failedGdbSessionManagerCoverage.test.tsbecause it still expected the old "16777216 byte or 16384 record cap" sentence. CI run 40946716842 failedstryker.config.mjsimport becauseDEFAULT_MAX_SESSIONShad moved, and Test shard 2/8 failedmutationWorkflow.test.tson that same import. That run's darwin arm64verify:packagefailure is separate: the packaged update exited 0 withstatus: updated, then cleanup failed closed because pid 8059 still hadmalformed_procargs. Greptile on473bba043scored 4/5 with no open threads because success tests still assertedokand could return before the typed error.REA_DEBUGGER_MAX_SESSIONS,REA_DEBUGGER_MAX_PENDING_COMMANDS,REA_DEBUGGER_MAX_COMMAND_OUTPUT_BYTES, orREA_DEBUGGER_COMMAND_DEADLINE_MS, the effective value,sourcedefaultorsetting, the floor and maximum, and says to set the variable and restart REA.malformed_procargscleanup was not reproduced on Linux and is not changed here. Other pre-existing Rizin coverage tests in the same files still return when startup fails; this change did not edit those tests.For boundary fixes, identify the applicable boundary regressions
and lifecycle regressions
covered by the evidence above, and explain relevant gaps.
The admission boundary is covered: invalid settings fail closed, the default preserves the old cap, and a second manager does not inherit the first manager's reservation. Lifecycle cleanup of an owned debugger process was not changed; a Rizin cleanup readback larger than the caller cap still completes, and the truncated-exit case still records
cleanup_incomplete. The held Rizin start in the isolation test is settled infinally.For evidence-bearing changes:
Validation performed
npm run format:check— passed.npm run check:fast— passed (typecheck and lint).npm run test:focused -- src/config/debuggerSessionLimits.test.ts tests/boundary/providers/GdbSessionManagerCoverage.test.ts tests/boundary/providers/RizinDebugSessionCoverage.part3.test.ts tests/boundary/providers/RizinTimeoutEvidence.test.ts— 227 passed.473bba043:npm run test:focused -- src/config/debuggerSessionLimits.test.ts tests/boundary/providers/GdbSessionManagerCoverage.test.ts tests/boundary/providers/RizinDebugSessionCoverage.part3.test.ts tests/boundary/filesystem/mutationWorkflow.test.ts— 228 passed.node scripts/prepare-reverse-tools-mutation.mjsthennpx --no-install stryker run stryker.config.mjs --dryRunOnly— initial run succeeded, 774 tests.npx --no-install stryker run stryker.semantics.config.mjs --dryRunOnly— initial run succeeded, 1 test. A first local attempt failed withEISDIRwhile copyingwebsite/.venv/lib64(a symlink to a directory). That path is local and was moved aside for the successful rerun. CI does not have it.Compatibility, safety, and release
reported_limits.settingandsource, ordiagnostics.settingandsourceon a timeout or truncated GDB exit, instead. A change takes effect on the next REA process.Author readiness
Human owner: @morluto
Before merge
type(scope): outcome.