Skip to content

fix(api): reject posts to archived channels - #326

Merged
steipete merged 10 commits into
openclaw:mainfrom
tre1d:fix/archived-channel-post
Nov 14, 2026
Merged

steipete merged 10 commits into
openclaw:mainfrom
tre1d:fix/archived-channel-post

Conversation

@tre1d

@tre1d tre1d commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Archived channels previously accepted new posts because the shared store posting check never inspected archived_at. Reject new posts, thread replies, and other posting activity with HTTP 409 in both SQLite and PostgreSQL, while retaining existing membership checks and historical access. Restoring with archived:false retains the channel ID and links.

The maintenance validation also exposed reachable GO-2026-6859 in Go 1.27.3. Build with Go 1.27.4 and matching pinned container images, retaining the documented Go 1.26.6 module minimum.

Validation: the HTTP regression fails on main with 201 instead of 409. The full pnpm check passes, including SQLite/store and HTTP tests; added PostgreSQL coverage runs in CI. Focused archive/reply/restore tests and govulncheck pass with Go 1.27.4 (zero reachable vulnerabilities). Independent Codex P0–P2 review is clean. No release or deployment is part of this PR.

Fixes #325.

@clawsweeper

clawsweeper Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@tre1d

tre1d commented Nov 9, 2026

Copy link
Copy Markdown
Contributor Author

Draft PR ready for workflow approval. The change is small: an archived-channel guard in both the postgres and sqlite stores, a 409 mapping, a postgres store test, and an HTTP regression test. The CI runs are action_required for a first-time contributor; once approved, the full gate (Go + Postgres 18 + coverage, TypeScript, e2e) will run. No schema or sqlc changes.

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P2 Normal priority bug or improvement with limited blast radius. merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 9, 2026
@clawsweeper

clawsweeper Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge.

What this changes

This PR rejects archived-channel writes in both database stores and returns HTTP 409.

Example: A member posts {"body":"archived"} to a channel after archived=true.

  • Before: The message is accepted.
  • After: The request returns HTTP 409 with "channel is archived".

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The patch is focused, but product scope is unresolved and required real-behavior evidence is absent; persisted formats are unchanged.
Proof confidence 🧂 unranked krab (1/6) Real behavior proof is necessary before merge. See Before merge.
Patch quality 🦐 gold shrimp (3/6) 1 actionable review finding remain.

Product

Kind: Feature · Worth it: Needs a maintainer decision · Fix scope: Partial
User problem: A retired channel can continue receiving traffic after a member archives it.
Reason: Read-only archives change existing behavior without owner approval; use Related rather than a closing reference to #325 while its other expectations remain unresolved.

Merge readiness

⛔ Blocked before merge - 4 items remain

Keep open: current main does not implement this change, and making archived channels read-only needs an owner decision before merge.

Priority: P2
Reviewed head: cc5f2ae85a67bbfc917025bb39565fd898a20b63
Owner decision: Required. See Decision needed.

Decision needed

  • Question: Should archiving reject messages and replies, and should that restriction also cover topics, slash commands, and ephemeral events?
  • Recommendation: Define the archive contract first: Specify the operations archive should block and preserve existing restore and identity behavior before completing this PR.
  • Why: The existing design emphasizes organization and retained access; the linked discussion contains no owner decision authorizing these restrictions.

Before merge

  • Add real behavior proof - Authority-chain proof required: no supplied run exercises the changed store checks through the shipped server; show active-channel success and archived-channel denial before persistence or delivery, including archive transitions and restoration in both stores, plus an existing v0.9.4 database upgrade with settings and history intact; redact credentials and non-public endpoints. After adding proof, update the PR body, then request a new review with @clawsweeper re-review. The PR author or someone with repository write access can request it.
  • Explain how users can recover from archived-channel rejection (P3) - Posting from an archived channel now surfaces only "channel is archived". The existing composer still allows the attempt and displays API errors, so members receive no next action. Tell them to choose an active channel or ask a workspace owner to restore this one.
  • Resolve merge risk - The contributor must establish how the chosen archive contract handles authorization followed by archiving before message commit or slash-command delivery.
  • Explain or restore the original intent of Archive semantics - feat: externally managed channels, sidebar sections, archive hiding, embed channel view #102: Organize externally managed channels and hide archived channels from the normal sidebar while retaining access and history.

Findings

  • [P3] Explain how users can recover from archived-channel rejection — apps/api/internal/store/types.go:36

Provenance

Tests

  • Missing end-to-end proof: Supply real HTTP or UI evidence of permitted active-channel posting, archived-channel rejection without persistence or delivery, restoration, and upgrade from v0.9.4; base-fail/head-pass execution of the added tests is not shown.
Agent review details

How this fits together

Authenticated HTTP requests enter the shared store posting checks; SQLite or PostgreSQL then persists messages and events, which the HTTP layer publishes to connected clients.

flowchart TD
Client --> HTTP
HTTP --> PostingChecks
PostingChecks --> SQLite
PostingChecks --> PostgreSQL
SQLite --> Events
PostgreSQL --> Events
Events --> Subscribers
Loading

Technical review

Best possible solution:

Agree on archive write semantics, then implement that scope in the existing shared owner with clear recovery guidance and preserved restoration.

Do we have a high-confidence way to reproduce the issue?

Both current-main stores visibly permit archived-channel posting, but no runtime reproduction was run and the expected read-only contract remains unsettled.

Is this the best way to solve the issue?

The existing shared posting owner is a small implementation point, but its wider callers require an explicit scope decision.

Full review comments:

  • [P3] Explain how users can recover from archived-channel rejection — apps/api/internal/store/types.go:36
    Posting from an archived channel now surfaces only "channel is archived". The existing composer still allows the attempt and displays API errors, so members receive no next action. Tell them to choose an active channel or ask a workspace owner to restore this one.
    Confidence: 0.96

Overall correctness: patch is correct
Overall confidence: 0.9

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 03e85d6c704a.

Merge-risk options

Maintainer options:

  1. Prove the agreed archive transition (recommended)
    After the owner defines archive semantics, have the contributor demonstrate that in-flight operations obey that contract before their final effects.

Provenance checked

  • Shared posting authorization keeps the original intent (863a074: Guest moderation controls established role, moderation, guest-access, and posting-budget checks; the new archive condition retains those checks.)
  • Archived message addressability keeps the original intent (feat: add copyable message links #162: Permission-checked message links deliberately remain available for archived channel roots.)
  • HTTP error mapping keeps the original intent (refactor(api): separate HTTP handlers by domain #246: Move HTTP declarations into domain files without changing existing wire contracts.)

Testing

Proof path: none.

Security

None.

Evidence

What I checked:

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Labels

Label changes:

  • add P2: Archive lifecycle behavior affects a limited channel workflow without an established urgent regression.
  • add merge-risk: 🚨 compatibility: Existing archived channels that accept writes would start rejecting messages and other operations using the shared posting check.
  • add rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🦐 gold shrimp.
  • add status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Label justifications:

  • P2: Archive lifecycle behavior affects a limited channel workflow without an established urgent regression.
  • merge-risk: 🚨 compatibility: Existing archived channels that accept writes would start rejecting messages and other operations using the shared posting check.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🦐 gold shrimp.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Record the owner's archive-contract decision.
  • Provide final-effect evidence for allowed posting, archived denial, and archive transitions.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed November 9, 2026, 12:09 AM ET / 05:09 UTC.

@tre1d

tre1d commented Nov 9, 2026

Copy link
Copy Markdown
Contributor Author

Archive contract proposal for the owner decision: archive makes the channel read-only. Block new messages, thread replies, topic creation, slash-command writes, and ephemeral events. Keep read access, history, restore behavior, and the sidebar hiding unchanged. Unarchive restores writes. This matches the existing archive intent (hide from the sidebar, retain access and history) while stopping new traffic. If maintainers prefer archive to remain writable, I will close this PR and adjust #325.

The P3 recovery note is addressed: the error now says "channel is archived; choose an active channel or ask a workspace owner to restore it."

Real behavior proof: the CI workflows are action_required for a first-time contributor; once approved, the added tests run the active-channel success and archived-channel denial in both stores. I can add a manual before/after run after approval if the maintainers want it.

@tre1d
tre1d marked this pull request as ready for review November 9, 2026 12:23
@tre1d
tre1d requested a review from a team as a code owner November 9, 2026 12:23
@tre1d

tre1d commented Nov 9, 2026

Copy link
Copy Markdown
Contributor Author

Marked ready for review. Two asks:

  1. Approve the workflow runs for this first-time contributor so the full CI gate can run.
  2. Confirm the archive read-only contract proposed above: messages, replies, topics, slash commands and ephemeral events blocked; reads, history, restore and sidebar hiding unchanged.

The patch is small and has store + HTTP tests ready.

@steipete steipete 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.

Verified the archived-channel regression, reply and restoration coverage in both stores, the patched Go build, and clean independent P0–P2 review. All required checks are green at the current head.

@steipete
steipete merged commit 16bb9fd into openclaw:main Nov 14, 2026
14 of 15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. P2 Normal priority bug or improvement with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: archived channels remain addressable and recreation is undefined

2 participants