Skip to content

feat(x): add guest mode for repository questions - #165354

Merged
steipete merged 2 commits into
mainfrom
steipete/x-guest-mode
Oct 5, 2026
Merged

steipete merged 2 commits into
mainfrom
steipete/x-guest-mode

Conversation

@steipete

@steipete steipete commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

The X bot currently drops mentions from people outside its maintainer allowlist. Operators need an easy way to answer public repository questions without granting those authors maintainer tools.

User Impact

Adds an off-by-default Guest mode switch to X replies and openclaw config set channels.x.guests.enabled true|false. Guests receive repository answers with a default limit of five mentions per author/account per UTC day and ten context posts. Maintainers retain their normal tools, sessions, and visible work-session links. Guest replies may cite URLs but never receive an appended work-session link.

Guest admission requires the X front-door agent to use the OpenClaw clone as its working directory, effective tools.fs.workspaceOnly: true, no selected skills, and sandbox mode off. Status explains missing prerequisites. Each guest mention uses its own channel session so it cannot inherit a maintainer's broader root or permission state. Operator controls must not widen guest session roots, permissions, or skill selections. The legacy groupPolicy: "open" setting cannot bypass the guest switch.

Subagent tools are deliberately excluded in this change. A separate core change owns safe hidden, same-agent delegation before that capability can be enabled for guests.

Why This Change Was Made

The host derives each tier solely from X's numeric author ID and the effective config/admin allowlist, retaining the existing revocation fence. A host-generated sender line precedes quoted thread data, and a channel tool-policy ceiling permits only read and ls. Config can narrow that ceiling; empty allowlists deny all tools. The guest policy also explicitly denies the core's implicit skill-read grant.

The toggle uses the SDK config-mutation owner and live administrator authority. Atomic, worker-backed plugin state owns quota accounting, retry reservations, UTC rollover, and bounded retention; storage capacity fails closed. Existing config publication/reload takes effect without restarting the Gateway.

Evidence

  • X suite: pnpm test extensions/x --maxWorkers=1 — 92 passed across 11 files, 154.62 seconds wall time including compilation. Includes forged sender text, hot on/off changes, containment prerequisites, normal maintainer behavior, revoked IDs, guest reply links, admin authorization/config persistence, concurrent quota admission, retries, and UTC rollover.
  • Native review checkout, exact final head: the X suite passed again — 92 tests across 11 files, 216.00 seconds wall.
  • Core filesystem boundary: 37 passed, 1 existing skip across agent-tools.session-permissions.test.ts and agent-tools.workspace-paths.test.ts, 206.94 seconds wall time. Exercises actual constructed filesystem tools, outside-root refusal, symlinks, full permission, and skill-root exceptions.
  • Extension production and test typechecks, typed lint on changed TypeScript, formatting, diff checks, config baseline and plugin inventory checks, docs config examples and links passed.
  • Synthetic Control UI browser proof exercised the real plugin bundle, asserted the x.guests.set request and resulting switch state, and inspected desktop/mobile renders. No authenticated live-X validation or deployments were performed. An additional isolated CLI process probe was blocked by the runtime-artifact publication guard because Gateway liveness could not be verified; no Gateway was stopped or changed. Config publication/reload is covered at the channel runtime boundary, and the generated schema is checked canonically.
  • The initial real SQLite quota test exposed a fixture routing error: shared-state admission requires the existing main-thread database-worker test lane. Registering the test in that lane and fixing fixture cleanup resolved it; production quota code was unchanged. The quota file's four real database cases took 17.802 seconds of test execution (71.70 seconds including compilation/import); they are intentionally above the five-second target to prove atomic admission and authority at the worker boundary. The final-head changed-extension CI bundle passed in 121 seconds (job wall time, including other routed coverage).

The first isolated review identified an admin-page readiness gap. The correction uses the same containment owner and the canonical X router for default and thread-specific routes; two new regressions failed before the correction and pass after it. The administrator page now shows the required setting instead of appearing ready while guests are blocked. A further regression verifies that multi-agent setups with only thread-specific bindings report a setup error rather than failing status/toggle requests.

Final isolated Codex autoreview is scoped-clean through P2 with no accepted/actionable findings. The feature is committed as 09434820e041; canonical bundled schema metadata is corrected in 9b36950ce286. Both the complete feature and the generated follow-up received scoped-clean review through P2.

Full pnpm build passed on the complete feature implementation before the generated-only follow-up, including SDK declaration/export checks and Control UI build. Cold-import screening also succeeded; its benchmark qualification is unavailable because the build declaration predates the final commit stamp. Initial CI run 37268121792 caught stale bundled channel-config metadata; the canonical generator was run, its check now passes, and corrective commit 9b36950ce286 was pushed. The correction changes only X’s generated schema; pnpm tsgo:core also passes. CodeQL selector run 37268121588 failed before analysis with a GitHub installation API-rate-limit error. No runs were repeated merely to obtain green. Final-head CI run 37272572259 is successful; Security Review 37272566700, CodeQL Critical Quality 37272571693, and precise OpenGrep 37272571709 also passed. Native merge admission remains pinned to this head.

Additional synthetic owner-boundary proof at 9b36950ce286 directly constructed the production core tools with the X guest policy and the documented filesystem settings. The resulting executable surface was exactly ls, read; reading and listing a synthetic repository succeeded. Absolute, relative, and symlink reads outside the root and an outside-root listing were refused. This used the real core policy pipeline and filesystem operations, with no model call. A separate controlled-promise probe exercised sendXDelivery → real ingress authorization → XApiClient: turning guest mode off while OAuth refresh was pending produced zero reply POSTs. Its single case passed in 57 ms of test execution; state and fetch were synthetic. These are owner-boundary proofs, not a live X or model end-to-end claim.

Guest executable tools: ls, read
Repository read/list: PASS
Absolute / relative / symlink escape: REFUSED
Outside-root directory listing: REFUSED
Guest switch disabled during token refresh: reply POST count = 0

The screenshots below are synthetic: before guest mode, enabled guest mode, and enabled-but-blocked readiness feedback.

X replies before guest mode

Guest mode enabled with daily counters

Guest mode reports missing repository containment

Allow public mentions through an explicit guest switch while deriving sender
tiers only from numeric X user IDs and the effective maintainer allowlist.
Keep guest tools limited to repository reads and listings, isolate each guest
mention from maintainer session state, and retain revocation fences.

Add bounded atomic daily author quotas, smaller guest thread context, quoted
post data, administrator config persistence, and guest readiness/status in
X replies. Preserve maintainer work sessions and omit their links from guest
replies. Document filesystem prerequisites and keep subagent tools excluded.
@clawsweeper

clawsweeper Bot commented Oct 5, 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 channel: x size: XL labels Oct 5, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. 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. labels Oct 5, 2026
@clawsweeper

clawsweeper Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed October 5, 2026, 2:56 AM ET / 06:56 UTC (Revision 4).

ClawSweeper review

What this changes

Adds optional repository-question replies to the X plugin with restricted guest tools, isolated sessions, daily quotas, and administrator controls.

Merge readiness

✅ Ready for maintainer review

Current main does not provide restricted guest admission, so this PR remains useful. The added production-boundary evidence addresses the previous proof request; no blocking introduced defect was found.

Priority: P2
Reviewed head: 9b36950ce286259deee374329a6c1756dfeabc0a

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A coherent plugin implementation with sufficient scoped production-boundary evidence and no blocking review findings.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (terminal): The added exact-head terminal evidence satisfies the earlier authority-boundary request: production tool construction permits repository reads and rejects filesystem escapes and stronger tools, while real ingress and XApiClient authorization prevent reply POSTs after guest-mode revocation during OAuth refresh. Inspected screenshots supplement UI proof. The new quota namespace leaves existing stored formats intact and needs no migration.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The added exact-head terminal evidence satisfies the earlier authority-boundary request: production tool construction permits repository reads and rejects filesystem escapes and stronger tools, while real ingress and XApiClient authorization prevent reply POSTs after guest-mode revocation during OAuth refresh. Inspected screenshots supplement UI proof. The new quota namespace leaves existing stored formats intact and needs no migration.
Evidence reviewed 8 items Pinned introduction and review continuity: Reviewed the merge-base-to-head introduction, not endpoint drift. Comparing the earlier reviewed feature head with the current head shows no changes under extensions/x/src; the follow-up corrects generated metadata. No prior code findings remained to resolve.
Current-main necessity: Current main has the X mentions plugin but no guest switch, quota, or repository-only guest policy. The latest release has no extensions/x tree, so the changed legacy open-policy behavior is not a shipped X configuration contract.
Guest authority restrictions: Numeric author IDs determine the tier. Guest policy permits only read and ls, explicitly denies implicit skill reads, and denies every tool for an empty selection. Admission checks filesystem containment, disabled skills, and sandbox settings; each guest mention receives a separate session.
Findings None None.
Security None None.

How this fits together

The X plugin receives public mentions and routes admitted authors into OpenClaw agent conversations. Guest admission restricts repository access before dispatch, while reply delivery rechecks authorization before posting publicly.

flowchart TD
  A[Public X mention] --> B[Numeric author authorization]
  B --> C[Maintainer session]
  B --> D[Guest switch and containment]
  D --> E[Daily quota and isolated session]
  E --> F[Repository read tools]
  C --> G[Reply authorization check]
  F --> G
  G --> H[Public X reply]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +666, Tests +654, Docs +99, Generated 0. Total +1419 across 25 files.

View PR surface stats
Area Files Added Removed Net
Source 15 703 37 +666
Tests 6 751 97 +654
Docs 1 124 25 +99
Config 0 0 0 0
Generated 3 5 5 0
Other 0 0 0 0
Total 25 1583 164 +1419

Review metrics

Metric Value Why it matters
Guest configuration 5 settings and 1 administrator method added Guest admission, quotas, context size, and tool narrowing are explicit operator controls with an off-by-default entry point.
Production versus test growth production +666; tests and test support +653 net lines Plugin-source growth has stated purposes in admission, containment, quota accounting, and administrator UI; generated metadata and documentation are excluded.

Technical review

Best possible solution:

Keep guest access optional and plugin-owned, with core enforcing filesystem restrictions and current authorization governing public reply delivery.

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

Not applicable as a feature request; current-main source confirms that restricted guest admission is absent, and the submitted evidence exercises the proposed boundaries.

Is this the best way to solve the issue?

Yes. The implementation uses existing routing, tool-policy, config-mutation, and worker-backed storage owners without adding a competing core capability.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient. The added exact-head terminal evidence satisfies the earlier authority-boundary request: production tool construction permits repository reads and rejects filesystem escapes and stronger tools, while real ingress and XApiClient authorization prevent reply POSTs after guest-mode revocation during OAuth refresh. Inspected screenshots supplement UI proof. The new quota namespace leaves existing stored formats intact and needs no migration.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The added exact-head terminal evidence satisfies the earlier authority-boundary request: production tool construction permits repository reads and rejects filesystem escapes and stronger tools, while real ingress and XApiClient authorization prevent reply POSTs after guest-mode revocation during OAuth refresh. Inspected screenshots supplement UI proof. The new quota namespace leaves existing stored formats intact and needs no migration.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.
  • remove merge-risk: 🚨 security-boundary: Current PR review selected no merge-risk labels.
  • remove status: 📣 needs proof: Current PR status label is status: 👀 ready for maintainer look.
  • remove proof: 📸 screenshot: Current real behavior proof evidence kind is terminal.

Label justifications:

  • P2: This is a bounded, optional X channel capability rather than an urgent regression or blocked existing user workflow.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The added exact-head terminal evidence satisfies the earlier authority-boundary request: production tool construction permits repository reads and rejects filesystem escapes and stronger tools, while real ingress and XApiClient authorization prevent reply POSTs after guest-mode revocation during OAuth refresh. Inspected screenshots supplement UI proof. The new quota namespace leaves existing stored formats intact and needs no migration.
  • proof: sufficient: Contributor real behavior proof is sufficient. The added exact-head terminal evidence satisfies the earlier authority-boundary request: production tool construction permits repository reads and rejects filesystem escapes and stronger tools, while real ingress and XApiClient authorization prevent reply POSTs after guest-mode revocation during OAuth refresh. Inspected screenshots supplement UI proof. The new quota namespace leaves existing stored formats intact and needs no migration.

Evidence

What I checked:

  • Pinned introduction and review continuity: Reviewed the merge-base-to-head introduction, not endpoint drift. Comparing the earlier reviewed feature head with the current head shows no changes under extensions/x/src; the follow-up corrects generated metadata. No prior code findings remained to resolve. (9b36950ce286)
  • Current-main necessity: Current main has the X mentions plugin but no guest switch, quota, or repository-only guest policy. The latest release has no extensions/x tree, so the changed legacy open-policy behavior is not a shipped X configuration contract. (extensions/x/src/channel.ts:72, faf63c5898e3)
  • Guest authority restrictions: Numeric author IDs determine the tier. Guest policy permits only read and ls, explicitly denies implicit skill reads, and denies every tool for an empty selection. Admission checks filesystem containment, disabled skills, and sandbox settings; each guest mention receives a separate session. (extensions/x/src/guest-policy.ts:29, 9b36950ce286)
  • Production-boundary proof added after the earlier review: The captured PR body reports exact-head construction of production core tools: executable tools were ls and read, repository operations succeeded, and absolute, relative, symlink, and directory escapes were refused. A controlled-promise probe used sendXDelivery, real ingress authorization, and XApiClient; disabling guests during OAuth refresh produced zero reply POSTs. Source inspection confirms authorization is checked at the client fetch handoff. These are bounded owner-level observations, not authenticated live-X or model end-to-end evidence. (extensions/x/src/send.ts:136, 9b36950ce286)
  • Visual evidence inspected: Inspected all three prepared screenshots: the previous allowlist page, enabled guest mode with counters, and enabled-but-blocked containment feedback. The body also records a synthetic browser run asserting the real plugin bundle's x.guests.set request and resulting switch state; screenshots establish visible UI behavior only. (extensions/x/src/control-ui.ts:162, 9b36950ce286)
  • Stored-state compatibility: Quota records use a new x.guest-usage namespace through the existing worker-backed keyed-store owner. Existing allowlist, cursor, and ingress formats are unchanged. Real database tests cover reopening reservations, concurrency, capacity rejection, and UTC rollover; guest config fields are additive and administrator toggles preserve sibling settings. (extensions/x/src/guest-usage.ts:29, 9b36950ce286)

Likely related people:

  • Peter Steinberger: Raw commit b878998 adds extensions/x/src/ingress.ts:18 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: b878998dbb19; files: extensions/x/src/ingress.ts)

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 (3 earlier review cycles)
  • reviewed 2026-10-05T05:28:37.029Z sha 0943482 :: needs maintainer review before merge. :: none
  • reviewed 2026-10-05T05:35:28.415Z sha 0943482 :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-05T06:40:59.944Z sha 9b36950 :: needs real behavior proof before merge. :: none

@steipete
steipete marked this pull request as ready for review October 5, 2026 05:30
@clawsweeper clawsweeper Bot added merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed 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. labels Oct 5, 2026
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. 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. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. labels Oct 5, 2026
@steipete
steipete merged commit dce3f8b into main Oct 5, 2026
173 checks passed
@steipete
steipete deleted the steipete/x-guest-mode branch October 5, 2026 06:58
@steipete

steipete commented Oct 5, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

MarMarLabs added a commit to MarMarLabs/openclaw that referenced this pull request Oct 5, 2026
133 upstream commits. Upstream's X guest mode (openclaw#165354) adds 18 channel
config entries. openclaw#165303 changes four Feishu files for webhook upgrades,
client.ts, client-timeout.ts, client.test.ts and doctor-contract.ts. This
branch touches none of them, so they merged as upstream has them.

Three generated files conflicted, docs/.generated/config-baseline.counts.json,
config-baseline.sha256 and src/config/bundled-channel-config-metadata.generated.ts.
All three were regenerated from this merge rather than hand-merged.
build:docker ran in a separate detached checkout of this commit. Counts are
core 2505, channel 3866 and plugin 4490, which is upstream's counts plus
this branch's two channel entries. The core and plugin hashes match
upstream/main and the channel hash is new, as predicted. The three
generated-file checks pass there.

Feishu: 102 files and 1523 tests in the extension project, 17 files and 241
tests in the database-workers project, all passing. The forwarder test and
the routing guards pass, 503 tests. tsgo:core, tsgo:extensions,
tsgo:extensions:test, tsgo:test:root, the line-cap, max-lines,
assertion-safety, database-worker, test-timeout-race and test-mock-exports
ratchets against upstream/main, oxlint and oxfmt on the 43 changed code
files all pass.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 6, 2026
* feat(x): add guest mode for repository questions

Allow public mentions through an explicit guest switch while deriving sender
tiers only from numeric X user IDs and the effective maintainer allowlist.
Keep guest tools limited to repository reads and listings, isolate each guest
mention from maintainer session state, and retain revocation fences.

Add bounded atomic daily author quotas, smaller guest thread context, quoted
post data, administrator config persistence, and guest readiness/status in
X replies. Preserve maintainer work sessions and omit their links from guest
replies. Document filesystem prerequisites and keep subagent tools excluded.

* fix(x): include guest settings in bundled config metadata
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: x docs Improvements or additions to documentation P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XL 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