Repository navigation
fix: bound multi-slot backend allocations - #9
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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e376161744
ℹ️ 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".
|
@codex review The prior P2 is addressed in d152208. Please follow the |
|
Codex Review: Didn't find any major issues. Chef's kiss. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
🛡️ Codex Security Review · Automatically triggeredSecurity review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
Motivation
max_batch_sizevalues and converted them into unbounded nativeModelallocations, allowing attackers who control configuration to cause excessive synchronous allocations and temporary resource exhaustion.max(1, max_batch_size), which allowed booleans, floats, extremely large integers, andinfto reach the allocation arithmetic and bypass rollback paths.Description
MAX_BATCH_SIZE = 1024andMAX_MODEL_SLOTS = 64and documented them in the public API and README.max_batch_sizemust be a non-booleanintin1..MAX_BATCH_SIZEand exported the new constants from the package.math.ceilfloat-based computation with integer ceiling arithmetic after probingK, and capped the derivedn_modelstoMAX_MODEL_SLOTS; if exceeded, the code disposes slot 0, clears state, and raises aValueErrorbefore further native allocations.README.md,AGENTS.md,.agents/skills/mblt-npu/SKILL.md) and added regression tests that verify constructor andfrom_dict()validation and post-probe rollback behavior.Testing
python -m pytest -q, which completed successfully with94 passedand included the newly added tests:test_max_batch_size_rejects_non_integer_values,test_max_batch_size_rejects_values_outside_safe_range,test_from_dict_validates_max_batch_size, andtest_create_rejects_excessive_derived_slots_and_rolls_back.python -m ruff check mblt_npu/npu_backend.py mblt_npu/__init__.py tests/test_npu_backend_multi_slot.py, which passed after an unused-import fix.git diff --checkto ensure no whitespace or diff issues, which reported no problems.Codex Task