Repository navigation
fix: retain image provider state through request cleanup - #143403
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed September 9, 2026, 5:20 PM ET / 21:20 UTC (Revision 2). ClawSweeper reviewWhat this changesImage understanding retains provider resources through unfinished setup, requests, and cleanup while preserving timeout and cancellation reporting. Merge readiness✅ Ready for maintainer review This remains a useful, focused repair absent from fetched main and the latest release. No blocking correctness defect was found, and the previous review’s draft-status blocker is resolved. Priority: P2 Review scores
Verification
How this fits togetherImage understanding turns images and prompts into descriptions through configured model providers. Prepared runtimes supply provider registrations and credentials; their resources must remain usable until accepted work and cleanup finish. flowchart TD
A[Images and prompt] --> B[Prepare model runtime]
B --> C[Retain original provider resources]
C --> D{Source still open?}
D -->|Yes| E[Run image provider]
D -->|No| F[Reject new work]
E --> G[Report result or timeout]
E --> H[Drain actual work and release resources]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +49, Tests +851, Docs +7. Total +907 across 7 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep resource ownership tied to actual image-operation completion while separately reporting deadlines and refusing new work from closed managed sources. Do we have a high-confidence way to reproduce the issue? Yes, from source: hold provider or setup-descendant work past timeout, then release the supplying managed runtime; current main can release resources before that work settles. This review did not execute the scenario. Is this the best way to solve the issue? Yes. The private early handoff and existing async-work owner address the lifetime mismatch without adding public APIs, configuration, storage migrations, or changing timeout budgets. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 30ce57e5e3f7. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
Merged via squash.
|
Related: #140674.
What Problem This Solves
Resolves a problem where image requests can close plugin databases while timed-out setup, provider calls, or cleanup are still running. Supplied prepared runtimes also need to retain the original provider and any adopted donor registrations through the request.
Why This Change Was Made
Transfer resource ownership immediately after acquisition, before asynchronous model and auth setup. Keep the existing caller deadlines while tracking the actual setup and provider work separately, then release after cooperating cleanup settles. Supplied managed snapshots retain their exact prepared owner, including donors; raw snapshots retain their existing caller ownership.
Closed managed sources refuse new generic and MiniMax calls, including retries and each image in a MiniMax batch. The private early handoff removes competing failed-setup and late-result release paths. No public SDK fields, configuration, schema, dependency, producer-activation or timeout-policy changes.
User Impact
Image requests keep their existing cancellation and timeout behavior while allowing already accepted work to finish using the correct retained resources. Cleanup closes each owned database once after the final user.
Evidence
Sixteen native SQLite cases cover timeout, cancellation, late rejection, supplied and raw owners, adopted donors, setup descendants, cleanup, and closed-source admission. Original code reproduces five ownership failures with two controls. Review found two further defects in the intermediate implementation—failed setup releasing before its descendants and MiniMax missing per-image closure checks—and both have failing-before, passing-after regressions.
Focused Image, timeout, auth-profile and provider/tool suites pass. Complete affected checks, proportional checks after the final narrow fence change, and fresh full-candidate Codex review through P2 pass. The ordinary build passed in 254.76 seconds; its nonfatal UI gzip warning of 20 bytes over the threshold is recorded, with no UI or budget changes.
The actual compiled public SDK and compiled runtime producer passed together in 6.42 seconds. A successful request took 83.88 milliseconds; the unchanged 1-second timeout reported at 1.004 seconds. After replacement, the original provider and donor databases stayed usable through late work. Closed-source admission was refused, all three fixture databases closed exactly once and reopened with their expected values, and the successor received no calls.
All seven source hashes and 11,683 build artifact hashes stayed unchanged; the plain-Node process and descendants exited. The proof uses synthetic SQLite stores and a valid PNG, without application source fallback, external credentials, a real provider or a production Gateway. Timings are individual correctness observations, not a comparative performance claim.