Repository navigation
fix(managed): bound transient CIL by decoded instruction count - #1822
Merged
Merged
Conversation
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. |
3 tasks done
2 tasks done
Owner
|
Thanks for the follow-up to #1768, @jhuang-tw. Charging transient CIL by decoded instruction instead of raw byte lets a 270 KB method with wide operands pass when its retained facts fit, while a truly over-budget stream still returns a typed resource-limit. The CLI and stdio MCP parity check covers the public boundary. |
2 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why this needs a separate follow-up
Merged #1768 correctly separates accumulated per-method decoding reservations from the retained-output budget. One remaining false rejection is still reproducible on its merged main: a single method with more than ~256 KiB of multi-byte CIL is rejected by
admitTransient(il.length * 256)before its actual instruction count is known, even when its retained result is modest.On pristine post-#1768 main
f178bf1c, a source-owned 272,896-byte PE/CLI fixture with one 270,000-byte method (54,000 five-byte instructions) returnedcoverage: unavailable,types: [],methods: [],metadata.representationresource-limit. The failure is not a malformed target or an MCP transport loss.Fix
ManagedReaderFailureout of the decoder so exhausted budget stays a typedresource-limit, never a misleading malformed-IL observation.Independent acceptance and regression
brinstructions (each branch targets the following instruction), followed byret. Exactly 270,001 IL bytes, stack-neutral. 54,001 instructions are reported withcoverage: complete, one retained type and method.nopinstructions with trailingretstill produce a typed resource-limit and a recorded positive offending IL byte offset, with no invented partial successful method.src/dotnet, managed provider/MCP and CLI acceptance suites: PASS.npm run check:fast,npm run build:cached,npm run docs:check, andoxfmt --checkon all three changed files: PASS.normalized_result, 54,001 decoded instructions, successful following SDK ping, and unchanged artifact SHA-256ab80b511d759b6ec82b20e4ff7f6c4a83c8a5f663d0a7f0ea9049be1ae656d00. Temporary fixtures cleaned.Scope and risks
Follow-up to #1768, refs #1801; does not claim to close #1801 or address large signature-only budgets, independent caller-selected resource overrides, or very large retained projections. Another contributor has discussed a different per-call 1 GiB expansion budget in #1801; this intentionally preserves the original 64 MiB transient admission and charges what the decoder actually produces. The 256-byte per decoded instruction accounting remains a conservative projection, not a measured peak-process-RSS guarantee.
Verification used Windows Node 24.17.0/npm 10.9.2 rather than repository-preferred Node 24.18.0/npm 11.16.0; no real proprietary managed assembly, Ghidra or Hopper claim is made.
The change is scoped to three source/test files, with no generated artifacts, user-owned project changes, or new dependencies.
AI assistance was used to develop and verify this contribution.