Skip to content

feat(debugger): share GDB and Rizin session caps as REA_ settings - #8056

Merged
morluto merged 5 commits into
mainfrom
cursor/debugger-session-limits-abce
Oct 29, 2026
Merged

morluto merged 5 commits into
mainfrom
cursor/debugger-session-limits-abce

Conversation

@morluto

@morluto morluto commented Oct 29, 2026 •

Copy link
Copy Markdown
Owner

Summary

GDB and Rizin each carried a copy of fixedDeadlineGuidance and 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 (8 sessions, 16 pending commands, 16 MiB of command output, 120000 ms). 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_MS is 1..2147483647 ms. REA_DEBUGGER_MAX_SESSIONS is 1..64. REA_DEBUGGER_MAX_PENDING_COMMANDS is 1..256. REA_DEBUGGER_MAX_COMMAND_OUTPUT_BYTES is 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.ts is the only declaration of each setting name, schema, and recovery facts. Numeric bounds live in src/domain/analysisResourceLimits.ts. Startup validation spreads that schema into environment.ts. The settings are not also listed in analysisSettings.ts or analysisSettingDefinitions.ts: those catalogs are the runtime update_analysis_settings surface, whose unit union has no session or command count and whose rea_restart_required flag is false. These caps apply to the next REA process.

fixedDeadlineGuidance for the fixed startup deadlines, and the configurable command-deadline and capacity errors, live in src/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 at DEFAULT_DEBUGGER_MAX_SESSIONS in analysisResourceLimits.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

  • Semantic owner and earliest changed stage: debuggerSessionLimits.ts parses 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.
  • Contribution scope fit and linked maintainer decision: not applicable. This configures existing debugger admission. It does not add a provider or a new execution, injection, mutation, or protection-recovery capability.
  • CLI and MCP/tool-catalog contract: no new tool. Limit refusals still use resource_constraint or provider_timeout. reported_limits and diagnostics now include setting, effective_value, source, minimum, maximum, unit, and restart_required. Existing max_sessions and max_pending_commands fields remain. A truncated GDB exit whose cleanup is incomplete uses cleanup_incomplete and the same command-output diagnostics.
  • Provider, bridge, target-format, or platform compatibility: GDB and Rizin only. Defaults match the previous constants.
  • Evidence, artifact, provenance, or reconstruction contract: command-timeout evidence limitations now include the setting recovery. The command-output maximum stays small enough that JSON.stringify of 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.
  • Target selection, authority, upstream behavior, and cleanup details (if applicable): unchanged. The caps bound sessions REA already starts. They do not attach, inject, or mutate a target by themselves. Cleanup readback is no longer truncated by the caller output cap.
  • Generated metadata (docs/public/product-catalog.json), package, or installation impact (CI generates and validates ignored catalogs and skills/; 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.

  • Read existing files or captured data.
  • Launch or attach to a process.
  • Inject instrumentation or run scripts/code.
  • Change process memory, registers, files, or configuration.
  • Contact network services.
  • Recover protected code or work around protections.
  • Documentation or usability only; no target interaction.
  • Not sure yet; investigation or maintainer guidance needed.

Evidence and regression coverage

  • Tests added or updated: src/config/debuggerSessionLimits.test.ts asserts configuration_invalid and resource_constraint with setting, effective_value, source, and bounds. Successful Results throw the typed error before the value is read; unexpected acceptance throws instead of returning. Two Rizin managers both use REA_DEBUGGER_MAX_SESSIONS=1; the second manager fails invalid_request on the missing terminal while the first manager's second start is resource_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, including code provider_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 asserts setting, value, and source on the deadline object.
  • Base reproduction or other evidence: source inspection showed the same fixedDeadlineGuidance body and the same 8 / 16 / 16 MiB / 120000 ms constants in both managers. CI run 40945050799 failed GdbSessionManagerCoverage.test.ts because it still expected the old "16777216 byte or 16384 record cap" sentence. CI run 40946716842 failed stryker.config.mjs import because DEFAULT_MAX_SESSIONS had moved, and Test shard 2/8 failed mutationWorkflow.test.ts on that same import. That run's darwin arm64 verify:package failure is separate: the packaged update exited 0 with status: updated, then cleanup failed closed because pid 8059 still had malformed_procargs. Greptile on 473bba043 scored 4/5 with no open threads because success tests still asserted ok and could return before the typed error.
  • User-visible CLI/MCP output (if applicable): a capacity or deadline refusal names REA_DEBUGGER_MAX_SESSIONS, REA_DEBUGGER_MAX_PENDING_COMMANDS, REA_DEBUGGER_MAX_COMMAND_OUTPUT_BYTES, or REA_DEBUGGER_COMMAND_DEADLINE_MS, the effective value, source default or setting, the floor and maximum, and says to set the variable and restart REA.
  • Remaining proof gaps: no real GDB or Rizin process was launched for this change. Setup registration does not yet forward the four variables into client configs; set them in the environment that starts REA. The 1 MiB hashing envelope is a reserve, not a measured size of every evidence document. The darwin malformed_procargs cleanup 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 in finally.

For evidence-bearing changes:

  • Observed, derived, and inferred claims remain distinguishable.
  • Artifact identity, source provenance, and failed attempts remain preserved.
  • Unsupported, incomplete, unavailable, or uncertain outcomes remain visible.

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.
  • Earlier on 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.mjs then npx --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 with EISDIR while copying website/.venv/lib64 (a symlink to a directory). That path is local and was moved aside for the successful rerun. CI does not have it.
  • Real GDB and Rizin were not installed for this change. The focused tests use injected processes. The darwin arm64 package job was not rerun locally.

Compatibility, safety, and release

  • Breaking changes or migration steps: none for callers that leave the variables unset. Defaults match the previous constants. The command-output maximum is 89303718 bytes so Evidence hashing can stringify it. Agents that matched the old "no runtime override" sentence should read reported_limits.setting and source, or diagnostics.setting and source on a timeout or truncated GDB exit, instead. A change takes effect on the next REA process.
  • Real Hopper/Ghidra, browser, or OS coverage: not applicable. Injected GDB and Rizin session tests ran on Linux. No real debugger binary was used.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: the session maximum is 64 debugger processes and the output maximum is 89303718 bytes. Both are policy ceilings. Raising them increases process and memory use of sessions the caller already chose to start. Control replies stay at 16 MiB. Invalid values are refused.

Author readiness

Human owner: @morluto

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

Before merge

  • This PR addresses a concrete problem or an agreed enhancement.
  • Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff.
  • The PR has one focused outcome and the title follows type(scope): outcome.
  • Related issue is linked, or the reason for not linking one is stated above.
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs, contracts, and generated metadata are updated where needed.
  • User-visible CLI/MCP changes include representative output.
  • I checked the final diff for secrets, unrelated cleanup, and unsupported claims.
Open in Web Open in Cursor 

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.
@cursor

cursor Bot commented Oct 29, 2026

Copy link
Copy Markdown

@gensokyo-dev @dandgabr Shared GDB and Rizin deadline guidance and session caps are now one helper. The four launch settings are declared once in src/config/debuggerSessionLimits.ts. Limit errors report the setting, effective value, source, and range.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-10-29T21:07:01.169275Z
We couldn’t complete this review. Comment @codex review to try again.
49f059e New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

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.
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@greptile-apps

greptile-apps Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5 Tier: apex

[Medium impact] The PR appears safe to merge; no new blocking issue was found.

Summary

Shares four launch-only debugger settings and their recovery facts across GDB and Rizin. Defaults and fixed startup deadlines stay unchanged.

  • REA launch settings control the shared debugger limits.
  • GDB and Rizin apply shared limits and explain refusals.

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
Loading

Reviews (3) · Last reviewed commit: "test(debugger): throw typed Result error..." · Reviewed by Greptile

Comment thread src/rizin/RizinDebugSessionManager.ts Resolved
Comment thread src/domain/analysisResourceLimits.ts Resolved
Comment thread src/gdb/GdbSessionManager.ts Resolved
…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.
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

Success cases no longer assert ok and return. They throw the typed
error first, then check session, deadline, and close fields.
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@morluto
morluto merged commit 4a8d8f7 into main Oct 29, 2026
82 of 84 checks passed
@morluto
morluto deleted the cursor/debugger-session-limits-abce branch October 29, 2026 21:41
@morluto morluto added area: native Native analysis and decompilation, including Ghidra, IDA, and Hopper analysis behavior enhancement New feature or request provider: gdb Analysis provider / engine: gdb provider: rizin Analysis provider / engine: rizin labels Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: native Native analysis and decompilation, including Ghidra, IDA, and Hopper analysis behavior enhancement New feature or request provider: gdb Analysis provider / engine: gdb provider: rizin Analysis provider / engine: rizin

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants