Skip to content

fix: restrict thread archiving to creators and admins - #160932

Merged
stevenlee-oai merged 3 commits into
mainfrom
dev/stevenlee/thread-archive-permissions
Sep 30, 2026
Merged

stevenlee-oai merged 3 commits into
mainfrom
dev/stevenlee/thread-archive-permissions

Conversation

@stevenlee-oai

@stevenlee-oai stevenlee-oai commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes members being able to archive threads created by someone else when they have general write access.

User Impact

Members can archive and restore only threads they created; admins retain access across creators. Assigned ownership alone no longer grants archive or restore access, including for existing sessions after an upgrade. This is the requested policy change; the multi-user guide documents admin recovery when the creator is unavailable or lacks usable profile attribution. Other collaboration actions, assigned-owner stop controls, and solo gateways retain their existing behavior. No configuration or migration is required.

Why This Change Was Made

Enforce creator/admin authority at the shared Gateway authorization boundary for single and batch patches, including checks after asynchronous work. Align the UI and agent controls so an unauthorized self-archive cannot report success before being rejected. The conflict resolution preserves main's newer session-assignment support.

Evidence

  • CI run 36762379844 passed on c8704d67e8f1c49c85b98115cf37aa19f3a100bb; openclaw/ci-gate, dependency review, and security-sensitive review are green.
  • Verified the original CI failures before editing: the positive UI restore fixture omitted creator authority, and the assembled Gateway fixture still expected assigned-owner archiving. Subsequent CI exposed MCP and deferred self-archive fixtures with the same stale authority assumptions. The fixtures now exercise creator authority, assignment-independent archive rights, and late revocation/replacement rejection with persisted-state assertions.
  • 251 distinct focused tests passed across 15 files over the local validation runs: Gateway single/batch authorization and lifecycle, assembled/deferred controls, real MCP HTTP and dispatch, assignment/stop controls, and UI permissions. The final shared-fixture validation passed all 39 tests in its two consumer files (164 seconds).
  • node scripts/check-changed.mjs --base origin/main and the follow-up --staged checks passed: formatting, production and test types, i18n, lint, dead-export scans, and the selected repository guards.
  • Independent conflict review, Codex autoreview, fresh fixture/documentation reviews, and the ClawSweeper review of the final head found no actionable issues.
  • The unrelated cron lint failure is fixed upstream by 743c2ceb72e7, included by the rebase; the affected cron file passes lint locally.
  • Six Chromium flows passed on the original implementation: member/other, member/own, and admin/other, each for archive and restore. The retained screenshots use the built Control UI with a deterministic mocked Gateway; they are not a deployed-server smoke test.

Before: a member can archive another creator's thread.

Before: member can archive another creator's thread

After: the same action is disabled with a creator/admin explanation.

After: archive requires the creator or an admin

@clawsweeper

clawsweeper Bot commented Sep 29, 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.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: web-ui App: web-ui gateway Gateway runtime agents Agent runtime and tooling size: M labels Sep 29, 2026
@stevenlee-oai
stevenlee-oai marked this pull request as ready for review September 29, 2026 03:43
@github-actions

github-actions Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ Security sensitive changes

This maintainer PR changes sensitive security components. This comment is informational because the PR author has repository Maintain or Admin access.

  • Current SHA: c8704d67e8f1c49c85b98115cf37aa19f3a100bb
  • Maintainer: @stevenlee-oai
  • Repository role: maintain

These security sensitive changes were made:

  • src/agents/tools/sessions-control-authority.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.

Carefully review these changes before merging.

@stevenlee-oai
stevenlee-oai enabled auto-merge (squash) September 29, 2026 03:48
@clawsweeper

clawsweeper Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 30, 2026, 3:23 PM ET / 19:23 UTC (Revision 5).

ClawSweeper review

What this changes

The branch restricts session archive and restore to creators and admins across Gateway requests, agent tools, and the Control UI, with updated tests and documentation.

Merge readiness

✅ Ready for maintainer review

Current main still permits assigned-owner archiving. This PR remains useful, and its maintain-level author explicitly accepted the documented upgrade change. The pinned patch has no actionable finding.

Priority: P1
Reviewed head: c8704d67e8f1c49c85b98115cf37aa19f3a100bb

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Direct UI images and final-effect boundary coverage support a sound patch; the accepted upgrade behavior remains visible in the review.
Proof confidence 🦞 diamond lobster (5/6) ✨ media proof bonus Sufficient (screenshot): Inspected Chromium images show the built Control UI disabling another creator’s archive action after the change. Production-path Gateway router and MCP HTTP harness cases cover allowed, forbidden, revoked, and replaced authority through persisted archive results; no stored-data contract changes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (screenshot): Inspected Chromium images show the built Control UI disabling another creator’s archive action after the change. Production-path Gateway router and MCP HTTP harness cases cover allowed, forbidden, revoked, and replaced authority through persisted archive results; no stored-data contract changes.
Evidence reviewed 8 items Current-main contract: Current main documents archive, restore, and stop access for sessions a write operator created or was assigned, so the requested restriction is not already implemented.
Gateway authority: The introduced archive-specific check requires a creator or admin role for single and batch session patches.
Final-effect guard: The existing patch engine invokes the mutation commit guard after asynchronous preparation and carries it into the session replacement write.
Findings None None.
Security None None.

How this fits together

The Gateway receives session changes from the Control UI and agent tools. It checks the caller against the session’s creator record before changing archived state in the session store.

flowchart LR
  UI[Control UI action] --> Gateway[Gateway request]
  Tool[Agent session tool] --> Gateway
  Gateway --> Role[Current creator or admin check]
  Role --> Guard[Commit-time authority check]
  Guard --> Store[Session store]
  Store --> Result[Archive or restore result]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +36, Tests +209, Docs +2. Total +247 across 20 files.

View PR surface stats
Area Files Added Removed Net
Source 7 45 9 +36
Tests 10 285 76 +209
Docs 3 5 3 +2
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 20 335 88 +247

Review metrics

Metric Value Why it matters
Code and test growth production +36 net lines, tests +209 net lines Production growth extends the existing authority path; the larger test change covers Gateway, transport, agent, and UI boundaries.

Technical review

Best possible solution:

Keep the Gateway’s creator/admin decision authoritative through the final archive write, with agent and UI controls reflecting it and admin recovery available for unattributed sessions.

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

Yes, from source: current main documents and permits assigned-owner archiving, and the inspected before screenshot shows the enabled UI action. I did not execute current main.

Is this the best way to solve the issue?

Yes. The patch checks current creator/admin authority at the Gateway boundary and before the stored write, while aligning the agent and UI controls with that decision.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 26c0e2693d38.

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient. Inspected Chromium images show the built Control UI disabling another creator’s archive action after the change. Production-path Gateway router and MCP HTTP harness cases cover allowed, forbidden, revoked, and replaced authority through persisted archive results; no stored-data contract changes.

Label justifications:

  • P1: The change addresses who may archive shared sessions through an active multi-user workflow.
  • merge-risk: 🚨 compatibility: Existing assigned owners lose archive and restore access after upgrade; the maintain-level author explicitly accepted and documented that tradeoff.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (screenshot): Inspected Chromium images show the built Control UI disabling another creator’s archive action after the change. Production-path Gateway router and MCP HTTP harness cases cover allowed, forbidden, revoked, and replaced authority through persisted archive results; no stored-data contract changes.
  • proof: sufficient: Contributor real behavior proof is sufficient. Inspected Chromium images show the built Control UI disabling another creator’s archive action after the change. Production-path Gateway router and MCP HTTP harness cases cover allowed, forbidden, revoked, and replaced authority through persisted archive results; no stored-data contract changes.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence. Inspected Chromium images show the built Control UI disabling another creator’s archive action after the change. Production-path Gateway router and MCP HTTP harness cases cover allowed, forbidden, revoked, and replaced authority through persisted archive results; no stored-data contract changes.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Vincent Koc: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

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 (4 earlier review cycles)
  • reviewed 2026-09-29T03:53:07.216Z sha 1012b41 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-30T18:23:32.120Z sha 4486458 :: blocked before merge. :: [P1] Handle the released assigned-owner archive contract
  • reviewed 2026-09-30T18:38:45.289Z sha 374381c :: blocked before merge. :: [P1] Resolve the released assigned-owner archive contract
  • reviewed 2026-09-30T19:06:01.526Z sha c8704d6 :: needs maintainer review before merge. :: none

@stevenlee-oai
stevenlee-oai force-pushed the dev/stevenlee/thread-archive-permissions branch from 1012b41 to 4486458 Compare September 30, 2026 18:15
@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 30, 2026
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. labels Sep 30, 2026
@stevenlee-oai

Copy link
Copy Markdown
Contributor Author

Codex: The requested policy is creator/admin-only archive and restore; assigned ownership does not grant these actions. This intentionally changes the prior assigned-owner behavior. The multi-user guide now states the upgrade impact and that an admin can archive or restore when the creator is unavailable or lacks usable profile attribution. Assigned-owner stop remains unchanged.

The current head also corrects the remaining deferred self-archive fixtures to use the authenticated creator. All 39 tests in the two shared-fixture consumer files and the required changed-file checks pass locally. Current-head CI is running.

@clawsweeper clawsweeper Bot added 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. proof: sufficient ClawSweeper judged the real behavior proof convincing. and removed proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 30, 2026
@stevenlee-oai
stevenlee-oai merged commit f02c8eb into main Sep 30, 2026
218 of 220 checks passed
@stevenlee-oai
stevenlee-oai deleted the dev/stevenlee/thread-archive-permissions branch September 30, 2026 19:26
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 1, 2026
* fix: restrict thread archiving to creators and admins

* test: align MCP archive fixtures with creator authority

* test: preserve deferred archive creator authority
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling app: web-ui App: web-ui docs Improvements or additions to documentation gateway Gateway runtime merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P1 High-priority user-facing bug, regression, or broken workflow. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. security-sensitive-changed size: M 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.

1 participant