Repository navigation
feat(limits)!: report the value a per-call limit needs and derive its recovery - #14625
Conversation
Codex Review Summary: ❌ FailedThis 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. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
[Medium impact] No new issue requiring changes was found in the reviewed code. SummaryAdds
Diagram%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Producer reports limit facts] --> B[Typed refusal]
B --> C[Project error]
C --> D{Authored recovery?}
D -->|Yes| E[Keep authored text]
D -->|No| F[Generate recovery from facts]
G[CLI command spelling or MCP default] --> F
F --> H[Return recovery and refusal facts]
E --> H
Reviews (5) · Last reviewed commit: "test: expect the typed refusal for Flutt..." · Reviewed by Greptile |
… recovery A per-call parameter limit (`control_kind: "parameter"`) now carries an optional `required_value`, and its refusal projects the typed `adjustable_budget` under `details.refusal` with `control`, `default_value` and `required_value`. The refusal owns the recovery: "Pass a larger <parameter> on the next <operation> call (at least N; range a..b), then retry", or a narrower request when the control is at or below the need's maximum. The CLI renders the step with the command's flag and command. ELF notes and debug-link, pcap producer limits, PE/native read budgets and WASM artifact paths drop their duplicate authored recovery and report the measured need where they compute it. BREAKING CHANGE: per-call parameter refusals gain `details.refusal`, and their `remediation.action` wording changes to the generated form.
…all limit The adjustable_budget recovery is now rendered from its details.refusal facts alone (which gain `source` for settings), so the CLI parses those facts and re-renders the recovery with its flag and command instead of matching display text; authored recovery is never rewritten. A per-call control backed by a registered setting names both routes: the next call, then the setting through update_analysis_settings, or its launch environment variable for a one-invocation caller. Per-call-only controls keep one route. inspect_wasm_artifact reports the larger of its oversized selection counts as required_value, so one retry admits both fields.
…ter's spelling Refusal recovery is rendered at projection in the spelling of the adapter that delivers it: MCP names the contract field and tool; a CLI command binds its own spelling (flag or JSON-option path, rea <command>, launch environment route) around its run. Authored recovery never reaches the renderer, so nothing distinguishes it by text. The CLI no longer re-parses details.refusal or rewrites the generated sentence; the prefix-matching rewrite and its fact schema are removed.
Per-call parameter limits now carry details.refusal; these tests landed on main asserting its absence.
c7dd6e5 to
3324d6f
Compare
|
@greptileai review |
…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.
…he remaining native controls With #14625 the refusal owns per-call recovery, so the ELF dependency, ELF unwind, Apple IPS, DWARF, initializer, PE resource and BEAM refusals drop their authored sentences. BEAM reports the complete row and atom counts as required_value. The unwind per-page text allowance is a registered fixed allowance whose narrowing names a smaller limit, because a larger page would not admit it.
…#14622) * fix(native)!: report details.limit for native reader per-call budgets 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". * fix(native): keep FIT decoded-budget boundary, LLDB narrowing and entropy 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. * fix(cli): describe inspect-devicetree --max-decoded-bytes * refactor(native): let the generated adjustable-budget recovery name the 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.
…he remaining native controls With #14625 the refusal owns per-call recovery, so the ELF dependency, ELF unwind, Apple IPS, DWARF, initializer, PE resource and BEAM refusals drop their authored sentences. BEAM reports the complete row and atom counts as required_value. The unwind per-page text allowance is a registered fixed allowance whose narrowing names a smaller limit, because a larger page would not admit it.
…s and make BEAM table rows adjustable (#14631) * fix(native)!: report details.limit for native reader per-call budgets 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". * fix(native): keep FIT decoded-budget boundary, LLDB narrowing and entropy 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. * fix(cli): describe inspect-devicetree --max-decoded-bytes * refactor(native): let the generated adjustable-budget recovery name the 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. * fix(native)!: report details.limit for remaining native reader budgets and make BEAM table rows adjustable inspect_elf_dependencies, inspect_elf_unwind_ranges, inspect_apple_ips, inspect_dwarf_units, inspect_native_initializers and inspect_pe_resources named their per-call budgets only in remediation prose. Each now reports details.limit from a domain-owned budget object that also builds the schema. The unwind per-page symbol-name text refusal names the page size `limit`, the control that admits it. The fixed 65,536-row BEAM table ceiling becomes the per-call max_table_rows (default 65,536, at most 1,048,576). The plist nesting allowance is reclassified as a representation bound (MAX_JSON_DEPTH less the report envelope). GPU and APK input refusals that named their fixed allowances only in prose now declare them, registered as pending #14235. Part of #14234 and #14235. BREAKING CHANGE: a BEAM table-row refusal reports details.limit for max_table_rows instead of a fixed_ceiling refusal. * fix(native): keep naming the dependency and BEAM row controls in recovery * refactor(native): let the generated adjustable-budget recovery name the remaining native controls With #14625 the refusal owns per-call recovery, so the ELF dependency, ELF unwind, Apple IPS, DWARF, initializer, PE resource and BEAM refusals drop their authored sentences. BEAM reports the complete row and atom counts as required_value. The unwind per-page text allowance is a registered fixed allowance whose narrowing names a smaller limit, because a larger page would not admit it. * style: format the PE resources provider test * refactor(native): keep one owner of the IPS budget bounds and document the unwind text allowance
Behavior change
When a per-call parameter limit (
control_kind: "parameter") refuses a request, the refusal now:details.limit.required_valuewhen the producer measured the smallest value that admits the request;adjustable_budgetunderdetails.refusal(control,effective_value,unit,range,default_value, optionalrequired_value), the same as registered-setting limits;remediation.actionfrom those facts (one owner insrc/domain/analysisRefusal.ts): "Pass a larger<parameter>on the next<operation>call (at least N; range a..b), then retry". When the control is already at its maximum, or the need is above it, it asks for a narrower request instead. Environment controls and measured exhaustion stay excluded.parameterandsource, asjavascript.max_heap_mbalready is) names both routes: the next call, then "To raise it for this session, set<setting>with update_analysis_settings." A one-invocation caller (CLI) gets the setting's launch environment variable instead, or only the per-call route when there is none. Per-call-only controls keep the single route. The wording depends only on the refusal's facts.src/domain/analysisRefusalSpelling.ts): MCP by default; a CLI command bindscliRefusalSpellingaround its run (flag or JSON-option path,rea <command>, launch-environment route). No adapter rewrites the sentence afterwards, and authored recovery never reaches the renderer. Setting refusals also reportsourceindetails.refusal.--max-artifact-pathsonrea inspect-wasm-artifact); a member set through a whole-field JSON option keeps its path (producer_limits.input_bytes (in --producer-limits)). MCP keeps the contract field and tool.Count quantities are rendered without a unit word ("budget of 1", "range 1..256").
Producers that duplicated this prose drop their authored
remediationActionand report the measured need where they already compute it:max_file_bytes,max_entries; section-name budget reportsrequired_value)producer_limits.input_bytes(capture size asrequired_value) andoutput_bytesartifactReadBudgetConstraint(required_value= reads needed)inspect_wasm_artifactmax_artifact_paths(selected path count)Other per-call sites keep their authored recovery for now (it still wins over the generated text, so their wording is unchanged); they gain
details.refusal.ArtifactReaderLimitFact(details.reader_limit) stays separate: itsrequired_valueis a string when a declared size exceedsNumber.MAX_SAFE_INTEGER(exact bigint preservation), and it lives onArtifactOperationErrorwith its owncan_increase/retry semantics and consumers (Flutter, inventory classification). Folding it in would change that error's projection and retry rule, which is outside this foundation change.Docs:
docs/reference/limits-and-recovery.md#adjustable-budget-recoveryowns the agent-facing rule;docs/development/tool-design.mdgets the contributor rule for per-call vs registered-setting limits and links to it.Example (CLI, before → after)
Before:
After:
Validation
src/domain/analysisRefusal.test.tscovers both routes (continuing and invocation), the single route (invocation without a seed), the derived recovery (with and withoutrequired_value, both caller lifetimes), at-maximum and need-above-maximum branches, authored-recovery precedence, environment-control exclusion and thedetails.refusalprojection.tests/boundary/cli/wasmAcquiredInputsCli.test.tsassertsdetails.limit.required_value,details.refusaland the flag/field spelling of the recovery on each adapter.tests/boundary/filesystem/elfDebugLink.test.ts,tests/boundary/mcp/pcapWorkspaceAllocation.test.ts,tests/acceptance/pcapProducerLimitsCliMcp.test.ts(Linux-only; runs in CI).oxfmt --check ., oxlint, architecture guards, fixed-ceilings, module boundaries,docs:check.prlimitand was not run locally.