Repository navigation
feat(x): add guest mode for repository questions - #165354
Conversation
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.
|
🦞👀 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. Reviewed October 5, 2026, 2:56 AM ET / 06:56 UTC (Revision 4). ClawSweeper reviewWhat this changesAdds 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 Review scores
Verification
How this fits togetherThe 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]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +666, Tests +654, Docs +99, Generated 0. Total +1419 across 25 files. View PR surface stats
Review metrics
Technical reviewBest 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. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (3 earlier review cycles) |
|
Merged via squash.
|
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.
* 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
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 legacygroupPolicy: "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
readandls. 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
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.agent-tools.session-permissions.test.tsandagent-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.x.guests.setrequest 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 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 in9b36950ce286. Both the complete feature and the generated follow-up received scoped-clean review through P2.Full
pnpm buildpassed 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 commit9b36950ce286was pushed. The correction changes only X’s generated schema;pnpm tsgo:corealso 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
9b36950ce286directly constructed the production core tools with the X guest policy and the documented filesystem settings. The resulting executable surface was exactlyls, 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 exercisedsendXDelivery→ 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.The screenshots below are synthetic: before guest mode, enabled guest mode, and enabled-but-blocked readiness feedback.