Skip to content

fix(firmware): stop recommending a raise at the staging budget ceiling - #6971

Merged
baron merged 1 commit into
morluto:mainfrom
XiaoBinGan:fix/firmware-staging-ceiling
Oct 24, 2026
Merged

baron merged 1 commit into
morluto:mainfrom
XiaoBinGan:fix/firmware-staging-ceiling

Conversation

@XiaoBinGan

Copy link
Copy Markdown
Contributor

Summary

The firmware staging-budget refusal told callers to raise max_output_bytes or max_output_files
"within its schema maximum". At the schema ceiling that recovery does not exist, so the one case
where the selected value cannot grow received advice that cannot be followed.

Part of the contract described in #5846, which already returns a nonretryable resource constraint
naming the selected limit. This change only corrects the recovery text at the ceiling and pins the
schema maxima to named constants.

Problem and expected behavior

Smallest trigger: extract_firmware with max_output_files at its schema maximum (100000) on a
staging tree that still exceeds it, or max_output_bytes at 536870912. Both refusals keep their
resource_constraint / capacity classification and reported_limits, but the remediation says
"Increase max_output_files within its schema maximum if the larger extraction is required" — and no
larger value is accepted.

Expected: below the ceiling the remediation names the remaining room and the control to change. At
the ceiling it states that a further raise is not supported and points at a smaller firmware byte
range, which is the recovery that actually exists.

Change and scope

  • src/domain/firmware/firmwareAnalysis.ts: the two schema maxima become MAX_FIRMWARE_STAGING_BYTES
    and MAX_FIRMWARE_STAGING_ENTRIES, and the schema's .max() calls use them, so the accepted range
    and the advice cannot drift apart.
  • src/firmware/FirmwareFiles.ts: firmwareStagingBudgetRemediation selects the below-ceiling or
    at-ceiling wording from the selected value; firmwareStagingLimit uses it.

Intentionally not included: the classification itself (resource_constraint, capacity,
reported_limits, retryable: false) is unchanged — it is already correct on the base revision. No
budget default, extraction behavior, Unblob invocation or deadline path changes.

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".

Not applicable — this is an ordinary fix inside the existing firmware admission boundary.

Contract and boundary impact

  • Semantic owner and earliest changed stage: firmware staging-budget enforcement in
    inventoryFirmwareOutput; the earliest changed stage is the refusal's remediation text, not the
    refusal.
  • Contribution scope fit and linked maintainer decision: ordinary fix within existing boundaries; not
    applicable.
  • CLI and MCP/tool-catalog contract: unchanged schemas, codes, categories and reported_limits. Only
    the remediation.action string for this refusal changes, which is the reported defect.
  • Provider, bridge, target-format, or platform compatibility: none; the same helper serves the
    provider path and the command deadline path.
  • Evidence, artifact, provenance, or reconstruction contract: no extraction output is published when
    a budget is exceeded, as before.
  • Target selection, authority, upstream behavior, and cleanup details (if applicable): unchanged; no
    extra process is launched and workspace cleanup keeps its existing path.
  • 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.

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/firmware/FirmwareStagingBudget.test.ts — a budget below its ceiling
    offers the room and the control, both budgets at their ceilings state that a further raise is not
    supported and point at a smaller range, and the selected value and ceiling are named in both cases.
  • Base reproduction or other evidence: on the base revision firmwareStagingBudgetRemediation does
    not exist and the single-form remediation says "Increase within its schema maximum" for
    every selected value. Verified red → green: restoring that single form makes all four new cases
    fail; the change makes them pass.
  • User-visible CLI/MCP output (if applicable): for extract_firmware at the entry ceiling the
    remediation.action now reads "The staging entry budget, which counts extracted directories and
    links, reached its supported maximum (max_output_files=100000; maximum 100000). Raising
    max_output_files further is not supported. Select a smaller firmware byte range or analyze a
    smaller image. analysis_timeout_ms does not raise this staging allowance." Below the ceiling it
    reads "…was exceeded (max_output_files=1; supported maximum 100000). Increase max_output_files up to
    100000 if the larger extraction is required, or select a materially narrower firmware byte range."
  • Remaining proof gaps: the remediation strings are covered by module tests, not by an end-to-end
    extract_firmware MCP call. The 39 firmware integration cases are skipped by host configuration on
    this machine, and no real Unblob extraction was run.

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

  • node node_modules/vitest/vitest.mjs run src/firmware tests/boundary/firmware --maxWorkers=1 — 81
    passed, 52 skipped (10 files; the skips are host-gated firmware integration and workspace recovery).
  • npx tsc --noEmit -p . — no errors.
  • npx oxfmt <changed files> — formatted.
  • npm run verify:module-boundaries — 2898 source files checked, no violations.
  • Red → green on src/firmware/FirmwareStagingBudget.test.ts: 4 failed with the previous single-form
    remediation, 4 passed with the change.

Compatibility, safety, and release

  • Breaking changes or migration steps: none. The failure classification and reported_limits are
    unchanged; only the recovery sentence changes, and only where the previous sentence recommended an
    unsupported value.
  • Real Hopper/Ghidra, browser, or OS coverage: no analysis engine involved.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: no target execution and no new data exposure.

Author readiness

Human owner: @XiaoBinGan

  • 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.

The staging refusal told callers to increase max_output_files or max_output_bytes within its schema maximum. At the schema ceiling that recovery does not exist, so the refusal was unactionable exactly where the least room remains.

firmwareStagingBudgetRemediation now branches on the selected value against the schema maximum: below the ceiling it names the room and the control, at the ceiling it states that a further raise is unsupported and points at a smaller firmware byte range. The schema maxima move into named constants so the advice and the accepted range cannot drift apart.

Verified with a module test for both budgets at the ceiling and one below it (red on the previous single-form remediation), plus the existing firmware suites.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 24, 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 ✅ Completed 2026-10-24T07:31:10.394107Z 4c89ef5 PR opened
ℹ️ 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.

@baron baron left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed commit 4c89ef5. No actionable correctness findings. The schema ceilings remain unchanged, remediation uses the same named constants, and both live and final inventory checks pass through the caller-selected budgets correctly.

Optional follow-up: exercise the error emitted by inventoryFirmwareOutput in a regression test, rather than only testing the wording helper, to protect the production wiring.

Validation scope: source review only. I did not run tests against the PR revision or perform a real Unblob extraction.

@baron
baron merged commit 2e86294 into morluto:main Oct 24, 2026
40 checks passed
@morluto morluto mentioned this pull request Oct 25, 2026
3 tasks done
XiaoBinGan added a commit to XiaoBinGan/rea that referenced this pull request Oct 26, 2026
The ceiling recovery added in morluto#6971 was covered through the wording helper only, so a wiring change that passed the schema ceiling where the selected value belongs, or that dropped the remediation, would have stayed green.

Adds boundary coverage that calls inventoryFirmwareOutput itself: a sparse file reaches the real byte ceiling without storing the bytes and asserts the projected refusal carries the ceiling recovery, and a one-byte tree below the ceiling asserts the raise advice. Verified red on both regressions — passing the schema ceiling for the selected value fails the below-ceiling case, and restoring the single-form remediation fails both.
XiaoBinGan added a commit to XiaoBinGan/rea that referenced this pull request Oct 26, 2026
The ceiling recovery added in morluto#6971 was covered through the wording helper only, so a wiring change that passed the schema ceiling where the selected value belongs, or that dropped the remediation, would have stayed green.

Adds boundary coverage that calls inventoryFirmwareOutput itself: a sparse file reaches the real byte ceiling without storing the bytes and asserts the projected refusal carries the ceiling recovery, and a one-byte tree below the ceiling asserts the raise advice. Verified red on both regressions — passing the schema ceiling for the selected value fails the below-ceiling case, and restoring the single-form remediation fails both.
XiaoBinGan added a commit to XiaoBinGan/rea that referenced this pull request Oct 27, 2026
The ceiling recovery added in morluto#6971 was covered through the wording helper only, so a wiring change that passed the schema ceiling where the selected value belongs, or that dropped the remediation, would have stayed green.

Adds boundary coverage that calls inventoryFirmwareOutput itself: a sparse file reaches the real byte ceiling without storing the bytes and asserts the projected refusal carries the ceiling recovery, and a one-byte tree below the ceiling asserts the raise advice. Verified red on both regressions — passing the schema ceiling for the selected value fails the below-ceiling case, and restoring the single-form remediation fails both.
XiaoBinGan added a commit to XiaoBinGan/rea that referenced this pull request Oct 27, 2026
The ceiling recovery added in morluto#6971 was covered through the wording helper only, so a wiring change that passed the schema ceiling where the selected value belongs, or that dropped the remediation, would have stayed green.

Adds boundary coverage that calls inventoryFirmwareOutput itself: a sparse file reaches the real byte ceiling without storing the bytes and asserts the projected refusal carries the ceiling recovery, and a one-byte tree below the ceiling asserts the raise advice. Verified red on both regressions — passing the schema ceiling for the selected value fails the below-ceiling case, and restoring the single-form remediation fails both.
XiaoBinGan added a commit to XiaoBinGan/rea that referenced this pull request Oct 27, 2026
The ceiling recovery added in morluto#6971 was covered through the wording helper only, so a wiring change that passed the schema ceiling where the selected value belongs, or that dropped the remediation, would have stayed green.

Adds boundary coverage that calls inventoryFirmwareOutput itself: a sparse file reaches the real byte ceiling without storing the bytes and asserts the projected refusal carries the ceiling recovery, and a one-byte tree below the ceiling asserts the raise advice. Verified red on both regressions — passing the schema ceiling for the selected value fails the below-ceiling case, and restoring the single-form remediation fails both.
XiaoBinGan added a commit to XiaoBinGan/rea that referenced this pull request Oct 28, 2026
The ceiling recovery added in morluto#6971 was covered through the wording helper only, so a wiring change that passed the schema ceiling where the selected value belongs, or that dropped the remediation, would have stayed green.

Adds boundary coverage that calls inventoryFirmwareOutput itself: a sparse file reaches the real byte ceiling without storing the bytes and asserts the projected refusal carries the ceiling recovery, and a one-byte tree below the ceiling asserts the raise advice. Verified red on both regressions — passing the schema ceiling for the selected value fails the below-ceiling case, and restoring the single-form remediation fails both.
XiaoBinGan added a commit to XiaoBinGan/rea that referenced this pull request Oct 28, 2026
The ceiling recovery added in morluto#6971 was covered through the wording helper only, so a wiring change that passed the schema ceiling where the selected value belongs, or that dropped the remediation, would have stayed green.

Adds boundary coverage that calls inventoryFirmwareOutput itself: a sparse file reaches the real byte ceiling without storing the bytes and asserts the projected refusal carries the ceiling recovery, and a one-byte tree below the ceiling asserts the raise advice. Verified red on both regressions — passing the schema ceiling for the selected value fails the below-ceiling case, and restoring the single-form remediation fails both.
morluto pushed a commit that referenced this pull request Oct 29, 2026
* test(firmware): exercise the staging ceiling through the emitted refusal

The ceiling recovery added in #6971 was covered through the wording helper only, so a wiring change that passed the schema ceiling where the selected value belongs, or that dropped the remediation, would have stayed green.

Adds boundary coverage that calls inventoryFirmwareOutput itself: a sparse file reaches the real byte ceiling without storing the bytes and asserts the projected refusal carries the ceiling recovery, and a one-byte tree below the ceiling asserts the raise advice. Verified red on both regressions — passing the schema ceiling for the selected value fails the below-ceiling case, and restoring the single-form remediation fails both.

* test(firmware): compare the emitted recovery with its owner

The wiring test matched three phrases of the emitted remediation, so an ad-hoc or truncated action that kept those phrases would still pass while the emitted recovery had diverged from firmwareStagingBudgetRemediation.

Assert exact equality with the owner's output for the selected value in both cases instead. Verified red: replacing the emitted action with a divergent sentence that keeps the ceiling phrases now fails both cases, where the phrase matching passed.

* chore: retrigger title and readiness checks after the title was corrected

* test(firmware): drive the staging ceiling through the request boundary

greptile and codex both flagged that the ceiling tests called
inventoryFirmwareOutput directly, so they would still pass if request parsing or
the provider wiring dropped or replaced max_output_bytes.

Add a request-level test that records the parsed request a provider receives:
the caller's max_output_bytes arrives unchanged at the schema ceiling and below
it, the documented default applies when omitted, and a budget above the schema
maximum is rejected before the provider runs. That is the wiring the previous
tests assumed rather than asserted.
@morluto morluto added bug Something isn't working area: native Native analysis and decompilation, including Ghidra, IDA, and Hopper analysis behavior labels Nov 23, 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 bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants