Skip to content

fix(clickclack): drain discussion opens before shutdown - #151978

Merged
steipete merged 1 commit into
mainfrom
codex/clickclack-pending-worker
Sep 18, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/clickclack-pending-worker

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

ClickClack discussion recovery can block the Gateway thread, and stopping the service can return while accepted opens still create channels and persist state.

User Impact

Current hosts process pending discussion state off the Gateway thread. Stop and restart now wait for accepted discussion operations to finish. Existing room identity, recovery, idle polling, stored data, and configuration remain compatible; no migration is required.

Why This Change Was Made

Move the existing generation and pending-open namespace to worker-backed keyed operations. FIFO settlement and observed-row comparisons preserve replacement generations, while channel creation awaits durable quarantine and rechecks the current account, API endpoint, and active session. The existing binding → tombstone clear → matching generation clear recovery order remains intact.

The service closes admission and joins whole operations, including work that can enqueue channel mutations later and the final polling reassessment. Both registered cleanup paths return that completion. The declared OpenClaw 2026.9.4 host floor retains uninterrupted native mutations only when comparison capabilities are absent; available worker failures never fall back. Bindings, revocations, synchronous visibility, schemas, limits, and retention keep their existing owners and contracts.

Evidence

  • Reproduced premature shutdown and native generation-store selection through the actual service with isolated SQLite state. The empty-reconciliation polling regression also failed before its fix: three polls instead of one after external pending-state removal.
  • Full ClickClack suite: 441 tests passed. Final focused reruns passed 40 service-contract tests and 29 lifecycle/SQLite tests; these overlap the full suite. Coverage includes delayed persistence, queued stop/restart drainage, replacement-generation conflicts, credential and API-endpoint changes, worker failure without native replay, and recovery after reopening SQLite.
  • The complete changed gate passes, including production/test types, both lint batches, export and boundary guards, formatting, and import-cycle checks. No guard or baseline exceptions were added.
  • Two full builds passed during development. After the final lifecycle changes, the maintained external-plugin builder rebuilt all 92 plugin runtimes from current source. The ClickClack import profile also passed.
  • Independent P0–P2 review is scoped-clean. Proof uses isolated SQLite and the existing synthetic/local HTTP harnesses; no live service was changed.

Move pending discussion generation reads and mutations to the shared SQLite worker, preserving FIFO and conditional replacement checks. Recheck live creation authority after persistence waits and join accepted operations through recovery and timer reassessment before service retirement.

Retain the declared 2026.9.4 host compatibility path only when comparison capabilities are absent. Stored formats, limits, retention, bindings, revocations, and synchronous visibility remain unchanged.
@clawsweeper

clawsweeper Bot commented Sep 18, 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 docs Improvements or additions to documentation extensions: clickclack size: XL maintainer Maintainer-authored PR labels Sep 18, 2026
@steipete
steipete marked this pull request as ready for review September 18, 2026 17:10
@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 18, 2026
@clawsweeper

clawsweeper Bot commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 18, 2026, 1:17 PM ET / 17:17 UTC.

ClawSweeper review

What this changes

Moves ClickClack discussion recovery state to asynchronous storage and makes shutdown and restart wait for accepted discussion operations.

Merge readiness

✅ Ready for maintainer review

The shutdown fix remains necessary on current main. No blocking introduced defect was found; this maintainer-authored PR should proceed through normal merge gates.

Priority: P2
Reviewed head: 9f682d6a3fae6c28be8f2cd8cf1c9e8801d62189

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused lifecycle repair with meaningful concurrency coverage and no identified blocking defect.
Proof confidence 🌊 off-meta tidepool Not applicable: The maintainer-author exemption applies. Reported SQLite service tests cover drainage and recovery, while the local HTTP harness covers durable-room behavior; neither is claimed here as an independently observed live shutdown run.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The maintainer-author exemption applies. Reported SQLite service tests cover drainage and recovery, while the local HTTP harness covers durable-room behavior; neither is claimed here as an independently observed live shutdown run.
Evidence reviewed 8 items Current main still needs the repair: Current main opens generation state through the synchronous keyed store. Its service cleanup clears timers and subscriptions without joining accepted operations.
Complete operation drainage: Public service operations register before execution, cleanup closes admission and joins those operations, and restart awaits cleanup. Both registered cleanup paths return the completion promise.
Authority checks after storage waits: Channel creation awaits pending-record persistence and checks the current account, endpoint, credential, workspace, and active session before mutation. Recovery updates and binding publication also invoke that check.
Findings None None.
Security None None.

How this fits together

ClickClack discussions connect OpenClaw sessions to durable chat rooms. The plugin coordinates room creation, persisted ownership, inbound routing, and recovery during service shutdown or restart.

flowchart TD
  A[Discussion requests and session events] --> B[Service admission]
  B --> C[Pending recovery storage]
  C --> D[Check current account and session]
  D --> E[Create or recover ClickClack room]
  E --> F[Persist binding and enable routing]
  G[Stop or restart] --> B
  B --> H[Wait for accepted operations]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +203, Tests +318, Docs +13. Total +534 across 14 files.

View PR surface stats
Area Files Added Removed Net
Source 6 574 371 +203
Tests 7 535 217 +318
Docs 1 13 0 +13
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 14 1122 588 +534

Review metrics

Metric Value Why it matters
Production versus test growth Net production +203 lines; tests and test support +318 lines Production growth implements operation drainage, conditional storage mutations, and current-authority checks; the added coverage targets those concurrency contracts.

Technical review

Best possible solution:

Keep one discussion-service lifecycle owner that drains accepted work while preserving durable room identity, quarantine ordering, and released-host compatibility.

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

Yes, from source: hold an accepted discussion open before channel creation and call cleanup; current main returns without waiting for that operation. This review did not execute the scenario.

Is this the best way to solve the issue?

Yes. The patch extends the existing service and storage owners, preserves stored formats, and selects older-host compatibility before execution rather than replaying failed mutations.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P2: This repairs bounded ClickClack discussion shutdown and recovery behavior 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 maintainer-author exemption applies. Reported SQLite service tests cover drainage and recovery, while the local HTTP harness covers durable-room behavior; neither is claimed here as an independently observed live shutdown run.

Label justifications:

  • P2: This repairs bounded ClickClack discussion shutdown and recovery behavior 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 maintainer-author exemption applies. Reported SQLite service tests cover drainage and recovery, while the local HTTP harness covers durable-room behavior; neither is claimed here as an independently observed live shutdown run.

Evidence

What I checked:

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • ragesaq: 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 af78348 into main Sep 18, 2026
166 checks passed
@steipete
steipete deleted the codex/clickclack-pending-worker branch September 18, 2026 17:41
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Sep 18, 2026
* origin/main:
  test(gateway): isolate session resolution channel fixtures (#151945)
  fix(clickclack): drain discussion opens before shutdown (#151978)
  fix(test): restore trusted packaging harness startup (#151967)
  improve(codex): batch session adoption binding reads (#151979)
  improve(cron): reduce allocations for busy stream sources (#151956)
  fix(file-transfer): avoid repeated directory record encoding (#151987)
  fix: avoid session-list rebuilds when authentication availability changes (#151920)
  fix(updates): explain externally managed update refusals (#151942)
  improve(heartbeat): avoid unused config work in membership checks (#151867)
  fix(android): keep status text readable and label accessibility actions (#151342)
  improve(ui): show OS and size in the environment selector (#151947)
  fix(android): keep tool errors visible in collapsed chat activity (#151332)
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 19, 2026
)

Move pending discussion generation reads and mutations to the shared SQLite worker, preserving FIFO and conditional replacement checks. Recheck live creation authority after persistence waits and join accepted operations through recovery and timer reassessment before service retirement.

Retain the declared 2026.9.4 host compatibility path only when comparison capabilities are absent. Stored formats, limits, retention, bindings, revocations, and synchronous visibility remain 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 extensions: clickclack 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: 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