Skip to content

fix(clickclack): keep discussion rooms durable across session lifecycle - #119358

Merged
shakkernerd merged 4 commits into
openclaw:mainfrom
ragesaq:fix/clickclack-durable-chatrooms
Aug 5, 2026
Merged

shakkernerd merged 4 commits into
openclaw:mainfrom
ragesaq:fix/clickclack-durable-chatrooms

Conversation

@ragesaq

@ragesaq ragesaq commented Aug 4, 2026 •

Copy link
Copy Markdown
Contributor

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 passed
  • node scripts/run-vitest.mjs extensions/clickclack/src/discussions/service-contract.test.ts extensions/clickclack/src/discussions/service-events.test.ts: 51 tests passed
  • pnpm tsgo:extensions:test: passed
  • git diff --check: passed
  • CI=1 node scripts/check-changed.mjs --staged: reached the repository-wide environment-variable ratchet, which reports 513 actual below the checked-in budget of 515; 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 (tree 6efdc469a88e1b54813da39a15c80622711b8b0d), a detached clean checkout ran the PR's discussion service and HTTP client against stock ClickClack 0.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 emitted archive -> reset -> delete -> create and 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 1 channel.created, 2 message.created, and 0 channel.updated events. The successful replay issued 0 channel PATCH requests.

Boundary: ClickClack HTTP and storage were real. PluginRuntime state, 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_FULL attachment persistence failures across info(), existing-binding open(), 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

Next steps

Upstream review and CI. This PR does not request or perform a merge.

Copilot AI lite review requested due to automatic review settings August 4, 2026 22:07
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation size: XL labels Aug 4, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_ref and 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 archived mutations; 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.

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. labels Aug 4, 2026
@clawsweeper

clawsweeper Bot commented Aug 4, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 4, 2026, 11:09 PM ET / August 5, 2026, 03:09 UTC.

ClawSweeper review

What this changes

The 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 readiness

⚠️ Ready for maintainer review - 3 items remain

Keep 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
Reviewed head: b46b346cc97ea15950a4cebb1279927067f5df50
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The focused lifecycle repair has credible real remote-room proof, substantial regression coverage, and no remaining discrete correctness finding; product direction is the merge gate.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The exact-head PR body provides a redacted after-fix replay against stock ClickClack HTTP and fresh SQLite showing room preservation, zero archive PATCHes, and post-reattachment dispatch; the mocked Gateway boundary remains a stated nonblocking limitation.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The exact-head PR body provides a redacted after-fix replay against stock ClickClack HTTP and fresh SQLite showing room preservation, zero archive PATCHes, and post-reattachment dispatch; the mocked Gateway boundary remains a stated nonblocking limitation.
Evidence reviewed 6 items Pre-PR lifecycle behavior: The pre-PR reconciler archived and deleted a binding when the same session key received a replacement session ID, and derived remote archive state from the local session.
Exact-head lifecycle repair: The PR refreshes the persisted attachment before reindexing and returns without a remote mutation for absent or archived sessions; reconcile patches no longer include an archive field.
Prior P2 addressed: The shared refresh helper catches persistence failures, logs them, retains the prior binding, and returns before ClickClack mutation; focused tests cover SQLITE_FULL through info, existing-binding open, and reconciliation.
Findings None None.
Security None None.

How this fits together

The 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]
Loading

Decision needed

Question Recommendation
Should bundled ClickClack discussions move from the currently documented session-synchronized room lifecycle to durable rooms whose archive and restore lifecycle is owned by ClickClack? Confirm durable room ownership: Accept the durable-room model and merge after normal exact-head CI completes, preserving existing binding and fail-closed routing behavior.

Why: The branch is technically coherent but intentionally changes established user-visible lifecycle semantics rather than repairing an unambiguous implementation defect.

Before merge

  • Resolve merge risk (P1) - This deliberately replaces the documented session-synchronized room lifecycle for existing managed discussions; a product owner should explicitly accept durable ClickClack room ownership before merge.
  • Resolve merge risk (P1) - The partial clone could verify containment but could not fetch the supplied current-main ClickClack source or external ClickClack contract because GitHub DNS was unavailable, so no stronger claim about equivalent main-only work or upstream API semantics is made.
Agent review details

Security

None.

PR surface

Source +70, Tests +637, Docs -2. Total +705 across 17 files.

View PR surface stats
Area Files Added Removed Net
Source 8 253 183 +70
Tests 7 752 115 +637
Docs 2 39 41 -2
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 17 1044 339 +705

Review metrics

Metric Value Why it matters
Production vs test LOC production +252/-181, tests +753/-117 The production growth implements one new ownership boundary, while most changed lines are lifecycle, failure-mode, and transport regression coverage.
Persisted ownership identity 2 reservation ownership fields added; 1 session-derived external-reference component removed Existing pending reservations and managed-room identity now remain stable across session replacement, making upgrade semantics material before merge.

Stored data model

Persistent data-model change detected: serialized state: extensions/clickclack/src/discussions/service-events.test.ts, serialized state: extensions/clickclack/src/inbound.mention-gating.test.ts, vector/embedding metadata: extensions/clickclack/src/discussions/tool-policy.test.ts, vector/embedding metadata: extensions/clickclack/src/inbound.test.ts. Confirm migration or upgrade compatibility proof before merge.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #119300
Summary: This PR is the open candidate implementation for the canonical durable ClickClack room request.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge-risk options

Maintainer options:

  1. Confirm the durable-room contract (recommended)
    Accept the lifecycle change deliberately, including that existing session archive, reset, and deletion events no longer archive their remote room.
  2. Pause for the existing contract
    Close or redirect the PR if session-driven remote room archival remains the intended bundled ClickClack behavior.

Technical review

Best 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.

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient. The exact-head PR body provides a redacted after-fix replay against stock ClickClack HTTP and fresh SQLite showing room preservation, zero archive PATCHes, and post-reattachment dispatch; the mocked Gateway boundary remains a stated nonblocking limitation.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The exact-head PR body provides a redacted after-fix replay against stock ClickClack HTTP and fresh SQLite showing room preservation, zero archive PATCHes, and post-reattachment dispatch; the mocked Gateway boundary remains a stated nonblocking limitation.
  • remove rating: 🦪 silver shellfish: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.
  • remove status: 📣 needs proof: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P2: This is a bounded but user-visible ClickClack discussion lifecycle change requiring maintainer product confirmation.
  • merge-risk: 🚨 compatibility: The PR changes the documented lifecycle semantics and persisted identity behavior of existing managed discussion rooms.
  • merge-risk: 🚨 session-state: Inbound routing and side-session authority now depend on rotating a persisted active-session attachment.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The exact-head PR body provides a redacted after-fix replay against stock ClickClack HTTP and fresh SQLite showing room preservation, zero archive PATCHes, and post-reattachment dispatch; the mocked Gateway boundary remains a stated nonblocking limitation.
  • proof: sufficient: Contributor real behavior proof is sufficient. The exact-head PR body provides a redacted after-fix replay against stock ClickClack HTTP and fresh SQLite showing room preservation, zero archive PATCHes, and post-reattachment dispatch; the mocked Gateway boundary remains a stated nonblocking limitation.

Evidence

What I checked:

  • Pre-PR lifecycle behavior: The pre-PR reconciler archived and deleted a binding when the same session key received a replacement session ID, and derived remote archive state from the local session. (extensions/clickclack/src/discussions/service.ts:358, ed6ee79c56f6)
  • Exact-head lifecycle repair: The PR refreshes the persisted attachment before reindexing and returns without a remote mutation for absent or archived sessions; reconcile patches no longer include an archive field. (extensions/clickclack/src/discussions/binding-store.ts:49, b46b346cc97e)
  • Prior P2 addressed: The shared refresh helper catches persistence failures, logs them, retains the prior binding, and returns before ClickClack mutation; focused tests cover SQLITE_FULL through info, existing-binding open, and reconciliation. (extensions/clickclack/src/discussions/service.ts:451, b46b346cc97e)
  • Feature provenance: The original session-discussion lifecycle implementation dates to the ClickClack session-discussions feature; subsequent plugin session-event work supplies the event boundary this PR uses. (extensions/clickclack/src/discussions/service.ts:1, 5420c5c409cd)
  • Current-main containment: The PR head is not an ancestor of the supplied current-main SHA, so this branch has not been merged as-is. (b46b346cc97e)
  • After-fix behavior proof: The PR body records an exact-head replay against stock ClickClack HTTP and fresh SQLite: archive→reset→delete→create retained one channel and external reference, made zero channel PATCHes, preserved history, and dispatched one inbound message after reattachment. (b46b346cc97e)

Likely related people:

  • Jason (Json): Recent current-main history owns the reconciler lines that coupled a replacement session ID to archive-and-delete behavior. (role: recent area contributor; confidence: high; commits: ed6ee79c56f6; files: extensions/clickclack/src/discussions/service.ts)
  • Peter Steinberger: Introduced ClickClack session discussions and later plugin session-change delivery used by this lifecycle path. (role: feature owner; confidence: medium; commits: 5420c5c409cd, 0bfe7dd35760, 7361455160cc; files: extensions/clickclack/src/discussions/service.ts, extensions/clickclack/src/register.ts)

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 (2 earlier review cycles)
  • reviewed 2026-08-04T23:04:47.852Z sha fe597c11d8c0073bf97270216fa48eb84aab5020 :: needs real behavior proof before merge. :: [P2] Fail closed when attachment persistence fails during reconciliation
  • reviewed 2026-08-05T00:10:46.892Z sha fe597c11d8c0073bf97270216fa48eb84aab5020 :: needs real behavior proof before merge. :: [P2] Fail closed when attachment persistence fails during reconciliation

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. 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. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Aug 5, 2026
@shakkernerd shakkernerd self-assigned this Aug 5, 2026
@shakkernerd
shakkernerd force-pushed the fix/clickclack-durable-chatrooms branch from b46b346 to 922e7d0 Compare August 5, 2026 15:19
ragesaq and others added 4 commits August 5, 2026 16:38
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]>
@shakkernerd
shakkernerd force-pushed the fix/clickclack-durable-chatrooms branch from 922e7d0 to 0b68f8e Compare August 5, 2026 15:39
@shakkernerd
shakkernerd merged commit 0b68f8e into openclaw:main Aug 5, 2026
37 checks passed
@shakkernerd

Copy link
Copy Markdown
Contributor

Merged.

What changed after review:

  • Compressed the contributor's original work into one commit and preserved ragesaq as its author.
  • Kept ClickClack rooms durable across session archive, reset, deletion, and recreation while preserving fail-closed inbound routing.
  • Fixed concurrent attachment refreshes and bounded detached binding retention; updated focused docs and regression coverage without adding a changelog entry.

Verification:

  • Fully green checkpoint at 922e7d06fb9c7ffed3579de7eb2c24d69222a19d; exact signed patch replay fast-forwarded to main.
  • Blacksmith Testbox through Crabbox tbx_01kz95mx0rwxvzn083y69fzkd0, Actions run 31016039822: extension typechecks and 105 focused tests passed.
  • Real behavior proof: durable ClickClack channel identity and history survived lifecycle rotation with no archive PATCH and inbound dispatch resumed after reattachment.
  • Auto-review: unavailable; independent source review found no unresolved issues.
  • GitHub checks: the fully green checkpoint passed all repository-owned substantive checks; duplicate signature-only SHA checks were not awaited, and no substantive failure appeared.

Landed on main:

Thanks @ragesaq!

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 merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. 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.

[Feature]: Make ClickClack rooms durable across agent session lifecycles

3 participants