Repository navigation
feat(clickclack): session discussions — bound channels, side agent, lifecycle sync - #111503
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 52358dcd0b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| api.registerTool((context) => | ||
| createClickClackDiscussionTool({ service, sessionKey: context.sessionKey }), | ||
| ); |
There was a problem hiding this comment.
Hide the discussion tool from unbound sessions
When discussions are disabled—the default—or the current session has no binding, this factory still returns a concrete discussion tool, so every agent prompt receives a tool that can only answer “No discussion is bound.” This contradicts docs/channels/clickclack.md:254, which says the attached main session receives the tool, and unnecessarily consumes prompt space while inviting useless calls; return null from the full-registration factory unless the feature is enabled and this session has a live binding.
Useful? React with 👍 / 👎.
|
Codex review: needs real behavior proof before merge. Reviewed July 19, 2026, 5:33 PM ET / 21:33 UTC. Summary PR surface: Source +2397, Tests +2727, Docs +190, Generated 0. Total +5314 across 45 files. Reproducibility: not applicable. This PR proposes an opt-in capability rather than fixing an established broken behavior. The provided terminal transcript is useful live contract evidence, but it is not a reproduction of a current-main defect. Review metrics: 2 noteworthy metrics.
Stored data model Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Risk before merge
Maintainer options:
Next step before merge
Maintainer decision needed
Security Review detailsBest possible solution: Retain the opt-in ClickClack implementation only after the session-access owner explicitly approves the exact-incarnation grant as a supported boundary, then add redacted real-gateway proof covering open, inbound side-agent routing, a permitted attached-session call, and a revoked or stale binding being blocked. Do we have a high-confidence way to reproduce the issue? Not applicable: this PR proposes an opt-in capability rather than fixing an established broken behavior. The provided terminal transcript is useful live contract evidence, but it is not a reproduction of a current-main defect. Is this the best way to solve the issue? Unclear: the ClickClack provider implementation follows the merged generic discussion seam, but the exact-incarnation plugin-to-core authorization model needs owner confirmation before it can be called the best long-term solution. AGENTS.md: unclear because the file could not be read completely. Codex review notes: model internal, reasoning high; reviewed against 171a3852ba56. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +2397, Tests +2727, Docs +190, Generated 0. Total +5314 across 45 files. View PR surface stats
Security concerns:
What I checked:
Likely related people:
What the crustacean ranks mean
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. How this review workflow works
Review history (4 earlier review cycles)
|
52358dc to
7028f99
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7028f99aa1
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| clearDiscussionBindingGeneration({ | ||
| runtime: this.#runtime, | ||
| sessionKey: pending.sessionKey, | ||
| expectedGeneration: pending.generation, | ||
| }); |
There was a problem hiding this comment.
Preserve pending reservations during in-flight creates
The periodic pending-open pass runs outside both #withSessionLock and #withChannelMutationLock, while service-open.ts:243-267 records the reservation and then awaits the channel POST. If that POST remains in flight for the 60-second reconciliation interval and the session is reset or discussions are disabled, this path can list before the new channel becomes visible and clear the reservation; if the POST subsequently commits but its response/relist is lost, there is then no binding, channel tombstone, or workspace quarantine, so messages from the orphaned managed channel can fall through to ordinary account routing. Serialize this reconciliation with the corresponding open before clearing its generation.
Useful? React with 👍 / 👎.
| this.#finalizePendingBinding(sessionKey, existing); | ||
| await this.#reconcileBinding(sessionKey, existing, resolved.account); |
There was a problem hiding this comment.
Keep the read-scoped info operation side-effect free
session.discussion.info is explicitly assigned operator.read in src/gateway/methods/core-descriptors.ts:443, and the Control UI probes it automatically, but this call invokes #reconcileBinding, which can PATCH remote channel archive/name/section/link state and mutate or delete the local binding. Thus a client holding only read scope can trigger ClickClack and SQLite writes whenever session metadata or lifecycle state has drifted; move reconciliation to a write-scoped/background path or change the authorization contract.
Useful? React with 👍 / 👎.
| cleanup: () => { | ||
| unregisterSessionAccess(); | ||
| service.cleanup(); |
There was a problem hiding this comment.
Avoid global teardown on ordinary session cleanup
Runtime lifecycle cleanup is invoked for every session reset and delete without a plugin filter (src/gateway/session-reset-service.ts:762-771), so resetting any session calls this callback and globally unregisters ClickClack's scoped session-access provider and stops its reconciliation timer. Subsequent discussion side sessions can no longer access their attached main sessions under the default tree visibility, and existing bindings stop background synchronization until the plugin registry is rebuilt; gate this teardown to plugin-wide disable/restart cleanup rather than session-scoped reasons.
Useful? React with 👍 / 👎.
| ); | ||
| // Registration is process-stable; provider methods read live config so a | ||
| // channel hot reload can enable discussions without restarting the gateway. | ||
| registerSessionDiscussionProvider(service.provider); |
There was a problem hiding this comment.
Remove the provider when ClickClack is retired
The provider registry in src/plugins/session-discussion-registry.ts:31-40 is process-global and exposes only registration/get operations, while this lifecycle cleanup removes the access grant and timer but leaves service.provider installed. After an in-process plugin disable or registry replacement where no successor ClickClack registration occurs, session.discussion.info/open therefore continue calling the retired service; if channel configuration still enables discussions, it can keep exposing and mutating ClickClack channels even though the plugin was disabled. Add owner-checked provider unregistration and invoke it from cleanup.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 84c26f832e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const { account, runtime, sessionKey, store } = params; | ||
| const entry = runtime.agent.session.getSessionEntry({ sessionKey, readConsistency: "latest" }); |
There was a problem hiding this comment.
Canonicalize session keys before storing discussion bindings
When the Control UI opens the default session, it forwards the alias main verbatim (ui/src/pages/chat/chat-pane.ts:2732-2767), and this lookup accepts that alias but continues using it as the binding key. Agent runs subsequently canonicalize the same session to agent:main:main (src/gateway/server-methods/agent-run-handler.ts:315-316), so the main session's discussion tool calls store.get("agent:main:main") and reports no binding; probing or opening with the canonical representation can also create a second managed channel for the same session. Resolve the canonical store key before deriving the external ref and persisting the binding.
Useful? React with 👍 / 👎.
|
Merged via squash.
|
…ifecycle sync (openclaw#111503) * feat(clickclack): add session discussions * chore: remove release-owned changelog entry * refactor(clickclack): split discussion service workflows * fix(clickclack): satisfy plugin surface gates * fix: narrow routing peer in inbound test and refresh docs map
…ifecycle sync (openclaw#111503) * feat(clickclack): add session discussions * chore: remove release-owned changelog entry * refactor(clickclack): split discussion service workflows * fix(clickclack): satisfy plugin surface gates * fix: narrow routing peer in inbound test and refresh docs map
What Problem This Solves
OpenClaw sessions now have a generic discussion seam (#111337), but no provider implements it. Teams running the bundled ClickClack channel plugin have no way to bind a ClickClack channel to a session, keep it lifecycle-synced (archive/rename/groups), embed it in the Control UI panel, or let a side agent in that channel observe and relay to the session it discusses.
Why This Change Was Made
Implements the ClickClack discussions module inside the bundled
clickclackplugin (transport-only boundary preserved):session.discussionprovider —opencreates one externally-managed ClickClack channel per session (name slugified from the label,external_ref= session key,external_urldeep link to the Control UI, sidebar section default "Sessions"),inforeturns the/embed/channelURL for the panel. Idempotent with crash-safe pending/tombstone state so ambiguous HTTP outcomes cannot double-create channels or leak into ordinary routing.sessions.changedsubscription, sync uses lazy reconciliation on provider calls plus a bounded 60s reconciler that runs only while bindings exist (documented tradeoff at the code site).disc-<hash>peer derived from the exact main-session incarnation and channel identity). Abefore_tool_callpolicy fail-closes itssessions_history/session_status/sessions_sendto the attached main session only, with revoked-channel, archived-binding, stale-incarnation, and inactive-account checks. Core session tools gained exact-incarnation scoped grants to support this without widening general visibility.discussiontool returns recent channel messages ([Author] text), no push into the transcript.User Impact
With a discussions-enabled ClickClack account configured, every session can get a team channel one click away in the Control UI: humans discuss next to the session, the embedded side agent answers questions about live progress and can relay to the session when asked, the main agent can read the discussion on demand, and archiving the session archives the channel.
Evidence
git diff --checkclean.Live evidence (added post-review)
Managed-channel lifecycle exercised against a live ClickClack server (
clickclack serve, realccb_bot token, dev-bootstrap workspace) — the exact HTTP contract the plugin'shttp-clientdrives for open/lifecycle-sync/side-agent-read:Every lifecycle transition the plugin maps (session archive→channel archive, restore, label→rename, category/groups→section, delete→archive-not-delete) is confirmed at the server contract; the in-gateway orchestration (binding store, idempotent open, incarnation staleness, revoked-channel + archived-binding + inactive-account fail-closed, side-agent routing, tool-target policy) is covered by the plugin suite (232 tests, incl.
discussions/*.test.ts).Owner decision required before merge
ClawSweeper flagged, and I agree, that the exact-incarnation scoped session-access contract in this PR extends session-tool visibility (
sessions_history/session_status/sessions_send) across a plugin→core security boundary. It is fail-closed and incarnation-scoped, but it is a new cross-boundary capability. Per repo policy this needs explicit maintainer/owner sign-off on the security-boundary ownership before landing — holding the merge for that approval.