Skip to content

fix(native)!: report details.limit for native reader per-call budgets - #14622

Merged
morluto merged 4 commits into
mainfrom
fix/native-reader-parameter-limits
Nov 26, 2026
Merged

morluto merged 4 commits into
mainfrom
fix/native-reader-parameter-limits

Conversation

@morluto

@morluto morluto commented Nov 26, 2026 •

Copy link
Copy Markdown
Owner

Summary

Part of #14234 and #14235. Several native-reader refusals of budgets a caller can already change per call named that control only in remediationAction prose. They now report details.limit (control_kind: "parameter", the field, effective value, range, default, applies_at: "next_call"). One fixed allowance, the devicetree decoded-representation estimate, becomes a per-call control.

Behavior change

  • New shared domain helper src/domain/parameterBudget.ts: one ParameterBudget object (minimum, maximum, default, unit) builds both the zod schema (parameterBudgetSchema) and the refusal's AnalysisParameterLimit (parameterBudgetLimit). The reported range is therefore the range the next call accepts.
  • inspect_devicetree: DEVICETREE_READ_BUDGETS owns max_file_bytes, max_nodes, max_properties, max_depth and the new max_decoded_bytes. The fixed 32 MiB decoded-representation allowance (an estimate charged before each allocation; repeated node paths grow it faster than the input) is now max_decoded_bytes (default 32 MiB, range 1 KiB to 256 MiB). The FIT reader, which calls the same parser with fixed budgets, passes the default and maps max_decoded_bytes to its memory boundary (a small change in src/artifacts/fit/FitStructure.ts, tested in FitStructure.test.ts).
  • inspect_windows_shortcut: WINDOWS_SHORTCUT_BUDGETS owns the four per-call budgets; the provider's duplicated maxima table is removed.
  • inspect_kernel_build_config: KERNEL_BUILD_CONFIG_BUDGETS owns the four budgets. The compressed IKCFG candidate allowance is derived from max_config_bytes, so that refusal reports the max_config_bytes limit. The read-budget and file-size refusals report max_file_bytes.
  • extract_firmware: FIRMWARE_STAGING_BUDGETS owns max_output_bytes and max_output_files; the staging refusal reports its limit. The inherited RLIMIT_FSIZE refusal is an observed host limit, not an REA control, and now declares measuredExhaustion.
  • inspect_byte_entropy: the 32,768-block refusal reports block_size (256 to 65536, default 4096) while a larger block admits the window, and otherwise length (at most 32,768 blocks of the selected block_size; its default is the rest of the file).
  • inspect_binary_layout / pwntools: a structured allocation failure declares measuredExhaustion, matching the documented rule that an allocation failure does not prove producer_limits.address_space_bytes was exhausted.
  • observe_native_calls: the combined LLDB result ceiling (min(buffer.constants.MAX_LENGTH, MAX_STRING_LENGTH)) is a fixed allowance ("The combined LLDB result representation ceiling", with the smaller-capture guidance in narrowing), registered as representation.

Controls added or reclassified

Site Change Reason
devicetree decoded representation new per-call max_decoded_bytes resource estimate, not a format fact
devicetree, shortcut, kernel config, firmware staging, byte entropy details.limit on existing controls #14234
LLDB combined result representation Node Buffer and string length
firmware RLIMIT_FSIZE, pwntools allocation measuredExhaustion observed host or worker exhaustion

Guard counts: authored-only refusals 103 to 93 (seven files removed from the baseline). Pending ceilings unchanged at 80 (the devicetree allowance was never declared). Registered: 99 to 100 (one representation).

After #14625 these refusals carry no authored recovery; the generated adjustable-budget recovery names the control. inspect_byte_entropy reports the smallest admitting block_size as required_value. The other sites report none: count budgets stop at the first excess, and a file-size stop does not measure the complete need.

Validation

  • npx vitest run src/domain/firmware src/firmware src/application/binaryDiagnostics/ByteEntropyService.test.ts src/domain/native/byteEntropy.test.ts tests/boundary/filesystem/kernelBuildConfig.test.ts tests/boundary/filesystem/windowsShortcut.test.ts tests/boundary/mcp/devicetreeMcp.test.ts tests/boundary/firmware src/artifacts/fit src/native/pwntools tests/evaluation/fixedCeilingGuard.test.ts: 593 passed, 54 skipped (platform)
  • New refusal tests asserting details.limit: devicetree over MCP (max_nodes, max_file_bytes, max_decoded_bytes, then a raised max_nodes succeeds); shortcut (max_file_bytes, max_id_list_items, max_extra_data_blocks, max_string_bytes); kernel config (max_file_bytes, max_entries, max_config_bytes, max_payload_bytes); byte entropy (block_size, and length when no block admits the window); devicetree parser admits a blob above the default with a raised max_decoded_bytes.
  • node scripts/verify/fixed-ceilings.mjs: 100 registered, 80 pending, 93 authored-only
  • node scripts/verify/architecture-guards.mjs: passed
  • npm run verify:advertised-schemas -- --update-summary: inspect_devicetree summary updated
  • npm run docs:check, npx oxfmt --check ., npx oxlint on changed files: clean
  • Scoped tsc --noEmit on the changed files: clean
  • Not run: real firmware tooling, a real LLDB observation, a pwntools worker allocation failure.

Compatibility

Breaking: the devicetree decoded-representation refusal reports reported_limits.boundary: "max_decoded_bytes" and details.limit instead of decoded_bytes. Other changes add details.limit, measuredExhaustion or a fixed_ceiling refusal to existing refusals. Defaults are unchanged.

@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

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

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-26T02:02:22.792272Z
We couldn’t complete this review. Comment @codex review to try again.
79f67f6 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.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@greptile-apps

greptile-apps Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5 · The PR appears safe to merge; no new actionable issue was found.RetriggerView in GreptileConfidence Score: 5/5 Tier: plus

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

Summary

Shares budget definitions between input schemas and details.limit, and makes max_decoded_bytes adjustable per call.

  • Devicetree inspections can set a decoded-size budget and see which budget stopped them.
  • Kernel config refusals point to the per-call setting that stopped the read or decode.
  • Windows shortcut refusals identify the caller-set budget that stopped inspection.
  • Firmware staging refusals show which output budget stopped extraction.
  • Byte entropy refusals point to a larger block or a shorter window.
  • LLDB and pwntools refusals distinguish fixed ceilings from observed exhaustion.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  B["Shared budget definition"] --> S["Input schema"]
  S --> P["Reader enforces selected value"]
  B --> L["Parameter limit facts"]
  P -->|Budget exceeded| L
  L --> R["Generated CLI or MCP recovery"]
Loading

Reviews (6) · Last reviewed commit: "refactor(native): let the generated adju..." · Reviewed by Greptile

Comment thread src/domain/firmware/devicetreeParser.ts Resolved
Comment thread src/native/LldbCallTracer.ts Resolved
Comment thread src/domain/native/byteEntropy.ts Resolved
Devicetree, Windows shortcut, kernel build config, firmware staging and
byte-entropy refusals of caller-selected budgets named their control only
in remediation prose. Each now sets details.limit from a domain-owned
budget object that also builds the schema (src/domain/parameterBudget.ts),
so the reported range is the one the next call accepts.

inspect_devicetree's fixed 32 MiB decoded representation allowance becomes
the per-call max_decoded_bytes (default 32 MiB, 1 KiB to 256 MiB); its
refusal reports boundary max_decoded_bytes instead of decoded_bytes.

The pwntools allocation failure declares measuredExhaustion, the firmware
inherited RLIMIT_FSIZE refusal declares measuredExhaustion, and the LLDB
combined-result ceiling is a registered representation bound.

Part of #14234 and #14235.

BREAKING CHANGE: inspect_devicetree's decoded-representation refusal reports
reported_limits.boundary "max_decoded_bytes" with details.limit, instead of
"decoded_bytes".
…ropy length range exact

The FIT reader compared the renamed devicetree limit against decoded_bytes, so a decoded-budget refusal became capacity; it now checks max_decoded_bytes, with a test. The LLDB representation ceiling keeps a short name and carries its recovery as narrowing. The byte-entropy length maximum is the window the selected block_size admits.
…he native reader controls

With #14625 the refusal owns per-call recovery, so the devicetree, Windows shortcut, kernel build config, firmware staging and byte-entropy refusals drop their authored sentences. inspect_byte_entropy reports the smallest admitting block_size as required_value.
@morluto
morluto force-pushed the fix/native-reader-parameter-limits branch from 792ba91 to d7f636f Compare November 26, 2026 03:44
@morluto
morluto enabled auto-merge (squash) November 26, 2026 04:09
@morluto
morluto merged commit 50d13f9 into main Nov 26, 2026
46 checks passed
@morluto
morluto deleted the fix/native-reader-parameter-limits branch November 26, 2026 04:11
@morluto morluto added area: native Native analysis and decompilation, including Ghidra, IDA, and Hopper analysis behavior bug Something isn't working labels Nov 26, 2026
trism-prism added a commit to trism-prism/rea that referenced this pull request Nov 28, 2026
Rebased onto main; the devicetree and NuGet parts were dropped here (landed via morluto#14622 and morluto#14629). This commit now carries only the pyc part.

Refusals of the per-call budgets on inspect_devicetree, inspect_nuget_nupkg
and inspect_python_pyc carried recovery only in remediation prose. Each
owner now keeps one bounds object that feeds both its input schema and a
structured details.limit (parameter, effective value, unit, range, default).

A pyc limit that depends on max_objects and max_depth together reports
related_parameters instead of a single range. The fixed decoded devicetree
allowance is reported as a fixed ceiling and registered as pending.

Refs morluto#14234
vincentkoc pushed a commit that referenced this pull request Nov 30, 2026
* fix(limits): report details.limit for pyc budget refusals

Rebased onto main; the devicetree and NuGet parts were dropped here (landed via #14622 and #14629). This commit now carries only the pyc part.

Refusals of the per-call budgets on inspect_devicetree, inspect_nuget_nupkg
and inspect_python_pyc carried recovery only in remediation prose. Each
owner now keeps one bounds object that feeds both its input schema and a
structured details.limit (parameter, effective value, unit, range, default).

A pyc limit that depends on max_objects and max_depth together reports
related_parameters instead of a single range. The fixed decoded devicetree
allowance is reported as a fixed ceiling and registered as pending.

Refs #14234

* test(python): expect field-only pyc recovery text and the CLI limit flag
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.

1 participant