Repository navigation
feat(x): add the X (Twitter) mentions channel plugin - #165138
Conversation
|
🦞👀 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 real behavior proof before merge. Reviewed October 4, 2026, 7:23 PM ET / 23:23 UTC (Revision 3). ClawSweeper reviewWhat this changesAdds an X mentions channel with public reply chains, administrator allowlist controls, durable recovery, setup documentation, and clearer xAI plugin labels. Merge readiness⛔ Blocked before merge - 6 items remain This maintainer-authored PR remains useful and is not implemented on fetched main. The previously reported allowlist-revocation defect remains, and authorization proof still does not reach production dispatch and final X transport. Priority: P2 Review scores
Verification
How this fits togetherThe X plugin receives mentions, checks sender access, and passes accepted posts with thread context into OpenClaw’s agent workflow. Agent answers return through the plugin as public X replies. flowchart TD
A[X mention feed] --> B[Durable incoming queue]
C[Config and administrator allowlist] --> D[Sender authorization]
B --> D
D --> E[Thread context and agent dispatch]
E --> F[Reply authorization]
C --> F
F --> G[Public X reply chain]
Before merge
Findings
Agent review detailsSecurityNeeds attention: Stored allowlist revocation can fail to stop a pending authorization decision before agent dispatch or public posting. PR surfaceSource +2613, Tests +1882, Docs +273, Config +33, Generated +5, Other +23. Total +4829 across 52 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep one plugin-owned allowlist authority that invalidates captured grants on removal and remains current at agent dispatch and every public reply handoff. Do we have a high-confidence way to reproduce the issue? Yes, source establishes the race: remove a stored-only sender after its IDs are captured but before policy resolution finishes; config identity remains unchanged and the captured grant can still authorize the effect. No runtime reproduction was executed. Is this the best way to solve the issue? The plugin uses the appropriate existing SDK and durable-ingress owners, but the authorization implementation needs repair: rereading a store before asynchronous resolution does not establish live authority at the final effect. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 5837209ed1ba. LabelsLabel changes:
Label justifications:
EvidenceSecurity concerns:
What 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 (2 earlier review cycles)
|
Connect allowlisted X mentions to bound group sessions with thread context, durable ingress, account-scoped cursors, and public threaded replies. Preserve visible work-session links and append a configurable automation signature. Verify both the bot recipient and sender before dispatch. Support Activity streaming with polling fallback, SecretRef inputs and OAuth refresh rotation, and administrator-only allowlist controls in the X replies plugin page. Keep channel routing, queue custody and ambiguous-delivery recovery with their existing core owners. Use only SDK subpaths available in OpenClaw 2026.9.8.
Cover cursor ordering and replay handoff, stream recipient filtering and fallback, thread assembly, weighted reply chains, refresh ownership, and administrator authorization. Distinguish safe pre-dispatch failures from uncertain POST outcomes and preserve receipts for partial reply chains. Validation: X suite 50 tests in 15.93s wall time; Zalo sibling suite 164 tests in 145.31s. The shared host ambiguity integration suite also passed 8 tests. The X queue fixture proves the plugin contract, not SQLite crash durability.
Document bot credentials, event modes, account settings, the allowlist page, thread context and public reply behavior. Explain API costs, retry uncertainty, and the 2026.9.8 SDK compatibility boundary. Add the channel to navigation, glossary and generated plugin/channel inventories. Record exactly 58 new channel config entries and 21 standard plugin entries in the canonical config baseline; core field count remains unchanged.
A 429 or other client rejection of the reply POST proves X created no post, so the reply now carries the not-dispatched marker (retryable only for 429). Server errors after dispatch stay ambiguous so a retry cannot duplicate a public reply.
a3ab549 to
4b91c23
Compare
17 upstream commits. Upstream's new X mentions channel (openclaw#165138) adds 60 channel and 21 plugin config entries. openclaw#165095 drops the search emoji from a tool label in two Feishu tests, reply-dispatcher.test.ts and streaming-card.test.ts. Both merged cleanly, and this branch has no other copy of those lines. 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 2502, channel 3848 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 1521 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.
Pin the X runtime API to its existing runtime setter so plugin contract validation recognizes the bundled channel and catches export growth. Refs #165138.
* feat(x): add bundled mentions and public reply channel Connect allowlisted X mentions to bound group sessions with thread context, durable ingress, account-scoped cursors, and public threaded replies. Preserve visible work-session links and append a configurable automation signature. Verify both the bot recipient and sender before dispatch. Support Activity streaming with polling fallback, SecretRef inputs and OAuth refresh rotation, and administrator-only allowlist controls in the X replies plugin page. Keep channel routing, queue custody and ambiguous-delivery recovery with their existing core owners. Use only SDK subpaths available in OpenClaw 2026.9.8. * test(x): verify mention delivery and operator controls Cover cursor ordering and replay handoff, stream recipient filtering and fallback, thread assembly, weighted reply chains, refresh ownership, and administrator authorization. Distinguish safe pre-dispatch failures from uncertain POST outcomes and preserve receipts for partial reply chains. Validation: X suite 50 tests in 15.93s wall time; Zalo sibling suite 164 tests in 145.31s. The shared host ambiguity integration suite also passed 8 tests. The X queue fixture proves the plugin contract, not SQLite crash durability. * docs(x): document setup, access controls and API costs Document bot credentials, event modes, account settings, the allowlist page, thread context and public reply behavior. Explain API costs, retry uncertainty, and the 2026.9.8 SDK compatibility boundary. Add the channel to navigation, glossary and generated plugin/channel inventories. Record exactly 58 new channel config entries and 21 standard plugin entries in the canonical config baseline; core field count remains unchanged. * fix(x): use a product-neutral default reply signature * fix(x): log the reason when an allowlist method fails * fix(x): treat 4xx reply rejections as undelivered and keep 5xx ambiguous A 429 or other client rejection of the reply POST proves X created no post, so the reply now carries the not-dispatched marker (retryable only for 429). Server errors after dispatch stay ambiguous so a retry cannot duplicate a public reply. * improve(xai): name and describe the xAI plugin in its manifest * docs(xai): regenerate config baseline for plugin display name * fix(x): satisfy bundled channel and build contracts * test(x): preserve real exports in partial mocks
Pin the X runtime API to its existing runtime setter so plugin contract validation recognizes the bundled channel and catches export growth. Refs openclaw#165138.
What Problem This Solves
Maintainers want to steer a team agent by mentioning its bot account on X and receive the result as a public reply linking to the resulting work session; OpenClaw had no X channel.
User Impact
Adds the bundled X (Twitter) channel plugin (
x, configured throughchannels.x). Mentions from allowlisted X accounts become agent turns with the available thread as context. Answers are posted as public reply chains, with 280-character splitting, URL weighting throughlinkify-itandtlds, and any visible work-session URL appended.Administrators manage allowed accounts through the X replies Control UI page and
x.allowlist.*Gateway methods. Activity API streaming (post.mention.create) has a polling fallback. Durable ingress, a persistedsince_idcursor, and persisted OAuth2 refresh-token rotation support recovery. DMs, media, likes, and follows are unsupported in v1. Setup, access controls, and API costs are documented indocs/channels/x.md.The
xaiprovider manifest also gets a name and description so it no longer appears as a bare ID beside “X (Twitter)” in plugin lists.Live X round-trip proof remains pending a separately approved Team deployment. This PR does not deploy or restart a Gateway.
Why This Change Was Made
X moved to pay-per-use API pricing in February 2026. Per-event Activity streaming avoids routine polling cost and targets real mentions. The plugin refuses posts that do not mention the configured bot; X API replies are restricted to posts that mention or quote the app account. The existing core owns ingress admission, durable delivery custody, and agent dispatch; the plugin owns X transport, account state, and reply encoding.
Evidence
pnpm config:docs:gen; the seven commits otherwise replayed unchanged. Product code is patch-identical to the coordinator-reviewed source. The rebase X suite and core typecheck pass. A separate generated-hash repair incorporates the final xAI display labels; it changes no config counts and passed a focused Codex autoreview with no P0–P2 findings.plugins:inventory:check, config-baseline checks, samplechannels.xconfig validation, and CLI discovery (plugins listreportsxloaded and enabled).pnpm test extensions/x --maxWorkers=1passed 8 files / 53 tests in 91.42 s wall time (83.07 s Vitest), including a cold worker-cache build.pnpm tsgo:coreand the finalpnpm config:docs:checkpass. Review-checkout proof and exact-head CI evidence will be added below. CI seconds are not yet available. NoCHANGELOG.mdedits: release notes are generated at release time.X replies — before
X replies — after