Repository navigation
fix: retain approval classification resources through cleanup - #143307
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, 2:10 PM ET / 18:10 UTC. ClawSweeper reviewWhat this changesThe approval classifier retains its prepared model resources until inference callbacks and cancellation finish, with regression coverage for overlapping requests and credential rotation. Merge readiness✅ Ready for maintainer review This focused repair remains necessary on current main. No actionable introduced defect was found; the broader draft is explicitly a reference, not a replacement landing path. Priority: P2 Review scores
Verification
How this fits togetherThe system agent interprets user replies to pending configuration proposals. Ambiguous replies use a verified model route to produce an approval verdict, while transport cleanup must finish before its model resources are released. flowchart TD
A[User reply and pending proposal] --> B{Clear approval or rejection?}
B -->|Yes| F[Approval verdict]
B -->|No| C[Verify route and acquire model resources]
C --> D[Classify through model transport]
D --> E[Revalidate route]
E --> F
D --> G[Drain callbacks and cancellation]
G --> H[Release model resources]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +26, Tests +346. Total +372 across 3 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Use the existing finite model lease through actual cleanup while keeping approval decisions and the caller deadline independent of resource drainage. Do we have a high-confidence way to reproduce the issue? Yes, source establishes the early-release path, and the supplied regressions exercise overlapping classifications and delayed cancellation. This read-only review did not execute a current-main reproduction. Is this the best way to solve the issue? Yes. Migrating this caller to the existing acquisition contract and joining actual transport cleanup repairs the lifecycle owner without adding a parallel API or changing approval policy. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 9865df7610c8. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged via squash.
|
Related: #140674
What Problem This Solves
Resolves a problem where ambiguous approval classification releases its prepared model runtime before inference and transport cleanup finish. Concurrent classifications can rebuild a generation that should still be retained, and a timeout can leave callbacks running beyond their owner.
Why This Change Was Made
Acquire the existing finite model contract and admit cleanup to the parent before preparation. Preserve the caller's result deadline while draining actual completion, response callbacks, and cancellation work before releasing the lease. This is the approval-classifier slice of #140674.
The closed-list shortcut, verified embedded route, exact provider/model/profile/auth matching, final route revalidation, and fail-closed policy remain intact. The ten-second timer still starts after route matching and clears after completion and revalidation, independently of drainage.
User Impact
Approval classification keeps its model and authentication runtime available until its real work finishes, including after a timed-out verdict. Approval decisions, input limits, and timeout behavior are unchanged.
Evidence
Three native regression cases fail against the original code and pass with the repair. They cover overlapping preparation, response-body cancellation, and credential rotation during pending verdicts. All 158 focused tests passed; changed-file gate coverage, isolated Codex review through P2, and the full build passed.
A plain Node run of the emitted classifier used real SQLite authentication state, the production verified-binding machinery, a synthetic plugin, and loopback HTTP. A real response callback remained held after the unchanged deadline returned
otherat 10,021 ms. Parent drainage, generation reuse, fresh preparation after release, and credential-rotation rejection passed. Strict process cleanup completed in 12.987 seconds; all 12,111 built artifacts remained unchanged. No pending mutation was executed.These are local observations, not a comparative performance benchmark or paid-provider proof. Native cancellation coverage uses the declared hermetic test transport; the compiled proof uses the actual plugin callback and HTTP path. Broader run-registration physical disposal is a separate slice.