Skip to content

refactor(gateway): prepare task pages before listing - #148586

Closed
steipete wants to merge 25 commits into
codex/async-media-owner-config-preparation-stack-20260914from
codex/async-gateway-task-page-stack-20260914
Closed

steipete wants to merge 25 commits into
codex/async-media-owner-config-preparation-stack-20260914from
codex/async-gateway-task-page-stack-20260914

Conversation

@steipete

@steipete steipete commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

Related: #144592. Stacked on #148583; focused seven-file task-page change.

Behavior

Gateway task pagination prepares its projection through the existing worker-backed owner. It carries one captured context/store across awaits and revision retries, validates that owner before cursor/error/results, and spends one preparation attempt within each existing page attempt. Persistent invalidation retains the existing registry_changed / retryable UNAVAILABLE response. Default callers retain full preparation; pending writes retain settlement and publication obligations.

Synchronous projection refresh uses the same existing publication helper after snapshot installation. It clears dirty state and restores every pending scope, preserving revision/epoch timing and rollback while removing duplicate state handling.

The parent owns the media continuation guard, its tightened controls, and runtime-config generation checks. F preserves those bytes. Page ordering, bounds, summaries, access filtering and public task APIs remain intact. Non-admin session-metadata reads remain separately owned and synchronous; SQL-zero evidence covers the selected admin flow only.

Current candidate

Head d1edd90fc639e05a1c3c93c9f7f6feae7a3323ed, tree 7fb0fbec7d524f0c68b86642e09ad7f9f3049bb1, normally merges actual E cfc6d11f033fe32b9d41ced630daef4dd8c04e84 into the previous F cut. It includes C a7c4ed1204386d2afe15b441593b96cebc3a7da9 and captured main b94fe8ffe8cf587d81ca9cf2f6d308fbaeb89e02. All seven F preimages/postimages and the complete focused patch are byte-identical to the prior qualified F/E pair; all other bytes equal the actual parent.

Fresh scoped P2 review found no actionable findings or missing source. The identical final tree passed 15 selected query controls and the persisted-row admin pagination control through worker close with all six parent SQLite counters zero. Six quick checks passed, including the current line-cap policy against the actual staged parent.

All 31 canonical requirements passed on the actual committed head, including production types, the canonical full core test-type graph, lint, reference-sensitive guards and runtime import-cycle checks. The isolated normal build passed in 17m 28.2s, with embedded metadata identifying this exact commit. It used an owned frozen install and separate build outputs. Exact-head hosted CI passed with 117 successful jobs and 17 skipped. The retained observer and fresh terminal run/job reconciliation agree. The same run passed the unmarked startup group: 14 files / 228 cases, including both post-ready cases; its tested merge tree equals this candidate. Prior whole-app artifacts remain historical.

Historical CI and limits

The previous unmarked F run passed all 14 startup files / 228 cases, including both post-ready cases. Its only substantive failure was the inherited memory maintenance stopwatch assertion; this carry preserves the canonical #150098 / #150090 repair unchanged. No contention replay or timeout/assertion change was added here.

All six temporary diagnostic markers remain absent, and the canonical #149835 real-timer fixture is unchanged. The earlier marked pass did not establish the original 120-second timeout cause. The historical published-driver cell executed frozen F63, not this package or its current worker/schema/dependency inputs.

No new upgrade, native-fault, held-process, provider or startup-diagnostic replay ran locally. This cut adds no schema, retention, configuration option or cancellation policy and makes no whole-operation/non-admin SQL-zero or broader migration-completion claim.

@clawsweeper

clawsweeper Bot commented Sep 14, 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 agents Agent runtime and tooling size: M maintainer Maintainer-authored PR labels Sep 14, 2026
@steipete
steipete marked this pull request as ready for review September 14, 2026 22:49
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. 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 14, 2026
@clawsweeper

clawsweeper Bot commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 16, 2026, 1:38 PM ET / 17:38 UTC (Revision 20).

ClawSweeper review

What this changes

Moves Gateway task-list preparation onto the existing asynchronous storage owner, bounds projection retries, and adds ownership and pagination regression coverage.

Merge readiness

✅ Ready for maintainer review

Keep open: current main still prepares task pages synchronously, and this maintainer-sponsored change remains useful. No actionable introduced defect was found.

Priority: P2
Reviewed head: d1edd90fc639e05a1c3c93c9f7f6feae7a3323ed

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused implementation with meaningful regression coverage, successful current-head CI, and no actionable findings.
Proof confidence 🌊 off-meta tidepool Not applicable: The external-contributor proof gate does not apply to this maintainer-authored PR. The captured evidence exercises persisted admin task pagination through the real handler and worker close; broader upgrade evidence remains historical, and no unresolved authority-boundary change requires an additional proof gate.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The external-contributor proof gate does not apply to this maintainer-authored PR. The captured evidence exercises persisted admin task pagination through the real handler and worker close; broader upgrade evidence remains historical, and no unresolved authority-boundary change requires an additional proof gate.
Evidence reviewed 8 items Introduced scope and clean checkout: The pinned base-to-head delta matches the seven supplied paths. Production changes concern task preparation and ownership checks; no schema, package, workflow, public protocol, or configuration change is introduced. Diff whitespace checks passed and the checkout remained clean.
Current main still needs the conversion: Current main's page reader calls synchronous ensureTaskRegistryReady before scanning; it does not carry the proposed captured context and store through asynchronous preparation.
Latest release comparison: The GitHub contents API for the supplied v2026.9.4 release commit also shows synchronous task-page preparation. The initial local release-blob read failed; the API read supplied the source comparison.
Findings None None.
Security None None.

How this fits together

The Gateway task-list endpoint turns stored background-task records into ordered, access-filtered summaries for clients. The task registry prepares those records through its SQLite worker before pagination and final response checks.

flowchart TD
  A[Task list request] --> B[Capture storage owner]
  B --> C[Prepare registry through SQLite worker]
  C --> D[Bounded page selection]
  D --> E[Recheck owner and session access]
  E --> F[Task summaries and cursor]
  D --> G[Retry or refresh response]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +25, Tests +297. Total +322 across 7 files.

View PR surface stats
Area Files Added Removed Net
Source 3 35 10 +25
Tests 4 321 24 +297
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 7 356 34 +322

Review metrics

Metric Value Why it matters
Production versus test growth Production net +25 lines; tests and test support net +297 lines Production growth implements captured ownership and bounded preparation; most added code exercises invalidation, pagination, and publication behavior.

Root-cause cluster

Relationship: partial_overlap
Canonical: #144592
Summary: This PR implements the Gateway pagination portion of the broader asynchronous-storage effort.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Technical review

Best possible solution:

Keep task-page preparation with the existing worker-backed registry while preserving bounded retries, pending-write settlement, and fresh authorization before responses.

Do we have a high-confidence way to reproduce the issue?

Not applicable as a standalone bug report: this is an internal storage refactor, and current source confirms the synchronous preparation path it replaces.

Is this the best way to solve the issue?

Yes. Reusing the existing preparation and publication owners is a narrow solution that preserves public task APIs and avoids a competing storage path.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 35a59d632fac.

Labels

Label justifications:

  • P2: This is a bounded Gateway responsiveness and storage-ownership improvement without evidence of an urgent user-facing outage.
  • 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 external-contributor proof gate does not apply to this maintainer-authored PR. The captured evidence exercises persisted admin task pagination through the real handler and worker close; broader upgrade evidence remains historical, and no unresolved authority-boundary change requires an additional proof gate.

Evidence

What I checked:

  • Introduced scope and clean checkout: The pinned base-to-head delta matches the seven supplied paths. Production changes concern task preparation and ownership checks; no schema, package, workflow, public protocol, or configuration change is introduced. Diff whitespace checks passed and the checkout remained clean. (d1edd90fc639)
  • Current main still needs the conversion: Current main's page reader calls synchronous ensureTaskRegistryReady before scanning; it does not carry the proposed captured context and store through asynchronous preparation. (src/tasks/task-registry-query.ts:185, 35a59d632fac)
  • Latest release comparison: The GitHub contents API for the supplied v2026.9.4 release commit also shows synchronous task-page preparation. The initial local release-blob read failed; the API read supplied the source comparison. (src/tasks/task-registry-query.ts, 3a9d69db306c)
  • Bounded preparation preserves publication: Each page attempt requests one projection-preparation attempt. Default preparation callers remain unbounded, while the shared restoration helper preserves pending mutation scopes. The new converging/exhausted cases check both page outcomes and eventual publication. (src/tasks/task-registry-state.ts:383, d1edd90fc639)
  • Final response and access boundary: The handler retains its access-revision comparison and fresh selected-row authorization, then checks storage ownership before responding. Existing access tests cover revocation during yielded selection. All page-reader callers found in source pass the new internal parameters; no plugin SDK export was found. (src/gateway/server-methods/tasks.ts:230, d1edd90fc639)
  • Validation identity and limits: The live API confirms https://github.com/openclaw/openclaw/actions/runs/35124969109 completed successfully for the reviewed head. The captured PR body reports persisted-row admin pagination through worker close with six zero parent-SQL counters. Its test invokes the real handler and SQLite owner, but is not a full client session. The published-driver evidence in chore: cover worker state in published upgrade tests #149487 remains bound to its older candidate. No tests or target code were executed during this review. (src/gateway/server-methods/tasks.test.ts:48, d1edd90fc639)

Likely related people:

  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; 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.

History

Review history (19 earlier review cycles; latest 8 shown)
  • reviewed 2026-09-16T05:29:00.447Z sha a2e3e99 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-16T08:57:25.946Z sha a2e3e99 :: needs changes before merge. :: none
  • reviewed 2026-09-16T10:08:27.840Z sha a6c7457 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-16T11:48:00.536Z sha aa4d804 :: blocked before merge. :: none
  • reviewed 2026-09-16T14:27:52.559Z sha aa4d804 :: blocked before merge. :: none
  • reviewed 2026-09-16T14:40:03.627Z sha 2e019f2 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-16T15:54:16.301Z sha 2e019f2 :: needs changes before merge. :: none
  • reviewed 2026-09-16T17:01:22.202Z sha d1edd90 :: needs maintainer review before merge. :: none

@steipete
steipete marked this pull request as draft September 15, 2026 14:20
@steipete
steipete marked this pull request as ready for review September 15, 2026 14:28
Preserve the focused task paging and continuation checks while integrating complete current-main and restored-flow ancestry. Source review, quick guards and admin paging pass; remaining canonical qualification and committed build are pending on this private checkpoint.
Preserve the exact reviewed eight-file paging and continuation delta on the actual media parent. Prior F edit review is bound to identical before/after blobs and binary patch; changed upstream owners have current C/E review. Fresh quick guards pass. Current-head runtime, canonical qualification and isolated normal build remain pending.
@steipete
steipete marked this pull request as draft September 16, 2026 04:46
@clawsweeper clawsweeper Bot removed the proof: sufficient ClawSweeper judged the real behavior proof convincing. label Sep 16, 2026
@steipete
steipete marked this pull request as ready for review September 16, 2026 05:21
@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label Sep 16, 2026
@steipete
steipete marked this pull request as draft September 16, 2026 08:47
Carry the focused paging and continuation changes onto the current owner graph. Each existing page attempt now spends one bounded projection attempt; epoch churn reaches the existing registry_changed response without cancelling pending mutation settlement. Default preparation callers remain unchanged. The finite regression failed on original code and thirteen controlled cases pass after repair. Fresh scoped source review and quick guards pass; full canonical types, ordinary flows and committed build remain pending.
@steipete steipete closed this Sep 16, 2026
@steipete steipete reopened this Sep 16, 2026
@steipete
steipete marked this pull request as ready for review September 16, 2026 09:57
@clawsweeper clawsweeper Bot removed the proof: sufficient ClawSweeper judged the real behavior proof convincing. label Sep 16, 2026
Add six temporary synthetic checkpoint labels for the unresolved hosted close timeout. Preserve existing awaits, timers, assertions and cleanup. Remove the diagnostic markers before final landing; this commit does not repair or explain the timeout.
@steipete
steipete marked this pull request as draft September 16, 2026 11:40
@steipete
steipete marked this pull request as ready for review September 16, 2026 11:41
Inherit the complete current parent and its media continuation guards. Remove temporary startup checkpoint markers while preserving the incoming real-timer fixture. Reuse the existing projection publication helper so synchronous and asynchronous restoration retain the same pending scopes. Full current-head qualification remains separate from this reviewed private source checkpoint.
Preserve the complete final parent graph and both task-query control groups. The query-test merge unions imports without changing existing case bodies; task paging production changes remain identical to the reviewed seven-file checkpoint. Full committed-head qualification is recorded separately.
@steipete
steipete marked this pull request as draft September 16, 2026 14:20
@steipete
steipete marked this pull request as ready for review September 16, 2026 14:32
@steipete
steipete marked this pull request as draft September 16, 2026 15:47
@steipete
steipete marked this pull request as ready for review September 16, 2026 16:55
@steipete

Copy link
Copy Markdown
Contributor Author

Closing as superseded by #152655 (merge 5bc6dc83255), with the subsequent scan-budget correction in #153328 (merge 4df45070ba7). Gateway task pagination already awaits the canonical asynchronous task-read owner on main.

Read preparation joins the accepted-write fence and registry readiness, validates the captured owner, and bounds projection preparation. Page selection preserves revision retries; its returned currentness check validates the selected identities before the Gateway response. Ordering, pagination bounds, sharing checks, stale-cursor handling, and retryable UNAVAILABLE behavior remain with their existing owners. The old stacked implementation is therefore unnecessary.

@steipete steipete closed this Sep 20, 2026
@RomneyDa
RomneyDa deleted the codex/async-gateway-task-page-stack-20260914 branch October 22, 2026 00:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling 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: M 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