Skip to content

fix(tasks): keep session lists available during unrelated activity - #138738

Merged
steipete merged 1 commit into
mainfrom
codex/tasks-sparse-session-05a-20260904
Sep 5, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/tasks-sparse-session-05a-20260904

Conversation

@steipete

@steipete steipete commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes an issue where users opening a session’s background-task list can receive “Task activity did not stabilize” while unrelated tasks are active, even when the session has only one related task.

Why This Change Was Made

Session pages scanned the whole registry and yielded between batches, allowing unrelated activity to invalidate every attempt. They now select candidates from the existing in-memory related-session index, completed for requester, owner and child keys. Exact agent/session predicates, global cursor revisions and fresh authorization remain authoritative.

ACP generation discovery explicitly keeps its previous owner-or-child candidate set. Create, update, restore, atomic publication and deletion use the same index owner, with persistence succeeding before publication. No stored representation, SQLite schema/index, configuration or RPC contract changes.

Production changes are +27/−16 lines (net +11), including the ownership check needed to preserve ACP generation semantics. Tests add 255 lines; the assertion baseline shrinks by one after removing an unnecessary cast.

User Impact

Session task lists avoid scanning unrelated registry entries. Large candidate sets and global lists retain cooperative yielding and revision checks.

Evidence

  • Original-source reproduction: the sparse-session case failed; its dense fairness control and eight existing selector cases passed.
  • Linux: 98 tests passed across nine files, including real authenticated WebSocket Gateway requests, profile-merge/stale-cursor checks, requester-only colliding agent keys, failed-write publication, lifecycle restoration/deletion and ACP generation history.
  • All 30 canonical changed checks passed. The first gate correctly rejected the stale assertion allowance; lowering it from four to three resolved that failure without changing runtime or test source.
  • Independent Codex review found no actionable P0–P2 issues in the final eight-file diff.

The Gateway proof uses isolated synthetic task fixtures and real authorization/session storage. This is a deterministic correctness and scan-work reduction proof, not a production latency benchmark. Regression introduction is not attributed. Hosted exact-head CI remains a separate landing gate.

@clawsweeper

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

clawsweeper Bot commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 4, 2026, 8:57 PM ET / September 5, 2026, 00:57 UTC.

ClawSweeper review

What this changes

The PR uses the existing session index to select background tasks, maintains requester membership throughout the task lifecycle, and adds coverage for unrelated activity without changing pagination or access rules.

Merge readiness

✅ Ready for maintainer review

Keep open as a focused, still-needed fix: the pinned current main still scans unrelated tasks for session pages. No blocking introduced defect was found, and the maintainer-authored PR is protected from automatic cleanup.

Priority: P2
Reviewed head: 708519d06e72037c6fad46a004b1844f9f28ddda

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused owner-level repair with useful lifecycle, isolation, and Gateway regression coverage and no blocking finding; execution results remain author-reported.
Proof confidence 🌊 off-meta tidepool Not applicable: The external-contributor proof gate does not apply to this maintainer-authored internal query repair. The captured body reports after-fix Linux coverage through authenticated tasks.list WebSocket requests with synthetic records; the inspected harness reaches the production handler, but this review did not rerun it or verify a production latency benchmark.
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 internal query repair. The captured body reports after-fix Linux coverage through authenticated tasks.list WebSocket requests with synthetic records; the inspected harness reaches the production handler, but this review did not rerun it or verify a production latency benchmark.
Evidence reviewed 11 items Pinned patch identity and scope: The checkout matches the verified original head and its recorded parent. The introduced delta is limited to task indexing, regression coverage, and a shrink-only assertion allowance; unrelated base-branch changes were not attributed to this PR.
Current main still contains the failure mechanism: Session-filtered requests still iterate the entire task map, yield between batches, and reject attempts when the global registry revision changes. Continuous activity on an unrelated task can therefore exhaust retries even when only one task matches the requested session.
Canonical index lifecycle: The existing index now includes normalized requester, owner, and child keys. Creation, restoration, atomic publication, and deletion already use its shared helpers; updateTask now detects requester changes and still persists successfully before publishing new membership.
Findings None None.
Security None None.

How this fits together

OpenClaw’s task registry tracks background work for the session Tasks panel and the global task ledger. Gateway list requests select registry records, apply session and access checks, and return bounded task summaries.

flowchart TD
  A[Task creation and updates] --> B[Task registry and session index]
  C[Session or global list request] --> D[Select indexed or global candidates]
  B --> D
  D --> E[Filter and order bounded page]
  E --> F[Check revisions and current access]
  F --> G[Task summaries or retry response]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +11, Tests +255, Other 0. Total +266 across 8 files.

View PR surface stats
Area Files Added Removed Net
Source 4 27 16 +11
Tests 3 255 0 +255
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 1 1 0
Total 8 283 17 +266

Review metrics

Metric Value Why it matters
Production versus regression coverage Production +27/−16 (net +11); tests +255/−0; assertion allowance 4→3 The production increase replaces whole-registry selection with indexed lookup while explicitly preserving ACP generation scope; the remaining growth is regression coverage.

Technical review

Best possible solution:

Use the shared session index rather than another cache or retry layer, retaining exact access predicates, global cursor revisions, and ACP generation scope; the small production increase implements those boundaries.

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

Yes, from source: list a session with one matching task among 65 records while another task updates on each event-loop turn; current main yields through unrelated records and exhausts revision retries. The PR contains that regression scenario, but this review did not execute it.

Is this the best way to solve the issue?

Yes. Reusing the lifecycle-owned index repairs unnecessary scan work at its source without introducing per-session revision state, another cache, or more frontend retries; large candidate sets intentionally retain existing consistency safeguards.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 4012f13f27d4.

Labels

Label changes:

  • add P2: This fixes session task-list availability during unrelated activity without changing task execution, configuration, or public contracts.
  • 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 external-contributor proof gate does not apply to this maintainer-authored internal query repair. The captured body reports after-fix Linux coverage through authenticated tasks.list WebSocket requests with synthetic records; the inspected harness reaches the production handler, but this review did not rerun it or verify a production latency benchmark.

Label justifications:

  • P2: This fixes session task-list availability during unrelated activity without changing task execution, configuration, or public contracts.
  • 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 internal query repair. The captured body reports after-fix Linux coverage through authenticated tasks.list WebSocket requests with synthetic records; the inspected harness reaches the production handler, but this review did not rerun it or verify a production latency benchmark.

Evidence

What I checked:

  • Pinned patch identity and scope: The checkout matches the verified original head and its recorded parent. The introduced delta is limited to task indexing, regression coverage, and a shrink-only assertion allowance; unrelated base-branch changes were not attributed to this PR. (708519d06e72)
  • Current main still contains the failure mechanism: Session-filtered requests still iterate the entire task map, yield between batches, and reject attempts when the global registry revision changes. Continuous activity on an unrelated task can therefore exhaust retries even when only one task matches the requested session. (src/tasks/task-registry-query.ts:185, 4012f13f27d4)
  • Canonical index lifecycle: The existing index now includes normalized requester, owner, and child keys. Creation, restoration, atomic publication, and deletion already use its shared helpers; updateTask now detects requester changes and still persists successfully before publishing new membership. (src/tasks/task-registry-state.ts:346, 708519d06e72)
  • Candidate narrowing preserves selection contracts: Indexed candidates still pass status, agent, related-session, and prepared-access predicates. Global requests retain the full-map path, large scans retain cooperative yielding, and cursor revision checks remain unchanged. (src/tasks/task-registry-query.ts:187, 708519d06e72)
  • Authorization remains authoritative at response time: The Gateway rechecks the access revision and authorizes every selected row immediately before returning summaries. Index membership does not grant access; owner-facing readers also retain their exact owner and agent checks. (src/gateway/server-methods/tasks.ts:235, 708519d06e72)
  • ACP and sibling behavior preserved: The explicit owner-or-child predicate preserves the previous ACP generation candidate set despite broader index membership. Active-child detection, canonical backing resolution, ACP requester discovery, and session-reset cleanup retain their own child and ownership predicates. These are OpenClaw-owned registry semantics, not a Codex protocol dependency. (src/tasks/task-backing-authority.ts:123, 708519d06e72)

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.

@steipete steipete self-assigned this Sep 5, 2026
@steipete
steipete merged commit cb63dae into main Sep 5, 2026
184 checks passed
@steipete
steipete deleted the codex/tasks-sparse-session-05a-20260904 branch September 5, 2026 01:32
@steipete

steipete commented Sep 5, 2026

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: 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