Skip to content

fix(gateway): preserve task pages during session metadata edits - #137975

Merged
steipete merged 4 commits into
mainfrom
codex/team-task-access-revision-20260904
Sep 7, 2026
Merged

steipete merged 4 commits into
mainfrom
codex/team-task-access-revision-20260904

Conversation

@steipete

@steipete steipete commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

Related: #141001, #137966.

Maintainer edits

This same-repository branch remains editable by maintainers.

What Problem This Solves

Fixes an issue where users loading Tasks would lose their pagination position or receive “Task activity did not stabilize” while another client only changed an existing session’s label or category.

Why This Change Was Made

The committed session-patch owner now distinguishes display changes on the same canonical session generation from changes to read access. Metadata edits still refresh session rows, sharing snapshots, list projections, and notifications; they preserve the access revision used by task cursors. Creation, missing generations, replacement, canonical moves, removed aliases, creator changes, visibility changes, and incognito changes remain conservative. Explicit sharing changes, role changes, profile-alias changes, and final row authorization retain their existing fences.

The access-change fact stays internal and never enters an RPC or event payload. Current main’s patch admission, catalog preparation, authorization errors, diagnostics, and task-query behavior are preserved. No schema, configuration, dependency, or public protocol change is included.

User Impact

Task pages remain usable during label and category updates without repeating scans for those display-only changes. Actual task activity and access changes can still require fresh pagination. This complements #141001’s earlier exit for an already-invalid task cursor; it does not claim to eliminate unrelated Gateway stalls.

Evidence

Current head: d17bc69fae528b13ba9897587b1136239d72fdd2. Original head 2c73864f9eb66c1b300ad4fb12f59aa07c5088e6 is preserved in its ancestry; main fe2f796e95e87773bdd2e038f45aa6191acff66e was integrated through a merge. The remote branch update is a fast-forward.

Current validation is complete: exact-head CI run 34152080784 is green with no requested rerun, and the corrected isolated comparison below passed all eight required stages. The historical local timeout and first comparison’s lost detailed capture remain retained and qualified; they are not rewritten as successful results.

  • Fresh-main regression: the authenticated Gateway WebSocket fixture fails at the intended next-page assertion after a committed label/category patch, returning INVALID_REQUEST with restart-pagination guidance. The test takes 17.066 seconds; wrapper time, including cold transforms, is 80.188 seconds.
  • Before the setup-order follow-up, the candidate metadata case passed in a fresh process namespace, preserving the exact next-page IDs during label/category changes and metadata churn. Creating a previously missing requester still invalidates its old cursor and makes its task visible on a fresh page. Actual test time is 18.358 seconds; wrapper time is 182.09 seconds. These timings do not establish an overall latency improvement.
  • The initial ten-file candidate run completed 75 passing tests across eight files, covering creator namespaces and profile aliases, role ceilings, membership freshness, incognito restrictions, patch ownership/catalog revalidation, task access, and event/cache behavior. The whole run failed, as described below; its following metadata case was skipped and is not counted as a pass.
  • The complete changed-file gate passes: production and core-test types, all three dead-export scans, lint/formatting, runtime cycles, database-first storage, and the applicable owner guards.
  • Independent cumulative Codex P0–P2 review returned no actionable findings. A subsequent independent P0–P2 review of the test relocation was also clean. Production source bytes remained unchanged through the relocation.
  • The original 10,000-task performance case retains its operations, assertions, and 60-second deadline. Shared authenticated Gateway setup was extracted for reuse; a follow-up restores task-registry initialization before client connection, matching original main. Both assertion suffixes are byte-identical to the prior candidate. The new metadata regression lives in the existing server-test subtree to stay within the unchanged 720-root type-shard limit; it retains the same non-isolated, serial Gateway-server Vitest project. Its executable body is byte-identical after relocation, and all eight relative imports resolve to their original targets.

Corrected isolated Linux comparison: passed

Blacksmith Testbox run 34152374111 compared baseline fe2f796e95e87773bdd2e038f45aa6191acff66e with candidate d17bc69fae528b13ba9897587b1136239d72fdd2 in separate detached worktrees within one frozen invocation. All eight required install/build/test/Gateway stages passed. Both complete raw-source manifests were independently rehashed from local Git blobs (39,266 baseline files and 39,268 candidate files), matching all ten remote phase receipts. Build stamps and the actual CLI entrypoints matched their source commits.

The ordinary, separately launched Gateway fixtures completed 23 RPCs each against 25 persisted synthetic tasks. Baseline returned the expected expired-cursor error after committed label/category updates; candidate continued the same cursor with exactly task-007 through task-013. Both preserved session identity and lifecycle generation, refreshed metadata projections, denied the read-only viewer’s write, verified fresh membership, invalidated cursors for membership/visibility/requester creation, and returned the expected final task IDs. Both Gateway owners joined, and both proof processes exited naturally with code 0.

The original 10,000-task performance test passed in 12.252 seconds on baseline. Candidate passed that unchanged case in 11.230 seconds, then the metadata regression in 1.096 seconds, in the required serial performance→metadata order. Both test declarations retain their 60-second deadlines. These focused fixture timings do not establish general Team latency or the historical timeout’s cause.

Required artifact collection succeeded within the unchanged 10 MiB limit: 6,370,630 bytes for the inner evidence archive, SHA-256 b0353107f064c605fb5f81e9ea1158051edb0f9e66c523109ce34704c3e4ed31. All 149 archive entries were recovered. A separate external result-portal synchronization timed out; native proof execution, process-closure verification and required artifact retrieval succeeded. The exact kept lease was stopped after both independent inspections and is verified completed. That lifecycle result is separate from the successful proof command; the hosting workflow is not presented as CI-green.

Retained local failure

The original 10,000-task performance case exceeded its unchanged 60-second limit, reporting 60.122 seconds. The following metadata file correctly refused to replace test state while that Gateway fixture remained open. The runner retained its worker generation and temporary resource-ownership claim. The combined result was one failed test, 75 passed, one skipped; two failed files and eight passed, with exit 1. No deadline, assertion, fixture-lifetime guard, or retention result was weakened. Standalone metadata success does not convert this ordered run into a pass, and the timeout’s cause is not established.

Earlier isolated Linux comparison: failed/partial

Blacksmith Testbox run 34147263496 used the sealed baseline fe2f796e95e87773bdd2e038f45aa6191acff66e and candidate 0523a655793d9910d7375880cb5a12ef507e1312 in separate detached worktrees. Recorded full-build exits passed for both sources (208.511 and 226.503 seconds), and the baseline's unchanged original 10,000-task performance test passed as one test in 23.424 seconds. The candidate ordered-test command failed at startup in 0.896 seconds; the separate baseline/candidate 25-task Gateway fixtures failed in 9.483/10.724 seconds. This is not candidate behavioral acceptance.

Artifact collection then failed before native lease cleanup. The lease is confirmed completed; its backing Actions job was cancelled during cleanup and is not represented as green CI. The completed lease's detailed source manifests, test logs, Gateway responses/state and failure messages were not recovered. The retained local seven-file failure bundle contains stage summaries and the generated archive hash, not the missing detailed evidence. Neither successful stage summaries nor current CI substitute for that capture.

Two proof-harness defects are established independently. The pinned Vitest CLI retains sequence.sequencer as a string while its pool requires a constructor; the external configuration must supply the imported class. Separately, reproducing the ten deterministic source-manifest copies from immutable Git blobs yields a 28.9 MB compressed archive before runtime evidence, exceeding native collection's unchanged 10 MiB limit. One canonical manifest per revision with every phase's hash receipt reduces that portion to 5.8 MB without removing verification. These transport/configuration corrections were verified before the retained diagnostic below. The first comparison’s detailed Gateway failure remains unavailable; the later diagnostic establishes its own concrete configuration failure without retroactively claiming recovered logs for the first run.

Before the new full comparison, the standalone Gateway fixture received bounded redacted diagnostics on a retained isolated lease, as described below. Required proof remains the same: exact task IDs, metadata persistence, write denial, membership/visibility/creation fences, the original performance→metadata execution order and existing deadlines, complete source/build identity, and verified process closure. No provider or production Gateway operation is part of this work. All failed runs and original seals remain recorded.

Follow-up fixture repairs and current local proof

The candidate-only diagnostic run 34150367657 recovered all 99 artifact entries, complete source and build identities, the Gateway startup log, and natural fixture closure. The Gateway correctly rejected a conflicting synthetic authentication configuration: the test-instance helper supplied a shared token, while the standalone proof selected trusted-proxy mode without clearing that token. No authenticated request or pagination check ran. The external proof now explicitly clears the helper token; configuration-only validation confirms the serialized token is absent. Authentication behavior and assertions are unchanged. The lease is verified completed. This diagnosis directly covers the retained diagnostic; detailed logs from the earlier first comparison remain unavailable.

Separately, source comparison found that extracting the shared authenticated fixture had moved task-registry initialization after the clients connected. Commit d17bc69fae528b13ba9897587b1136239d72fdd2 restores original main’s pre-connection initialization in three test/helper files (+9/−4), with no production change. It does not establish that this ordering difference caused the historical timeout.

The exact performance→metadata order now passes locally: the unchanged 10,000-task case takes 22.648 seconds, followed by the metadata regression in 2.274 seconds, with wrapper exit 0 and verified worker cleanup. The complete changed-file gate passes, including core-test types, all three dead-export scans and lint. Fresh independent P0–P2 review of this test-only adjustment is clean. The historical failure remains retained; the fully sealed comparison reported above now confirms recovery of the original ordered workload and the ordinary-request contract on this candidate.

Historical proof retained

The earlier source at base c86d5b2 plus the original patch had a real Gateway pre-fix reproduction and candidate cursor/creation proof. A source-verified Linux run passed 113 tests across 11 files, including the unchanged 10,000-task case in 16.978 seconds: 33839191012. Its later response-only cleanup passed 38 focused tests. Separate original-source runs passed the canonical export scans 33840867611 and remaining static guards 33842406239. Earlier local deadline and teardown failures remain retained. None of these historical runs is current-head acceptance.

The latest ClawSweeper review at 18:39 UTC on September 7 inspected this d17bc69 head and identified no introduced correctness or security defect. Both P2 validation requests are addressed by the independently inspected full comparison and recorded current-head CI above. The current original workload recovered with unchanged deadlines; the earlier local timeout’s cause remains unknown, and the first remote comparison’s detailed diagnostics remain unrecovered. No causal attribution or retroactive pass is claimed.

Production delta against the integrated main base: +65/−13, net +52 lines. Tests and shared fixtures: +774/−527, net +247 lines. Documentation: one paragraph updated. The larger test diff primarily moves shared setup while preserving the newer main assertions.

@clawsweeper

clawsweeper Bot commented Sep 4, 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: XL maintainer Maintainer-authored PR labels Sep 4, 2026
@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 4, 2026
@clawsweeper

clawsweeper Bot commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 7, 2026, 3:05 PM ET / 19:05 UTC.

ClawSweeper review

What this changes

Preserves task pagination during session metadata edits while retaining access-change invalidation, adds Gateway regression coverage, and documents the behavior.

Merge readiness

✅ Ready for maintainer review

This remains a useful fix absent from current main. No actionable introduced defect was found, and the updated comparison addresses the previous validation request. Maintainer authorship and the protected label also preclude cleanup closure.

Priority: P2
Reviewed head: d17bc69fae528b13ba9897587b1136239d72fdd2

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused owner-level repair with convincing reported before/after Gateway evidence and no actionable correctness finding.
Proof confidence 🦞 diamond lobster (5/6) ✨ media proof bonus Sufficient (linked_artifact): The captured Linux comparison exercises committed session patches and task continuation through ordinary authenticated Gateway RPCs on the reviewed head, reports the exact successful next-page IDs, and covers denied writes and access-change invalidation. The linked archive could not be independently retrieved in this review.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (linked_artifact): The captured Linux comparison exercises committed session patches and task continuation through ordinary authenticated Gateway RPCs on the reviewed head, reports the exact successful next-page IDs, and covers denied writes and access-change invalidation. The linked archive could not be independently retrieved in this review.
Evidence reviewed 11 items Introduced change identity: Reviewed the pinned merge-base-to-head changes. The checkout matches the original PR head; the supplied stale test merge was not used to infer removal of current-main behavior.
Committed access classification: The mutation owner compares the captured and projected session generation, profile creator, visibility, and incognito state; canonical moves and removed aliases remain conservative. Existing commit-time snapshot and authorization guards remain in place.
Invalidation and final authorization preserved: Both production callers of sharing-cache invalidation retain access-revision advancement unless the committed patch explicitly certifies unchanged access. Task responses still refresh selected-row authorization synchronously after the asynchronous scan; role and profile-alias revisions remain independent fences.
Findings None None.
Security None None.

How this fits together

The Gateway serves task pages to OpenClaw clients and checks access through each task’s requesting session. Session mutations refresh displayed metadata and determine whether saved pagination cursors must expire.

flowchart TD
  A[Session edit] --> B[Commit session mutation]
  B --> C{Read access changed?}
  C -->|Yes or uncertain| D[Advance access revision]
  C -->|No| E[Preserve task cursor]
  B --> F[Refresh session projections]
  D --> G[Task page authorization]
  E --> G
  G --> H[Authorized page or restart guidance]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +52, Tests +247, Docs 0. Total +299 across 11 files.

View PR surface stats
Area Files Added Removed Net
Source 6 65 13 +52
Tests 4 774 527 +247
Docs 1 1 1 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 11 840 541 +299

Review metrics

Metric Value Why it matters
Production versus regression support Production net +52 lines; tests and fixtures net +247 lines Production growth carries the committed access-change fact; most test churn extracts shared setup while preserving existing workload coverage.

Technical review

Best possible solution:

Keep metadata projection refresh separate from task-access invalidation while preserving current authorization checks and conservative handling of unknown session generations.

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

Yes: obtain a task cursor, commit a session label/category edit, then request the next page. Current-main source unconditionally advances the cursor’s access revision; the captured baseline report confirms the resulting restart error.

Is this the best way to solve the issue?

Yes: classifying committed access facts at the mutation owner avoids unnecessary cursor expiry without adding configuration, changing stored formats, or weakening final authorization.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient. The captured Linux comparison exercises committed session patches and task continuation through ordinary authenticated Gateway RPCs on the reviewed head, reports the exact successful next-page IDs, and covers denied writes and access-change invalidation. The linked archive could not be independently retrieved in this review.

Label justifications:

  • P2: Repairs task-pagination disruption during ordinary session metadata edits with a bounded Gateway change.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (linked_artifact): The captured Linux comparison exercises committed session patches and task continuation through ordinary authenticated Gateway RPCs on the reviewed head, reports the exact successful next-page IDs, and covers denied writes and access-change invalidation. The linked archive could not be independently retrieved in this review.
  • proof: sufficient: Contributor real behavior proof is sufficient. The captured Linux comparison exercises committed session patches and task continuation through ordinary authenticated Gateway RPCs on the reviewed head, reports the exact successful next-page IDs, and covers denied writes and access-change invalidation. The linked archive could not be independently retrieved in this review.

Evidence

What I checked:

  • Introduced change identity: Reviewed the pinned merge-base-to-head changes. The checkout matches the original PR head; the supplied stale test merge was not used to infer removal of current-main behavior. (d17bc69fae52)
  • Committed access classification: The mutation owner compares the captured and projected session generation, profile creator, visibility, and incognito state; canonical moves and removed aliases remain conservative. Existing commit-time snapshot and authorization guards remain in place. (src/gateway/server-methods/sessions-patch-engine.ts:562, d17bc69fae52)
  • Invalidation and final authorization preserved: Both production callers of sharing-cache invalidation retain access-revision advancement unless the committed patch explicitly certifies unchanged access. Task responses still refresh selected-row authorization synchronously after the asynchronous scan; role and profile-alias revisions remain independent fences. (src/gateway/server-methods/tasks.ts:232, d17bc69fae52)
  • Current main still needs the fix: The fetched main implementation still unconditionally advances the access revision inside sharing-cache invalidation, including metadata-only edits. (src/gateway/session-sharing-snapshot-cache.ts:90, c20600ad9394)
  • Latest release check: The supplied latest release, v2026.9.2, also contains unconditional access-revision advancement in the cache invalidator. (src/gateway/session-sharing-snapshot-cache.ts:90, 3928bad9badf)
  • Regression and preserved workload: The new authenticated Gateway regression checks exact continuation IDs after committed label/category changes and rejects an old cursor after requester creation. Inspection of the performance-test extraction found its existing assertions and 60-second deadline preserved. (src/gateway/server/__tests__/server.tasks-list-metadata.test.ts:27, d17bc69fae52)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Jason O'Neal: 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 (4 earlier review cycles)
  • reviewed 2026-09-04T06:26:29.478Z sha 2c73864 :: blocked before merge. :: none
  • reviewed 2026-09-07T17:24:40.837Z sha 0523a65 :: blocked before merge. :: none
  • reviewed 2026-09-07T18:09:25.506Z sha 0523a65 :: blocked before merge. :: none
  • reviewed 2026-09-07T18:39:47.851Z sha d17bc69 :: blocked before merge. :: none

Integrate the existing task access-revision repair with current main while retaining the current patch admission, authorization, diagnostics, and task query behavior. Metadata changes refresh projections without expiring access; canonical moves and authorization-relevant changes remain conservative. Preserve the newer task performance coverage through the shared fixture.
@openclaw-barnacle openclaw-barnacle Bot added the docs Improvements or additions to documentation label Sep 7, 2026
@steipete steipete changed the title perf(gateway): avoid task rescans for session metadata edits fix(gateway): preserve task pages during session metadata edits Sep 7, 2026
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Sep 7, 2026
Initialize each task registry after session seeding and before either authenticated client connects, preserving the original performance fixture order. Keep all assertions and deadlines unchanged.
@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Sep 7, 2026
@steipete
steipete merged commit afa2af6 into main Sep 7, 2026
187 of 189 checks passed
@steipete
steipete deleted the codex/team-task-access-revision-20260904 branch September 7, 2026 19:06
@steipete

steipete commented Sep 7, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label Sep 7, 2026
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 8, 2026
…claw#137975)

* perf(gateway): avoid task rescans for session metadata edits

* test(gateway): place task metadata proof in the server test shard

* test(gateway): preserve task fixture initialization order

Initialize each task registry after session seeding and before either authenticated client connects, preserving the original performance fixture order. Keep all assertions and deadlines unchanged.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation gateway Gateway runtime maintainer Maintainer-authored PR 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. size: XL 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