Skip to content

refactor(tasks): separate committed publication from flow persistence - #144593

Merged
steipete merged 1 commit into
mainfrom
codex/async-task-owner-preparation
Sep 11, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/async-task-owner-preparation

Conversation

@steipete

Copy link
Copy Markdown
Contributor

Related: #144592

What Problem This Solves

Committed task publication also initiated flow persistence unless callers supplied a suppression option. That hidden write makes the publication boundary unsuitable for the ongoing asynchronous storage conversion and obscures which owner controls persistence.

Why This Change Was Made

Move committed task mirror/index/observer publication into its own owner. Completion now explicitly preserves the existing sequence: publish the task mirror, synchronize its flow with the existing failure/retry behavior, then emit task observers. Atomic replacement publishes its already-committed flow directly and no longer needs the suppression option. SQLite transaction boundaries and runtime behavior are unchanged.

This is a prerequisite for #144592; task/flow storage and SDK APIs are not yet fully asynchronous.

User Impact

No user-visible behavior or persisted-format change. Storage ownership is explicit, allowing later async orchestration to keep database work outside synchronous post-commit publication callbacks.

Evidence

  • All 87 focused native-store tests passed before and after; full check:changed passed.
  • Independent Codex review through P2 found no actionable issues.
  • A standalone synthetic SQLite smoke exercised real task creation, atomic subagent replacement, correlated completion admission, deferred task publication, and fresh-process restore. Observers saw matching durable and memory state; pure publication did not rewrite the flow (revision stayed 3). No model or channel service was used.
  • The native smoke writer/reopen processes completed in 6.20/4.06 seconds including imports; these are proof timings, not a performance comparison.

@clawsweeper

clawsweeper Bot commented Sep 11, 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 agents Agent runtime and tooling size: S maintainer Maintainer-authored PR labels Sep 11, 2026
@steipete
steipete marked this pull request as ready for review September 11, 2026 02:42
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. 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 11, 2026
@clawsweeper

clawsweeper Bot commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 10, 2026, 10:48 PM ET / September 11, 2026, 02:48 UTC (Revision 2).

ClawSweeper review

What this changes

Separates publication of committed task state from flow persistence, making completion explicitly synchronize its flow before notifying observers.

Merge readiness

✅ Ready for maintainer review

The refactor remains useful for the linked storage work and is not present on fetched main. No actionable regression was found; the prior review’s empty finding list remains appropriate.

Priority: P3
Reviewed head: 16bd7d126e083d681670b19e38978cb3ffd3bdad

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, coherent refactor with preserved caller ordering and relevant reported SQLite validation; no blocking defect was found.
Proof confidence 🌊 off-meta tidepool Not applicable: The maintainer-authored internal refactor is exempt from the external contributor proof gate. Its supplied SQLite smoke addresses the changed publication boundary through replacement, completion, observer consistency, and restart readback; this review did not rerun it.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The maintainer-authored internal refactor is exempt from the external contributor proof gate. Its supplied SQLite smoke addresses the changed publication boundary through replacement, completion, observer consistency, and restart readback; this review did not rerun it.
Evidence reviewed 7 items Pinned introduced change: The locally inspected merge-base-to-head diff matches the supplied introduction evidence. It extracts publication, updates both production callers, and changes the existing test import without altering transaction bodies.
Completion ordering and retry preserved: Completion publishes the task mirror, invokes the existing flow synchronization and retry owner, then emits deferred task observers. Flow synchronization reads the supplied task without mutating it, so passing the returned clone preserves the relevant values.
Complete internal caller cutover: Repository search found two production publication callers: completion admission and atomic replacement. Replacement still commits the task and flow together, publishes both mirrors, and then releases observer events. The facade explicitly identifies this as internal runtime surface, not public SDK API.
Findings None None.
Security None None.

How this fits together

OpenClaw tracks background tasks and their parent flows in SQLite and in-memory registries. After completion or replacement commits, publication refreshes those registries and notifies observers.

flowchart TD
  A[Completion or replacement] --> B[SQLite transaction]
  B --> C[Publish task mirror and indexes]
  C --> D{Operation}
  D -->|Completion| E[Synchronize parent flow]
  D -->|Replacement| F[Publish committed flow]
  E --> G[Notify observers]
  F --> G
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +22, Tests +1. Total +23 across 6 files.

View PR surface stats
Area Files Added Removed Net
Source 5 70 48 +22
Tests 1 2 1 +1
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 6 72 49 +23

Review metrics

None.

Technical review

Best possible solution:

Keep committed publication free of flow persistence while preserving explicit completion synchronization and atomic replacement ordering.

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

Not applicable: this is an internal refactor rather than a reported user-facing defect; source inspection confirms the implicit flow write it separates.

Is this the best way to solve the issue?

Yes. Moving the existing implementation and making its two callers explicit removes the suppression option without introducing competing persistence logic or changing stored data.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P3: This is a bounded internal ownership refactor with no intended user-visible behavior, configuration, or persisted-format change.
  • 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 maintainer-authored internal refactor is exempt from the external contributor proof gate. Its supplied SQLite smoke addresses the changed publication boundary through replacement, completion, observer consistency, and restart readback; this review did not rerun it.

Evidence

What I checked:

  • Pinned introduced change: The locally inspected merge-base-to-head diff matches the supplied introduction evidence. It extracts publication, updates both production callers, and changes the existing test import without altering transaction bodies. (src/tasks/task-registry-publication.ts:23, 16bd7d126e08)
  • Completion ordering and retry preserved: Completion publishes the task mirror, invokes the existing flow synchronization and retry owner, then emits deferred task observers. Flow synchronization reads the supplied task without mutating it, so passing the returned clone preserves the relevant values. (src/agents/subagents/completion/subagent-completion-admission.store.ts:70, 16bd7d126e08)
  • Complete internal caller cutover: Repository search found two production publication callers: completion admission and atomic replacement. Replacement still commits the task and flow together, publishes both mirrors, and then releases observer events. The facade explicitly identifies this as internal runtime surface, not public SDK API. (src/agents/subagents/registry/subagent-registry-replacement-store.ts:122, 16bd7d126e08)
  • Still absent from fetched main: Fetched main retains the publication function in the mutation module and implicitly synchronizes flows unless suppressed. The extracted publication file is absent from both fetched main and the supplied latest release tag v2026.9.3; no merged replacement was established. (src/tasks/task-registry-mutation.ts:236, d6997b6bbf2e)
  • Existing behavior coverage: The session-index test retains its create/update/restore/publication/delete assertions. Existing replacement coverage checks SQLite write rejection, matching observer snapshots, and restored task/flow state. These tests were inspected, not executed during this read-only review. (src/agents/subagents/registry/subagent-registry-task-replacement.test.ts:269, 16bd7d126e08)
  • Accepted work context and supplied proof: The captured PR body identifies this as a prerequisite for Complete asynchronous runtime storage boundaries while retaining SQLite #144592, which remains open and explicitly calls for task/flow publication ownership cleanup. It reports 87 passing focused tests and a synthetic real-SQLite smoke covering replacement, completion admission, deferred publication, and fresh-process restore, including an unchanged flow revision during pure publication. These are contributor-reported observations, not reviewer execution. (16bd7d126e08)

Likely related people:

  • steipete: 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 (1 earlier review cycle)
  • reviewed 2026-09-11T02:42:02.508Z sha 16bd7d1 :: needs maintainer review before merge. :: none

@steipete
steipete merged commit aff555a into main Sep 11, 2026
249 checks passed
@steipete
steipete deleted the codex/async-task-owner-preparation branch September 11, 2026 03:52
@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

agents Agent runtime and tooling maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. 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