Repository navigation
fix(clickclack): keep discussion rooms durable across session lifecycle - #119358
Conversation
There was a problem hiding this comment.
Pull request overview
Decouples ClickClack managed discussion rooms from OpenClaw session lifecycle so ClickClack channel identity/history stays durable while OpenClaw rotates/clears only the local “session attachment” on reset/archive/delete/recreate (and enforces ownership via account + credential fingerprint).
Changes:
- Make
external_refand room identity durable across session incarnation changes; rotate only the session-bound attachment (sessionId) and side-session identity/grant. - Stop propagating session archive/deletion into ClickClack channel
archivedmutations; keep reconciliation focused on label/category/link updates and local revocation markers. - Add/adjust tests and docs to validate durable-room behavior across lifecycle events, ambiguous opens, and persistence failures.
Reviewed changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| extensions/clickclack/src/inbound.test.ts | Updates inbound behavior expectations to rotate attachments and ignore legacy archive metadata. |
| extensions/clickclack/src/inbound.mention-gating.test.ts | Adds coverage ensuring attachment persistence failures are logged and inbound is dropped fail-closed. |
| extensions/clickclack/src/discussions/tool-policy.ts | Removes legacy archived binding gating from discussion session tool targeting. |
| extensions/clickclack/src/discussions/tool-policy.test.ts | Updates tests for “durable room” semantics and persistence-failure behavior. |
| extensions/clickclack/src/discussions/service.ts | Reworks reconcile/read flows to refresh attachments without archiving rooms. |
| extensions/clickclack/src/discussions/service.test.ts | Updates service behavior tests to validate durable room across archive/reset/delete/recreate and ambiguous-create paths. |
| extensions/clickclack/src/discussions/service-test-support.ts | Makes test external refs durable by removing sessionId from ref construction. |
| extensions/clickclack/src/discussions/service-open.ts | Removes archived mutations and adds quarantine/reattach logic across session state changes during open. |
| extensions/clickclack/src/discussions/service-events.test.ts | Adds gateway sessions.changed lifecycle test ensuring one durable room persists. |
| extensions/clickclack/src/discussions/service-contract.test.ts | Updates contract tests to ensure quarantine/retention without mutating rooms (no archive PATCH). |
| extensions/clickclack/src/discussions/routing.ts | Refreshes attachments during inbound routing resolution; logs and fails closed on persistence errors. |
| extensions/clickclack/src/discussions/naming.ts | Makes discussionExternalRef durable by excluding sessionId from the hash input. |
| extensions/clickclack/src/discussions/durable-room-proof.test.ts | Adds an integration-style proof test with a mock HTTP server validating “no archive PATCH + durable history”. |
| extensions/clickclack/src/discussions/binding-store.ts | Introduces attachBindingToCurrentActiveSession to rotate attachment sessionId while keeping room identity. |
| extensions/clickclack/src/discussions/binding-generation.ts | Pins pending-open reservations to account + credential fingerprint; adds clearPendingDiscussionOpen. |
| extensions/clickclack/README.md | Updates plugin docs to describe durable rooms and replaceable session attachments. |
| docs/channels/clickclack.md | Updates public docs to reflect durable room lifecycle and revised external_ref semantics. |
|
Codex review: needs maintainer review before merge. Reviewed August 4, 2026, 11:09 PM ET / August 5, 2026, 03:09 UTC. ClawSweeper reviewWhat this changesThe PR keeps a ClickClack discussion room and its history through OpenClaw session archive, reset, deletion, and recreation by rotating only the local session attachment. Merge readinessKeep this PR open as the candidate for the linked durable-room work. The exact-head repair resolves the prior attachment-write finding and has credible lifecycle proof, but it intentionally changes the documented ownership model and needs product-owner confirmation before merge. Priority: P2 Review scores
Verification
How this fits togetherThe ClickClack plugin binds an OpenClaw agent session to a remote discussion room and dispatches inbound room messages to that session. This change separates the room’s remote lifecycle from the replaceable local session attachment while retaining fail-closed routing when no active attachment exists. flowchart LR
A[OpenClaw session lifecycle] --> B[Discussion binding]
C[ClickClack inbound message] --> B
B --> D[Active attachment check]
D --> E[Scoped agent dispatch]
B --> F[Durable ClickClack room]
F --> G[Room history and channel identity]
Decision needed
Why: The branch is technically coherent but intentionally changes established user-visible lifecycle semantics rather than repairing an unambiguous implementation defect. Before merge
Agent review detailsSecurityNone. PR surfaceSource +70, Tests +637, Docs -2. Total +705 across 17 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Adopt one durable ClickClack room per logical session only if the owner confirms that archive, reset, and deletion must never change remote room archive state; retain the current persisted bindings and fail-closed attachment boundary. Do we have a high-confidence way to reproduce the issue? Yes, by source: before this PR, replacing a session ID entered the archive-and-delete path in the reconciler. The PR body also supplies an after-fix lifecycle replay, although this review did not execute it. Is this the best way to solve the issue? Unclear: the implementation is the coherent plugin-local fix for durable rooms, but current documentation defines the opposite lifecycle contract and a maintainer must choose the intended product behavior. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 1ee0564b0913. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (2 earlier review cycles)
|
b46b346 to
922e7d0
Compare
Separate durable ClickClack room identity from replaceable exact-session attachments. Session archive, reset, deletion, and recreation retain the existing room and history while rotating local routing authority and preserving fail-closed exact-incarnation grants. Pin ambiguous room recovery to the originating account and credential, and retain prior attachments when persistence fails. Closes openclaw#119300 Co-authored-by: Chisel <[email protected]>
922e7d0 to
0b68f8e
Compare
|
Merged. What changed after review:
Verification:
Landed on
Thanks @ragesaq! |
What Problem This Solves
ClickClack discussion channels were coupled to OpenClaw agent-session lifecycle state. Archiving, deleting, resetting, or replacing a session could archive the corresponding ClickClack channel, even though the channel is durable conversation history owned by ClickClack.
Why This Change Was Made
The plugin now treats the ClickClack room as durable and the OpenClaw session as a replaceable attachment. Session lifecycle events rotate or clear the local attachment without sending an archive update to ClickClack. Recreated sessions reattach to the same room, while inactive sessions still fail closed for inbound delivery.
Recovered room reservations also retain the originating account and credential fingerprint. A different account or credential cannot adopt an existing room on the same server and workspace.
User Impact
Archiving, resetting, deleting, or recreating an OpenClaw agent session no longer archives its ClickClack discussion channel or discards its history. The channel ID and external reference remain stable, and inbound messages resume after a replacement session attaches.
Evidence
pnpm test:extension clickclack: 28 files, 319 tests passednode scripts/run-vitest.mjs extensions/clickclack/src/discussions/service-contract.test.ts extensions/clickclack/src/discussions/service-events.test.ts: 51 tests passedpnpm tsgo:extensions:test: passedgit diff --check: passedCI=1 node scripts/check-changed.mjs --staged: reached the repository-wide environment-variable ratchet, which reports513actual below the checked-in budget of515; this PR does not touch that surface. The normal Crabbox lane was unavailable before execution because no configured provider was ready.Real ClickClack lifecycle replay
At exact head
b46b346cc97ea15950a4cebb1279927067f5df50(tree6efdc469a88e1b54813da39a15c80622711b8b0d), a detached clean checkout ran the PR's discussion service and HTTP client against stock ClickClack0.3.0-dev(f62c1709) using a fresh isolated SQLite database.Production incident evidence showed a successful channel PATCH followed by a durable
channel.updated {"archived":true}event. The controlled after-fix replay emittedarchive -> reset -> delete -> createand retained one managed room with the same channel ID and external reference,archived_at: null, readable history, and one post-recreation inbound dispatch call. The ClickClack database contained 1channel.created, 2message.created, and 0channel.updatedevents. The successful replay issued 0 channel PATCH requests.Boundary: ClickClack HTTP and storage were real.
PluginRuntimestate, session lookup, routing, inbound dispatch, and the Gateway event broadcaster were mocked. This verifies remote room preservation and that the inbound dispatch seam is reached once; it is not a complete Gateway/provider installation proof.The review P2 is also covered directly: simulated
SQLITE_FULLattachment persistence failures acrossinfo(), existing-bindingopen(), and reconciliation retain the prior attachment, log the failure, and perform 0 remote channel updates.{ "environment": "stock ClickClack HTTP + fresh SQLite; mocked PluginRuntime and sessions.changed broadcaster", "result": "pass", "managed_room_count": 1, "channel_create_count": 1, "channel_id_stable": true, "external_ref_stable": true, "archived_at": null, "archive_patch_count": 0, "history_preserved": true, "inbound_dispatch_calls_after_reattachment": 1, "channel_updated_event_count": 0 }Closes #119300
AI-assisted: implemented with OpenAI GPT-5.6 and independently reviewed with Anthropic Claude Opus 5. ragesaq directed the change and reviewed the behavior and scope.
Review requested
Please focus on discussion ownership across archive, reset, deletion, recreation, and credential changes.
Repo context
openclaw/openclaw:mainragesaq:fix/clickclack-durable-chatrooms9bfe292c8686c9f55282fb5773b8729f96b68051b46b346cc97ea15950a4cebb1279927067f5df50Next steps
Upstream review and CI. This PR does not request or perform a merge.