Repository navigation
fix(tasks): exclude retry preparation from scan work budget - #153328
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 19, 2026, 9:37 PM ET / September 20, 2026, 01:37 UTC. ClawSweeper reviewWhat this changesCorrects task-list retry timing so registry preparation does not trigger unnecessary event-loop yields, with regression coverage for both cheap and budget-exhausting retries. Merge readiness✅ Ready for maintainer review The fix remains useful on current main and has no identified blocking defect. It preserves accumulated scan work while excluding retry preparation; the protected maintainer PR should proceed through normal landing gates. Priority: P2 Review scores
Verification
How this fits togetherThe Gateway serves task-list requests by selecting authorized records from the task registry. Its scan budget lets expensive selections yield to other requests while preserving consistent pagination. flowchart TD
A[Task-list request] --> B[Prepare registry read]
B --> C[Scan authorized records]
C --> D{Scan budget exhausted?}
D -->|Yes| E[Yield to other requests]
E --> C
D -->|No| F{Registry changed?}
F -->|Yes| B
F -->|No| G[Return ordered page]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +3, Tests +86. Total +89 across 2 files. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Keep scan-budget accounting in the existing registry query owner, excluding preparation while retaining work accumulated across retries. Do we have a high-confidence way to reproduce the issue? Yes, from source: a registry mutation forces a retry, and slow read preparation incorrectly consumes the existing scan budget on main. The added deterministic Gateway scenarios cover this trigger; this read-only review did not execute them. Is this the best way to solve the issue? Yes. Subtracting preparation duration repairs the existing accounting owner without resetting accumulated work or changing pagination, authorization, or configuration contracts. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 1b7c1defff70. 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.
|
What Problem This Solves
Task-list retries count time spent preparing registry reads against the scan work budget. A cheap retry can therefore yield after its first batch despite accumulated scan work remaining below the budget.
User Impact
Avoids an unnecessary yield during task-list retries. Work already spent scanning still counts toward the same budget, so the required yield remains when accumulated scan work reaches it. Batch size, retry limits, cursor validation and read/access checks remain unchanged.
Why This Change Was Made
Advance the scan work start time by the elapsed retry preparation duration. Extend the existing authenticated Gateway performance case with deterministic scenarios covering both the unnecessary yield and the required yield, while retaining page ordering, bounded selection and cursor assertions.
Evidence
Historical qualification at 137f4ba used Node 24.19.0. The original production code failed the new Gateway regression at its intended queued-work assertion. The candidate passed 39 cases: the full Gateway performance case, 20 query tests and 18 read-owner tests, with no pending cases. The proof process joined successfully and its isolated source was restored.
The controlled clock exercises the real authenticated Gateway and registry boundaries. This establishes scan-budget accounting behavior; it is not a benchmark or a timing improvement claim. The separately observed 16.99-second request is not causally attributed to this defect.
All 19 captured source pairs are byte-identical between the historical qualification and observed main 49dfd78. Historical formatting and diff checks passed; changed-lane classification selected core and coreTests only. Fresh P2 review completed cleanly with no findings; its process joined and the review job closed. Current-config formatting and read-only patch application with whitespace checks passed with sources unchanged and the proof job closed. Fresh publication-base reconciliation at a0ec9f5 found both candidate preimages and all reviewed owners unchanged. Historical runtime qualification remains at 137f4. Exact-head CI35481591877 passed: 139 successful jobs and 17 intentionally skipped jobs. Inspected execution logs confirm all 39 relevant cases passed (authenticated Gateway 1, query 20, read 18), with no skipped or failed target cases. Both candidate files match the tested merge tree, and reviewed supporting owners are unchanged. Native landing follows the repository maintainer workflow.