Repository navigation
fix(memory): defer required-intake SDK import faults without quality retry - #23728
Conversation
…retry The lazy provider-SDK imports in normalize() sat outside the model setup try introduced with #23710's cold-import fix, so an ImportError escaped as a raw exception and the shared processor booked it as a quality failure, spending a retry attempt. Move both imports inside the setup try so import faults raise RequiredProcessingDeferred ('required_intake_model_unavailable') and release the lease with attempt_count unchanged, like every other transport/setup fault. Regression: synthetic ImportError for either dependency must defer retryable-but-unprocessed, keep the capture pending, and leave exactly one zero-attempt retry receipt with no lease owner.
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: e09cae6335
ℹ️ 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".
|
|
||
| @pytest.mark.parametrize('dependency', ['utils.llm.clients', 'utils.llm.usage_tracker']) | ||
| def test_model_dependency_import_failure_defers_without_quality_retry(db, monkeypatch, dependency): | ||
| import builtins |
There was a problem hiding this comment.
Move the builtins import to module scope
The new test imports builtins inside its function, violating the explicit rule in backend/AGENTS.md: “All imports at module top level — never inside functions.” Move this standard-library import alongside the existing module-level imports; the import-failure simulation can still patch builtins.__import__ within the test.
AGENTS.md reference: backend/AGENTS.md:L168-L168
Useful? React with 👍 / 👎.
Summary
Luna r4's nonblocking P2 on #23710: the lazy provider-SDK imports in
normalize()sit outside the model setuptry, so anImportErrorescapesas a raw exception and the shared processor books it as a quality failure,
spending a retry attempt even though no model call ever ran.
This moves both imports (
utils.llm.clients,utils.llm.usage_tracker)inside the existing setup
try, so import faults raiseRequiredProcessingDeferred('required_intake_model_unavailable')— the sametransport/setup classification as every other model-unavailability fault —
and the lease is released with
attempt_countunchanged. The supported imagelocks these dependencies, so this is defense-in-depth for degraded images.
Per lead ruling 2bf926 this lands as a small follow-up from main after
#23710 (merged 61deb06); the identical patch was validated by the memreq
lane (60 intake tests, 11 clock-ratchet tests, full-tree Pyright) and is
applied here unchanged on top of current main.
Test evidence
test_model_dependency_import_failure_defers_without_quality_retry:a synthetic
ImportErrorfor either dependency must defer retryable-but-unprocessed,keep the capture
pending, and leave exactly one retry receipt withattempt_count == 0and no lease owner (transport deferral, not a quality retry).backend/test.shwithBACKEND_UNIT_TEST_FILE_LIST=tests/unit/test_required_memory_intake.py:60 passed (58 existing + 2 new), omi-heavy + nice -n 19.
Product invariants affected
RequiredProcessingDeferred transport path; the item keeps its single
consolidation route and no promotion/admission authority changes.
the capture stays pending Short-term exactly as before.
Failure-Class: none