Skip to content

fix: prevent queued conversation replies from switching storage - #146984

Merged
steipete merged 1 commit into
mainfrom
codex/swarm-conversation-merged
Sep 13, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/swarm-conversation-merged

Conversation

@steipete

Copy link
Copy Markdown
Contributor

Related: #130741. Builds on #146866, #146917 and #146927.

What Problem This Solves

Fixes conversation sends and turns losing their storage target or writing outside database admission when queued work waits while configuration or routing changes.

User Impact

Conversation replies keep their original storage destination, wait for conflicting writes, and recheck current routing and session authority before delivery. Public plugin options and persisted queue records remain unchanged.

Why This Change Was Made

Carry the captured physical database owner and resolved state root through private preparation and completion paths. Conversation writes use the existing per-agent admission owner, while the canonical delivery queue alone records queue custody. Session binding shares the existing patch implementation and checks authority again after waiting.

Evidence

Seven controlled regressions fail with the old consumers and pass with this change. The integrated runtime checks passed 366 distinct cases across nine files, including the real Gateway → message action → queue → synthetic transport path under held writers and state-root rotation. Subsequent affected tests and canonical changed checks passed after fixture corrections; the canonical proof combines an initial run and a recorded continuation.

The normal Worker, SDK and UI build, public/private SDK consumer checks, and isolated P0/P1 review passed. All public declaration bytes match after restoring the normal profile. The local build retains 192 unreferenced private declaration chunks; the final combined-source run will use a fresh normal build. These checks do not establish the separate, unchanged 500 ms Swarm target; final composed-source real-provider acceptance remains pending.

@clawsweeper

clawsweeper Bot commented Sep 13, 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.

@steipete
steipete marked this pull request as ready for review September 13, 2026 11:40
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime scripts Repository scripts size: XL maintainer Maintainer-authored PR labels Sep 13, 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 13, 2026
@clawsweeper

clawsweeper Bot commented Sep 13, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 13, 2026, 7:49 AM ET / 11:49 UTC.

ClawSweeper review

What this changes

Keeps conversation sends, turns, and delivery completion bound to their original storage while waiting for database writes, with regression coverage and storage documentation.

Merge readiness

✅ Ready for maintainer review

Keep open: this remains a useful repair beyond the related merged changes, and no introduced blocking defect was found. Maintainer authorship and the protected label also preclude cleanup closure.

Priority: P2
Reviewed head: 1450161f60b20de71ddc3f18c004bfb0700d0fac

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A coherent owner-level repair with meaningful regression coverage and no identified blocking defect.
Proof confidence 🌊 off-meta tidepool Not applicable: The external-contributor proof gate does not apply to this MEMBER-authored repair. Its reported Gateway-to-queue checks match the changed owners but use a synthetic transport; they are component coverage, not live-channel or broader Swarm acceptance.
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 MEMBER-authored repair. Its reported Gateway-to-queue checks match the changed owners but use a synthetic transport; they are component coverage, not live-channel or broader Swarm acceptance.
Evidence reviewed 11 items Verified review scope: The host verified the introduced delta from 4d48e9c to the reviewed head. Its test merge has the pinned base followed by this exact head as parents; unrelated endpoint drift was excluded.
Current main still needs the repair: Inspected main still performs the initial operation lookup directly and reconstructs the delivery store from current configuration instead of carrying the prepared scope.
Latest supplied release retains the older path: The v2026.9.4 source retains resolveConversationDeliveryStoreScope and the sender-owned markQueued callback; this repair is not established as shipped.
Findings None None.
Security None None.

How this fits together

Gateway conversation requests pass through shared message dispatch and a durable delivery queue before reaching a channel. Agent SQLite stores hold conversation operations and session bindings; queue completion records the delivery outcome.

flowchart TD
  A[Conversation request] --> B[Capture original storage]
  B --> C[Wait for database admission]
  C --> D[Check current route and session]
  D --> E[Durable delivery queue]
  E --> F[Channel transport]
  F --> G[Complete original conversation operation]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +265, Tests +943, Docs +7, Other +5. Total +1220 across 31 files.

View PR surface stats
Area Files Added Removed Net
Source 20 499 234 +265
Tests 9 1062 119 +943
Docs 1 7 0 +7
Config 0 0 0 0
Generated 0 0 0 0
Other 1 6 1 +5
Total 31 1574 354 +1220

Review metrics

Metric Value Why it matters
Production versus regression coverage Production net +265 lines; tests/support net +943; tooling net +5 Production growth carries private storage context through existing owners; most growth supplies contention, compatibility, and rejection coverage.

Technical review

Best possible solution:

Keep conversation persistence and settlement with the existing SQLite admission and delivery-queue owners, preserving captured storage and current authorization throughout the flow.

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

Yes, from source: hold the agent writer and rotate configuration or the state root while a conversation send advances into queue custody or completion. The inspected regressions model these boundaries; this review did not execute them.

Is this the best way to solve the issue?

Yes. Carrying private prepared storage through existing owners removes repeated target selection without adding a public API or persistent format, while preserving retry and authorization contracts.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P2: This repairs bounded conversation-delivery failures during database contention and storage changes without evidence of a widespread urgent outage.
  • 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 MEMBER-authored repair. Its reported Gateway-to-queue checks match the changed owners but use a synthetic transport; they are component coverage, not live-channel or broader Swarm acceptance.

Label justifications:

  • P2: This repairs bounded conversation-delivery failures during database contention and storage changes without evidence of a widespread urgent 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 MEMBER-authored repair. Its reported Gateway-to-queue checks match the changed owners but use a synthetic transport; they are component coverage, not live-channel or broader Swarm acceptance.

Evidence

What I checked:

  • Verified review scope: The host verified the introduced delta from 4d48e9c to the reviewed head. Its test merge has the pinned base followed by this exact head as parents; unrelated endpoint drift was excluded. (1450161f60b2)
  • Current main still needs the repair: Inspected main still performs the initial operation lookup directly and reconstructs the delivery store from current configuration instead of carrying the prepared scope. (src/infra/outbound/conversation-delivery.ts:154, 274df5be0729)
  • Latest supplied release retains the older path: The v2026.9.4 source retains resolveConversationDeliveryStoreScope and the sender-owned markQueued callback; this repair is not established as shipped. (src/infra/outbound/conversation-delivery.ts:154, 3a9d69db306c)
  • Captured storage and admitted completion: Conversation delivery carries its prepared scope into operation creation, queue custody, and reconciliation. Completion validates logical agent, physical owner, and path before entering the existing write-admission owner. (src/infra/outbound/delivery-completion.ts:81, 1450161f60b2)
  • Authority remains current: Recovery reads current configuration after write admission. Session binding retains the existing synchronous pre-commit assertion, and outbound attempts retain route authorization before entering channel delivery. (src/gateway/conversation-route-ownership.ts:330, 1450161f60b2)
  • Storage and compatibility regression coverage: The integrated test follows Gateway send through real message dispatch and queue owners to a synthetic transport, holds custody and settlement writers, rotates the state root, and checks one send plus original-store completion. Additional cases retain omitted/default and legacy locators and reject owner/path mismatches. These tests were inspected, not executed during this review. (src/infra/outbound/conversation-delivery.queue-admission.test.ts:184, 1450161f60b2)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Josh Avant: 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 dec9fe0 into main Sep 13, 2026
258 checks passed
@steipete
steipete deleted the codex/swarm-conversation-merged branch September 13, 2026 11:59
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Sep 13, 2026
* commit '4aff70f27016f9acf62d0acc19c8bd3592993e4c': (1537 commits)
  test: align plugin fixtures with current runtime contracts (#147000)
  refactor(browser): separate session tab tracking from cleanup (#146973)
  fix(tests): make systemd clock fixtures private (#146990)
  fix(linux): retire sleep guards when logind disconnects (#146046)
  refactor(matrix): share draft fallback delivery (#144840)
  fix(sessions): preserve cross-agent replies after reload (#146799)
  test(models): cover quota recovery during catalog discovery (#146708)
  fix(macos): recover browser sign-in when no browser opens (#146787)
  fix(process): prevent one-shot agents exiting while polling (#144268)
  fix(status): label the session inventory as stored (#146979)
  fix: avoid repeated background reads while loading chat (#146953)
  refactor(ui): narrow Skill Workshop proposal context (#146977)
  perf(sessions): keep cleanup responsive and reuse workers (#140897)
  fix(sessions): prevent stranded writers after abort and restart (#146792)
  refactor: reuse deferred owners in Gateway and infra fixtures (#146809)
  fix: prevent queued conversation replies from switching storage (#146984)
  test(ui): preserve nested failure summaries in CI logs (#146864)
  fix(test): respect process memory limits in local scheduling (#146298)
  fix: validate large media data URLs without regexp stack exhaustion (#146972)
  fix(ui): label model usage contributions as messages (#146735)
  ...
vincentkoc added a commit that referenced this pull request Sep 13, 2026
* commit '4aff70f27016f9acf62d0acc19c8bd3592993e4c': (30 commits)
  test: align plugin fixtures with current runtime contracts (#147000)
  refactor(browser): separate session tab tracking from cleanup (#146973)
  fix(tests): make systemd clock fixtures private (#146990)
  fix(linux): retire sleep guards when logind disconnects (#146046)
  refactor(matrix): share draft fallback delivery (#144840)
  fix(sessions): preserve cross-agent replies after reload (#146799)
  test(models): cover quota recovery during catalog discovery (#146708)
  fix(macos): recover browser sign-in when no browser opens (#146787)
  fix(process): prevent one-shot agents exiting while polling (#144268)
  fix(status): label the session inventory as stored (#146979)
  fix: avoid repeated background reads while loading chat (#146953)
  refactor(ui): narrow Skill Workshop proposal context (#146977)
  perf(sessions): keep cleanup responsive and reuse workers (#140897)
  fix(sessions): prevent stranded writers after abort and restart (#146792)
  refactor: reuse deferred owners in Gateway and infra fixtures (#146809)
  fix: prevent queued conversation replies from switching storage (#146984)
  test(ui): preserve nested failure summaries in CI logs (#146864)
  fix(test): respect process memory limits in local scheduling (#146298)
  fix: validate large media data URLs without regexp stack exhaustion (#146972)
  fix(ui): label model usage contributions as messages (#146735)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 14, 2026
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. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. scripts Repository scripts 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