Repository navigation
feat: add pinned messages - #117
Conversation
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Codex review: found issues before merge. Reviewed August 2, 2026, 6:03 PM ET / 22:03 UTC. ClawSweeper reviewWhat this changesThis branch implements shared channel-message pins with SQLite and PostgreSQL storage, REST and SDK contracts, durable realtime events, and web controls for pinning and viewing messages. Merge readinessCurrent Priority: P2 Review scores
Verification
How this fits togetherClickClack’s web client sends channel mutations to the Go API, which persists shared workspace and channel state in SQLite or PostgreSQL and emits durable realtime events. This PR introduces pins into that path so channel timelines, thread replies, and the pinned-items panel share durable pin state. flowchart LR
Member[Channel member] --> Web[Web and desktop chat]
Web --> API[Go channel API]
API --> Store[SQLite or PostgreSQL store]
Store --> Pins[Shared pinned-message records]
Store --> Events[Durable realtime events]
Events --> Web
Pins --> Panel[Pinned-items panel]
Decision needed
Why: The patch adds persistent shared state, public API/SDK and realtime contracts, and a visible product workflow; correctness and proof do not determine whether this permanent product surface should be accepted. Before merge
Findings
Agent review detailsSecurityNone. Review metrics
Merge-risk optionsMaintainer options:
Copy recommended automerge instructionTechnical reviewBest possible solution: Land a narrowly scoped, maintainer-approved pins feature after removing release-owned changelog content and confirming migration, generated SQL, and current-main integration on the exact merge head. Do we have a high-confidence way to reproduce the issue? Not applicable as a feature request; the submitted PR body provides a detailed real-server Playwright flow for the proposed behavior, but the central question is product acceptance rather than reproducing a defect. Is this the best way to solve the issue? Unclear until a maintainer sponsors the permanent shared-pin API and 100-message policy; once sponsored, the branch’s persistence-plus-realtime design is aligned with ClickClack’s existing channel architecture, subject to the release-owned changelog correction. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against b409a28f8ab4. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (38 earlier review cycles; latest 8 shown)
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ea11592ede
ℹ️ 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".
| return | ||
| } | ||
|
|
||
| pin, event, err := s.store.PinMessage(r.Context(), channelID, body.MessageID, act.user.ID) |
There was a problem hiding this comment.
Enforce the bot token's workspace before accessing pins
When a bot identity belongs to multiple workspaces, a token issued for workspace A can reach this store call with a channel from workspace B and read or mutate B's shared pins, because membership checks use only act.user.ID. The existing bot-token isolation test models this exact multi-workspace identity, and other channel handlers call requireBotChannelWorkspace; apply the same guard in all three pin handlers before invoking the store.
Useful? React with 👍 / 👎.
| if (event.type === "message.deleted" && pinnedMessageIDs.has(event.payload.message_id || "")) { | ||
| await loadPinnedMessages(); |
There was a problem hiding this comment.
Refresh pins after pinned messages are edited
When a pinned message is edited while the pin panel is open, message.updated reloads the timeline but this invalidation only refreshes pins for message.deleted. Because pinnedMessages contains separately fetched message objects, the panel continues displaying the old body and attachments until another pin event, channel navigation, or manual panel reload; refresh or update the pin cache for message.updated as well.
Useful? React with 👍 / 👎.
| (event.type === "pin.added" || event.type === "pin.removed") && | ||
| event.channel_id === selectedChannelID && | ||
| !selectedDirectID | ||
| ) { | ||
| await loadPinnedMessages(); |
There was a problem hiding this comment.
Reload pins during authoritative realtime resyncs
When the realtime wrapper forces an authoritative resync after an unusable cursor, it advances to the current tail instead of replaying missed events, but the resync reloads messages and channel data without reloading pinnedMessages. Consequently pin changes made during the gap remain stale in an open panel and in message-menu pin labels; the pin-event handler cannot repair this because those events were intentionally skipped, so include the active channel's pins in reconcileRealtimeState.
Useful? React with 👍 / 👎.
| channelID={selectedChannelID} | ||
| {pinnedMessageIDs} | ||
| onTogglePin={toggleMessagePin} |
There was a problem hiding this comment.
Expose pin actions for thread replies
The pin state and toggle callback are wired only into MessageList, while channel thread replies are rendered separately by ThreadPanel, which receives neither prop and offers no pin control. The store accepts replies because they retain the channel ID, and the new pinned-panel navigation explicitly handles parent_message_id, so users can view API-created reply pins but cannot create or toggle them through the app; pass the same pin state and callback into the thread surface.
Useful? React with 👍 / 👎.
| for _, row := range rows { | ||
| message, err := getMessage(ctx, s.db, row.MessageID) |
There was a problem hiding this comment.
Batch pinned-message retrieval
For a channel at the supported 100-pin limit, every list request performs the initial pin query and then up to 100 sequential getMessage queries; on PostgreSQL this adds a database round trip per pin before attachment and reaction hydration and can make opening the panel disproportionately slow. Return the complete message rows with one typed sqlc query, or batch-fetch all selected IDs, while preserving the pin ordering.
AGENTS.md reference: AGENTS.md:L3-L3
Useful? React with 👍 / 👎.
ea11592 to
7d352a1
Compare
|
@codex review |
|
Codex Review: Didn't find any major issues. More of your lovely PRs please. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
7d352a1 to
fe4e99c
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fe4e99c6d5
ℹ️ 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".
| } | ||
| defer tx.Rollback() | ||
|
|
||
| msg, err := getMessageTx(ctx, tx, messageID) |
There was a problem hiding this comment.
Lock the message before validating its deletion state
In PostgreSQL, when DeleteMessage commits after this unlocked getMessageTx read but before the pin insert, this transaction can still insert a pin and emit pin.added for the now-deleted message. The new pin is then immediately absent from ListPinnedMessages because that query filters m.deleted_at IS NULL, despite the POST having returned 201. Lock the message row through the validation/insert or make the insert conditional on the message remaining undeleted.
Useful? React with 👍 / 👎.
fe4e99c to
d8591ed
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d8591ed819
ℹ️ 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".
| if (!channelID || !onTogglePin || pinSaving) return; | ||
| pinSaving = true; | ||
| try { | ||
| await onTogglePin(message, pinnedMessageIDs.has(message.id)); |
There was a problem hiding this comment.
Handle pin failures in the thread panel
When the pin request is rejected—for example, with the expected 409 after the channel reaches 100 pins—or the network fails, onTogglePin rejects and this try/finally propagates the error. The toolbar explicitly discards that promise, so users receive an unhandled rejection with no visible explanation, while the action-sheet path remains open without reporting why the operation failed. Catch the error and expose a status as MessageRow does for the same action.
Useful? React with 👍 / 👎.
| pinnedPanelOpen = false; | ||
| return; | ||
| } | ||
| if (!selectedChannelID || selectedDirectID) return; |
There was a problem hiding this comment.
Disable pinned-items controls outside channels
When a direct message or an empty workspace is selected, both top-bar variants still present an enabled “Pinned items” button, but this branch silently returns because pins are channel-only. The previous top-bar stub at least reported that there were no pinned items, while the new desktop control also routes here, so these contexts now expose a control that appears operable but has no effect. Hide or disable the control when there is no selected channel, or provide explicit unsupported-state feedback.
Useful? React with 👍 / 👎.
| (event.type === "message.updated" || event.type === "message.deleted") && | ||
| pinnedMessageIDs.has(event.payload.message_id || "") | ||
| ) { | ||
| await loadPinnedMessages(); |
There was a problem hiding this comment.
Synchronize pins after local message mutations
If this client successfully edits or deletes a pinned message over HTTP while its WebSocket is disconnected or blocked, the local mutation handlers update messages, replies, and selectedThread but never update pinnedMessages. This realtime-only refresh therefore never runs, leaving edited text stale and deleted messages visible in the pinned panel indefinitely until a later reconnect or reload. Update or remove the corresponding pinned entry as part of the successful local mutation path rather than relying exclusively on the echoed event.
Useful? React with 👍 / 👎.
…s-lifecycle # Conflicts: # apps/api/internal/webassets/dist/200.html # apps/api/internal/webassets/dist/_app/immutable/entry/app.C0jTAm08.js # apps/api/internal/webassets/dist/_app/immutable/nodes/0.erneJbxK.js # apps/api/internal/webassets/dist/_app/immutable/nodes/11.BPwHOykE.js # apps/api/internal/webassets/dist/_app/immutable/nodes/11.COwgNK6M.js # apps/api/internal/webassets/dist/_app/immutable/nodes/11.vvKR-XrD.js # apps/api/internal/webassets/dist/_app/immutable/nodes/12.D2jzbKVo.js # apps/api/internal/webassets/dist/_app/immutable/nodes/13.0lkaA9sE.js # apps/api/internal/webassets/dist/_app/immutable/nodes/3.BoPssj0u.js # apps/api/internal/webassets/dist/_app/immutable/nodes/4.B1Q5W4BL.js # apps/api/internal/webassets/dist/_app/immutable/nodes/4.CV83zLxh.js # apps/api/internal/webassets/dist/_app/immutable/nodes/4.D81lYOij.js # apps/api/internal/webassets/dist/_app/immutable/nodes/5.C04PopFT.js # apps/api/internal/webassets/dist/_app/immutable/nodes/5.DW2e0mkr.js # apps/api/internal/webassets/dist/_app/immutable/nodes/5.gnDXXEBJ.js # apps/api/internal/webassets/dist/index.html
|
I reproduced the current conflict and opened a narrow refresh PR for Jacqueline: jjjhenriksen#3 The only conflicts were generated web assets. The assistance branch merges current main at 3205c07, regenerates the embedded bundle, and is mergeable. Full pnpm check passes; all 5 pinned-message Playwright scenarios pass; an independent cold review found no issues. It does not alter the pin API/schema/100-pin policy, so the remaining product-contract decision stays with maintainers. After #3 merges, this upstream PR can receive a fresh exact-head review. |
…resh chore: refresh pinned messages onto current main
|
The previous refresh merged, but upstream It merges No fresh ClawSweeper review is requested yet; that should wait until #4 is merged and this PR has the resulting literal head. |
…resh-2 chore: refresh pinned messages onto release main
Expose the existing topic model in the web composer and timeline with resilient filtering, draft recovery, and paginated API support. Co-authored-by: PollyBot13 <pollybot13@gmail.com>
Add one persisted per-channel notification preference across browser, desktop, Pushover, API, and SDK surfaces, with resolved mention metadata and authorized thread-message hydration. Co-authored-by: Jacqueline Henriksen <jjjhenriksen@gmail.com>
Highlight resolved workspace mentions across normal, threaded, embedded, and agent-preamble renderers, with stronger current-user attention governed by the canonical channel notification preference. Co-authored-by: Jacqueline Henriksen <jjjhenriksen@gmail.com>
Keep the pinned panel channel-wide under topic filters, reuse topic and mention presentation, expose the 100-pin ceiling, and make channel tool ownership explicit.\n\nCo-authored-by: Jacqueline Henriksen <jjjhenriksen@gmail.com>\nCo-authored-by: PollyBot13 <pollybot13@gmail.com>
Regenerate the complete Go-served asset graph for the reviewed pin integration.\n\nCo-authored-by: Jacqueline Henriksen <jjjhenriksen@gmail.com>\nCo-authored-by: PollyBot13 <pollybot13@gmail.com>
|
Exact-head
The pinned panel remains channel-wide under topic filters, retains topic and mention presentation, shows its |
|
@clawsweeper re-review Exact-head current-main refresh, full embedded bundle, six-scenario pin proof, topic-filter independence, mention/topic presentation, and the visible 100-pin ceiling are now attached for |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
Summary
pin.added/pin.removedevents;Product coherence
Topics organize the active timeline; pins remain a shared channel index across topics. Selecting a topic badge from a pinned message closes the panel and applies that timeline filter. Browser and desktop headers group notification preference and pin controls consistently, and their active states reflect the panel they actually own.
Exact-head behavior proof
On exact head
b5b8b6a3739e4e3f7f6c957b0a8a0210c1c5e4a2, the focused real-server suite passed:The source-blind cross-topic scenario then passed independently in 7.4 seconds. It created two real channel topics, a stable workspace-bot handle, messages and pins in both topics, applied a timeline topic filter, and proved the panel still showed both pins with their topic badges, semantic mention rendering, and
2 / 100 pinnedcount. Clicking the other pinned topic badge closed the panel and changed the timeline filter.Persistence and boundary proof:
The repeated SQLite final-slot race begins at 99 pins and produces exactly one success, one
ErrPinnedMessageLimit, and 100 stored pins on every run.Validation
pnpm generate:sqlc— passed with SQLite/PostgreSQL source and generated output in sync.pnpm check— passed, including Go, web, desktop, typecheck, lint, formatting, docs, and embedded asset checks.The canonical build was repeated after review; both embedded HTML entrypoints reference the committed current asset graph.