Repository navigation
fix(firmware): report a staging budget refusal as a resource constraint - #5962
XiaoBinGan wants to merge 5 commits into
Conversation
inventoryFirmwareOutput threw AnalysisOutputError when the caller-selected max_output_files or max_output_bytes staging budget was exceeded, so an MCP caller saw unreadable_output with doctor guidance for a deterministic allowance the caller can raise. Report both refusals as resource constraints that keep the observed reason, name the exceeded control in details.reported_limits, stay non-retryable, and explain how to raise that specific budget for a rerun.
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. |
[Medium impact] The PR appears safe to merge; no blocking issue remains. SummaryFirmware staging overruns now return
Reviews (5) · Last reviewed commit: "chore: integrate firmware staging-budget..." · Reviewed by Greptile |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e0a5874367
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 997a55297d
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
CassieFox23
left a comment
There was a problem hiding this comment.
TL;DR: Main still reports a staging-budget refusal as unreadable_output with rea doctor advice (issue #5846). This PR turns it into a resource constraint that names the budget and its supported maximum. CI is green on this head, and my open points are small.
Findings
Should fix
- The body does not keep the repo template as written. Please restore the template text. What changed:
- The "Follow the contribution scope" paragraph is gone. That drops the CONTRIBUTING.md link and the rules about new providers.
- In "Expected effects", this line is gone:
Unchecked items do not establish absence; leave uncertainties visible. - "(if applicable)" is gone from the "Target selection, authority..." label.
- The part in brackets after the "Generated metadata" label is gone. The template says CI builds the catalogs and
skills/, and to edit authored instructions in.agents/skills/reverse-engineer-anything/. - "Tests added or updated" now reads "Tests added". The change is that "Base reproduction or other evidence" is now "Base reproduction". "User-visible CLI/MCP output (if applicable)" lost its "(if applicable)".
- "Real Hopper/Ghidra, browser, or OS coverage" now reads "Real Unblob coverage".
- Two sections follow "Before merge". They are not in the template. One is
Maintainer blocker verification. The other isCurrent follow-up evidence. - All other headings and labels are present.
Worth a look
- The body lists the new error code under "Breaking changes or migration steps". It says "callers that matched
unreadable_outputfor a staging overrun now receiveresource_constraint". But the title isfix(firmware):with no!. docs/releasing.md says what a PR must do before it adds!. It must identify a previously valid call that fails or changes meaning. Is a changed errorcodefor the same refusal in that class? This is a question for the maintainers. I am not saying it is. - The tests call
inventoryFirmwareOutputdirectly. Issue #5846 was found through the MCPextract_firmwarecall. I read the two call sites.FirmwareProvider.tsline 495 is followed by acatchat line 573. ThatcatchcallsfirmwareFailure(the matchingtryis at line 344). AndfirmwareFailurereturns anyAnalysisErrorunchanged. The polling loop inFirmwareCommand.ts(line 246) ends in the same function. So I expect the new error to reach the caller, but no test pins that path. The body says as much ("no real Unblob or public CLI run is claimed"). One test throughfirmwareFixture, like the issue's reproduction, would cover it. - The body has a section called "Current follow-up evidence". It says "Merged main 82e4e03" and reports local checks on that tree. The branch has since moved. The head commit is 746a64c, by XiaoBinGan. It merges c106cf2. Then 82e4e03 is the second parent of an earlier merge, 98b6997 (git log, merges). CI on the head is green, so this is only a stale note, but the body's local-check numbers no longer describe the head tree.
- The body says "2 cases" under "Tests added" and "Four focused
FirmwareFilestests" under the follow-up. The file has four (two budget cases and anit.eachover both maximums). - Lines 190 to 195 of docs/firmware-analysis.md give the staging budgets. They say the budgets are polled and rechecked. They do not say what an overrun returns. One sentence naming
resource_constraintand the tworeported_limitskeys would help callers. The PR does not touch this file.
Looks good
- Main (ecd997e) still has the bug.
inventoryFirmwareOutputon main throwsAnalysisOutputErrorfor both budgets, at lines 335 and 359. - The fix is small: 3 files and 152 changed lines by the compare API (main...head), 100 of them tests.
- Both refusals now throw
AnalysisResourceConstraintErrorwithcapacity,reported_limitsandretryable: false(lines 357 to 369 and 390 to 402). - The remediation uses the schema's own maximums.
firmwareAnalysis.tslines 13 and 14 define them and the two.max()calls (lines 48 and 57) use them, so the limit and the advice can't drift apart. At the maximum it says to pick a smaller range instead of "raise it", and a test covers both maximums. - The bot findings on earlier heads are answered. Greptile left a note on advice above the schema ceiling (4336830317). Codex left one too (4336836324). A third note, from Codex (4342026078), is on memory versus capacity. I did not repeat them. The Codex summary comment says no unresolved findings on this head. An earlier head (e0a5874) was approved by hiteshnatha, with no comment.
- CI ran on this head and passed:
CI required,Portable tests, all eight test shards,Static checks,Docs GenerationandBuild package(run 39912714461). The other lanes (native, browser, web and the like) show as skipped. - No other open PR fixes #5846 (search on the number found only this one).
Not run
- No checkout, no build, no tests, no formatter.
- I did not run Unblob or send an
extract_firmwarecall. - I did not read the full
FirmwareCommand.tssupervisor loop. I read lines 236 to 262 and 335 to 400.
Thanks, XiaoBinGan, for the fix and for the maximum-budget wording. Thanks, coygeek, for the clear report in #5846.
Test setup
🤖 Written with Claude Code (Sonnet 5.5, verified by Opus 5.5), posted with my OK 🦊
|
Closing as superseded — the classification this PR carries is now on
One real gap survives, and I have moved it to a focused PR instead of keeping this branch: at the schema ceiling the remediation still says "Increase max_output_files within its schema maximum", which is not an available recovery. That is the only delta left, it is small, and it belongs in its own change rather than inside a stale 900-commit-behind branch. Thanks @CassieFox23 for the detailed review — every body-template point was correct, and the "Worth a look" notes about the ceiling wording and the missing |
Summary
inventoryFirmwareOutputrefused an extraction that exceeded the caller-selectedmax_output_filesormax_output_bytesstaging budget withAnalysisOutputError, so an MCP caller receivedunreadable_output,category: "execution_failure"andrea doctorremediation for a deterministic allowance the caller can raise.Fixes #5846
Problem and expected behavior
extract_firmwarewithmax_output_files: 1over the repository's synthetic Unblob producer, which stagesrootfs/config(one directory and one regular file). The inventory counted two entries and threwInvalid analysis output for extract_firmware: Staging entry budget exceeded (1), projected asunreadable_outputwith doctor guidance.details.reasonkeeps the observed text.Change and scope
src/firmware/FirmwareFiles.ts: both staging overruns now throwAnalysisResourceConstraintError(entries:capacity, bytes:memory) withreported_limits.max_output_files/reported_limits.max_output_bytes,retryable: false, and a remediation that names the control, its supported maximum and the absent-destination retry.src/firmware/FirmwareFiles.test.ts(new): covers both refusals and their projection, including the remediation text.FirmwareCommanddeadline path or to publication.Contract and boundary impact
resource_constraintwithreported_limitsinstead ofunreadable_output; the input schema is unchanged.Expected effects (check known effects; use documentation-only on its own).
Evidence and regression coverage
src/firmware/FirmwareFiles.test.ts(2 cases).Expected a resource constraint, received Error: Invalid analysis output for extract_firmware: Staging entry budget exceeded (1)and the byte equivalent; after the change they pass and projectcode: "resource_constraint"withdetails.reported_limitsand the budget-specific remediation.max_output_files/max_output_bytesand the supported maximum instead of recommendingrea doctor.For evidence-bearing changes:
Validation performed
npx vitest run src/firmware tests/boundary/firmware- 46 passed, 40 skipped.npm run format:check- all matched files use the correct format.npm run verify:test-discovery- all 1903 test files discovered exactly once.npm run typecheck- no diagnostic in the changed files (the remaining errors in this checkout are pre-existing protobuf-module resolution failures).npm run lint- 0 errors, module boundaries checked.Compatibility, safety, and release
unreadable_outputfor a staging overrun now receiveresource_constraint; both keep the same reason text.Author readiness
Human owner: @XiaoBinGan
Before merge
type(scope): outcome.Maintainer blocker verification
Both staging refusals use schema-owned maxima and one remediation owner: below the cap callers may increase the selected budget up to the supported maximum; at the cap the message recommends a smaller firmware range/image and a fresh absent output destination. It no longer recommends an impossible increase above the schema ceiling.
Regular-file sizes measure retained staging capacity, not observed process memory. The byte-budget refusal therefore reports
capacity, matching entry-budget refusal, with non-retryability and the actual configured limit. Four focusedFirmwareFilestests andnpm run check:fastpassed on Node 24.18.0/npm 11.16.0, including serialized resource classification and cap-specific recovery guidance. No real Unblob extraction or public CLI was executed in this pass.Current follow-up evidence
Merged main
82e4e032to resolve the actual firmware contract conflict, retaining main's staging semantics and the schema-owned capacity/remediation fix. The combined tree passed 4FirmwareFilestests, 11 report-file boundary tests andcheck:fast; the 36 firmware integration cases were skipped by host configuration. No real extraction/provider result is claimed. The fork push was a verified fast-forward; this update establishes local combined-tree checks, not completed hosted CI.