Repository navigation
fix(limits): report details.limit for pyc budget refusals - #14386
Conversation
[Medium impact] The PR appears safe to merge; no actionable defects were found. SummaryAdds structured recovery details to budget refusals from
Review was source-based; no tests were run. Whether another PR supersedes this one could not be checked because GitHub access required authentication. Acknowledged by Reviews (1) · Last reviewed commit: "Merge remote-tracking branch 'upstream/m..." · Reviewed by Greptile |
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. |
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
|
Thanks for this. Two of its three parts have since landed on main through other PRs, so merging main now conflicts in 10 files:
Could you rebase onto main and keep only the pyc part, with its |
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
13b87c9 to
7bff6bb
Compare
|
@N0zoM1z0 Rebased onto main and trimmed to the pyc part only. The devicetree and NuGet changes are out, since they landed in #14622 and #14629. The diff is now just the pyc budgets, its tests, and the limits-and-recovery.md entry. The CI runs should be ready for your approval whenever you have a moment. |
|
Thanks — merged after clean review and CI. The pyc refusal now reports the exact budget and accepted range, with CLI and MCP coverage passing on this head. |
Summary
Refusals of the per-call budgets on
inspect_python_pyccarried their recovery only inremediationActionprose. A caller had to parse text to learn which parameter to raise and how far. They now carry a structureddetails.limit(control_kind: "parameter",parameter,effective_value,unit,minimum,maximum,default_value,applies_at: "next_call"), the same shapeinspect_elf_notesreports.Refs #14234
Problem and expected behavior
Smallest trigger:
inspect_python_pycwithmax_objects: 1. The refusal isresource_constraint, butdetailshas nolimit; the only recovery isremediationActiontaken from the parser's detail string.Expected: the refusal names the parameter, its effective value, default and accepted range, so the next call can be built from
details.limitalone.Change and scope
PYTHON_PYC_READ_BUDGETS) that feeds both the Zod schema and apythonPycBudgetLimit()builder forAnalysisParameterLimit. Prose stays as explanation.limit.nested_code_stepsandnested_code_referencesdepend onmax_objectsandmax_depthtogether, so they reportrelated_parametersinstead of a single range. The prose no longer embeds CLI--flagspellings; the CLI addscli_flagitself.PYTHON_PYC_LIMIT_MAXIMAtable is removed; the bounds object replaces it.docs/reference/limits-and-recovery.mdlistsinspect_python_pyc.capacity/memory/file-size) and advertised input schemas are unchanged. Not touched: ELF/kernel, PE, pcap, entropy, devicetree, NuGet owners (other PRs).scripts/verify/fixed-ceiling-registry.json,scripts/verify/untyped-budget-refusal-baseline.jsonanddocs/reference/limits-and-recovery.md; whichever lands second needs a small merge in those files.Contract and boundary impact
details.limit/details.related_parameterson pyc refusals;remediation.actionfor pyc no longer contains--flagtext. Input schemas identical.details.limit/details.related_parametersfields; no identity, provenance or result change.Expected effects:
Evidence and regression coverage
State: executed evidence unless marked source-derived.
tests/boundary/filesystem/pythonPyc.test.ts:details.limitfor the four pyc budgets; remediation contains no--flag spelling.tests/boundary/filesystem/pythonPycNestedLimit.test.ts(new):nested_code_stepsandnested_code_referencesreportdetails.related_parameters: ["max_objects", "max_depth"]and nodetails.limit, with the parser mocked to raise them (see gaps).tests/acceptance/pythonPycCli.test.ts: a new test that the CLI addscli_flag: "--max-objects"todetails.limit; the existing--max-depth/--max-file-bytesrefusal test now expects field-only remediation anddetails.limit.cli_flag.srcfiles restored to the base revision (tests and docs kept), every new pyc boundary assertion failed (details.limit/related_parametersabsent): 2 of 2 nested-limit tests, 1 of 2 inpythonPyc.test.ts; the other pyc assertion passed at base.inspect_python_pycwithmax_objects: 1returns alimitshape formax_objects(default 16384), with remediation "Raise max_objects above 1, up to 65536, on the next call. …" and no--flagtext. On the CLI (inspect-python-pyc --max-objects 1 --json),details.limitalso carries"cli_flag": "--max-objects", asserted by the acceptance test in CI; not captured locally (no build on this host).max_objects * max_depth, somax_objectsormax_depthrefuses first for any real marshal stream tried; the test covers the provider's classification and projection, not the parser's accounting.cli_flagis exercised in CLI tests only for pyc.npm run typecheckran out of memory once on this host (Windows commit-memory exhaustion); the Windows native build needs thex86_64-w64-mingw32-g++cross compiler, which is not installed, so local CLI acceptance runs were not possible; local Node was 24.19.0 against the pinned 24.22.1. CI covers this change.For evidence-bearing changes:
Validation performed
Rebase validation (Linux, Node 24.22.1, rebased head
7bff6bb41):npx vitest runon the pyc boundary tests (tests/boundary/filesystem/pythonPyc.test.ts,tests/boundary/filesystem/pythonPycNestedLimit.test.ts) — 4 passed.node scripts/run-typescript.mjs --noEmit --checkers 1 -p tsconfig.build.json(GOMEMLIMIT=3000MiB) — exit 0.npx oxfmt --checkon the changed files — clean.npm run build:cached), which is not built on this host, so the shared CLI process exits before the tests run. They passed in fork CI before the rebase (pythonPycCli.test.ts: 16 passed at81634e2, run); upstream CI on the rebased head is awaiting maintainer workflow approval (action_required).oxfmt --checkclean,lint0 errors,lint:typed0 errors,verify:module-boundariespassed,verify:test-discoverypassed,knip:productionpassed,check:fastpassed for each pushed commit.Compatibility, safety, and release
details.limitis additive; pyc remediation prose no longer includes--flagspellings.Author readiness
Human owner: @trism-prism
Author checklist (completed by the PR author before requesting review)
type(scope): outcome.REA_runtime setting with a default, floor, and maximum, unless a fixed ceiling has a stated reason. See Adding a runtime setting.