Skip to content

fix(tasks): exclude retry preparation from scan work budget - #153328

Merged
steipete merged 1 commit into
mainfrom
codex/task-page-retry-work-budget
Sep 20, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/task-page-retry-work-budget

Conversation

@steipete

@steipete steipete commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

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.

@clawsweeper

clawsweeper Bot commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime size: S maintainer Maintainer-authored PR labels Sep 20, 2026
@steipete
steipete marked this pull request as ready for review September 20, 2026 01:31
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 20, 2026
@clawsweeper

clawsweeper Bot commented Sep 20, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 19, 2026, 9:37 PM ET / September 20, 2026, 01:37 UTC.

ClawSweeper review

What this changes

Corrects 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
Reviewed head: 9351abfb5186c58d57529fb93ec3daf8995f425c

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused owner-level correction with complementary regression scenarios and no identified blocking defect.
Proof confidence 🌊 off-meta tidepool Not applicable: The verified repository-admin author is exempt from the external proof gate. The body reports before/after authenticated Gateway coverage of registry retry accounting with a controlled clock; it does not establish a real-world latency improvement.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The verified repository-admin author is exempt from the external proof gate. The body reports before/after authenticated Gateway coverage of registry retry accounting with a controlled clock; it does not establish a real-world latency improvement.
Evidence reviewed 7 items Narrow production correction: The retry advances the scan start timestamp by preparation duration. Previously accumulated scan work remains charged; the 12 ms threshold, three-attempt limit, current-read checks, and bounded selection remain intact.
Meaningful regression coverage: Two authenticated Gateway scenarios force one registry mutation and 100 ms of retry preparation. With 1 ms access slices, queued work stays deferred; with 3 ms slices, retained scan work reaches the budget and queued work runs. Both verify authorized ordering, bounded sorting, and a continuation cursor.
Current main still needs the correction: The fetched-main comparison shows the three production additions are absent from current main. No alternate accounting correction was found in the inspected query or read owner.
Findings None None.
Security None None.

How this fits together

The 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]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +3, Tests +86. Total +89 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 3 0 +3
Tests 1 87 1 +86
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 90 1 +89

Review metrics

None.

Technical review

Best 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.

Labels

Label changes:

  • add P2: This is a bounded task-list scheduling correction with no demonstrated outage or urgent user-facing regression.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The verified repository-admin author is exempt from the external proof gate. The body reports before/after authenticated Gateway coverage of registry retry accounting with a controlled clock; it does not establish a real-world latency improvement.

Label justifications:

  • P2: This is a bounded task-list scheduling correction with no demonstrated outage or urgent user-facing regression.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The verified repository-admin author is exempt from the external proof gate. The body reports before/after authenticated Gateway coverage of registry retry accounting with a controlled clock; it does not establish a real-world latency improvement.

Evidence

What I checked:

  • Narrow production correction: The retry advances the scan start timestamp by preparation duration. Previously accumulated scan work remains charged; the 12 ms threshold, three-attempt limit, current-read checks, and bounded selection remain intact. (src/tasks/task-registry-query.ts:216, 9351abfb5186)
  • Meaningful regression coverage: Two authenticated Gateway scenarios force one registry mutation and 100 ms of retry preparation. With 1 ms access slices, queued work stays deferred; with 3 ms slices, retained scan work reaches the budget and queued work runs. Both verify authorized ordering, bounded sorting, and a continuation cursor. (src/gateway/server.tasks-list-performance.test.ts:284, 9351abfb5186)
  • Current main still needs the correction: The fetched-main comparison shows the three production additions are absent from current main. No alternate accounting correction was found in the inspected query or read owner. (src/tasks/task-registry-query.ts:213, 1b7c1defff70)
  • Latest-release boundary: GitHub identifies v2026.9.5 as the latest release. Its page selector uses synchronous registry readiness and lacks the asynchronous retry-preparation path addressed here; this is not evidence of a shipped fix. (src/tasks/task-registry-query.ts, ec9c1a13db89)
  • Authorization remains with the existing owners: The Gateway rechecks page currency, access revision, and selected-row authorization immediately before responding. The patch changes timing accounting without changing authority, public parameters, stored data, or dependencies. (src/gateway/server-methods/tasks.ts:244, 9351abfb5186)
  • Validation and author status: The captured PR body reports an intended pre-fix assertion failure and 39 passing candidate cases on a historical qualification revision, with source reconciliation to the publication base. These claims were reviewed, not rerun. GitHub independently confirms steipete has repository admin access. (9351abfb5186)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • jason-allen-oneal: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@steipete
steipete merged commit 4df4507 into main Sep 20, 2026
283 checks passed
@steipete
steipete deleted the codex/task-page-retry-work-budget branch September 20, 2026 02:07
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gateway Gateway runtime maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant