Repository navigation
fix(clickclack): discussion rooms fail with PostgreSQL agents - #189977
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. What this changesUse worker-prepared session authority when creating, recovering, and binding ClickClack discussion rooms. Example: Open a discussion for agent:main:dashboard:proof-room with PostgreSQL-backed agent storage.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR fixes a current PostgreSQL discussion-opening failure while preserving session resets and live authority checks; no actionable findings remain, and exact-head CI is still pending. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe ClickClack discussion service receives session discussion RPCs, reads session authority through the Plugin SDK, creates or adopts remote channels, and commits local bindings through the existing guarded state store. flowchart LR
A[Discussion RPC] --> B[ClickClack discussion service]
B --> C[Prepared session authority]
C --> D[Agent database worker]
B --> E[ClickClack HTTP client]
E --> F[Remote discussion channel]
B --> G[Guarded binding store]
Technical reviewBest possible solution: Merge the focused repair once the existing exact-head CI gates pass. Do we have a high-confidence way to reproduce the issue? Current-main source reaches the forbidden synchronous PostgreSQL read, and the supplied baseline Gateway trace records the matching failure; this review executed no target code. Is this the best way to solve the issue? The smallest complete fix is to replace opening-path synchronous reads with the existing prepared authority owner, retain preparation through each effect, and reacquire after HTTP so resets remain supported. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 31866655fd60. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
PR surfaceSource +22, Tests +235, Other +2. Total +259 across 7 files. Added test files: 1. View PR surface stats
LabelsLabel changes: No label changes. Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (3 earlier review cycles)
Reviewed October 31, 2026, 11:44 PM ET / November 1, 2026, 03:44 UTC (Revision 4). |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
Worked on by: - @etzelm Co-authored-by: etzelm <[email protected]> OpenClaw-Publication: 94c395aa-646c-4c16-8d2c-49b9001aa862
Worked on by: - @etzelm Co-authored-by: etzelm <[email protected]> OpenClaw-Publication: 4c630fa6-e324-4347-b04c-bd392c4e4cc0
Worked on by: - @etzelm Co-authored-by: etzelm <[email protected]> OpenClaw-Publication: 6a487761-d0b7-409a-97bf-8e56347f5850
|
Merged via squash.
|
Summary
High Level TLDR
Panels → Discussion can open a ClickClack room when the Gateway stores agent sessions in PostgreSQL. File-backed ClickClack credentials continue to work after the async session change.
Root Cause
The discussion open path used the synchronous latest-session reader to check authority before channel operations and when persisting a binding. On a Gateway with PostgreSQL agent storage, the store rejects synchronous access on the Gateway thread. The original built Gateway reproduction returned
UNAVAILABLE: PostgreSQL connections must run in a workerbefore the loopback fixture received a channel create request.The open path now uses the existing async prepared-session helper. It refreshes the session at each effect and at binding commit, and releases the preparation in
finally. A reset during HTTP can still bind the current session. The recheck usesisDiscussionAccountCurrent, which compares the token-file path for file-backed credentials. Comparing the metadata token against a prepared token rejects an otherwise current account because metadata deliberately leaves the token empty. The existing file-backed test failed withClickClack discussion authority changed while opening the channelbefore this correction.Verification
Real behavior proof
sessions.create→session.discussion.open→session.discussion.infoproduced one remote channel and an independently verified persisted binding. A reset during the held channel-create response still bound the current session. Archiving during the response refused the attachment and left no binding. This proof predates the branch refresh.node scripts/run-vitest.mjs extensions/clickclack/src/discussions/{service-contract,service,service-state-persistence,service-open.agent-storage}.test.ts test/scripts/{postgres-conformance-shards,database-conformance}.test.ts --maxWorkers=1 --reporter=dotpassed 128 tests in six files. The existing file-backed test goes through discussion open before checking grant rotation. The real-storage regression ran locally with SQLite. PostgreSQL CI discovers the same test via the conformance planner.What was not tested
The refreshed branch's local run used SQLite and a synthetic ClickClack transport. It did not run the complete Gateway/PostgreSQL exercise, measure latency, or use a live ClickClack account. Hosted checks are tracked on this PR.
Contributor credit
Co-authored with @etzelm.