Repository navigation
fix(x): backfill mentions during Activity streaming and flag unparseable events - #165376
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 maintainer review before merge. Reviewed October 5, 2026, 3:46 AM ET / 07:46 UTC (Revision 3). ClawSweeper reviewWhat this changesThe X plugin periodically backfills missed mentions during streaming and reports repeated malformed mention events without exposing post content. Merge readiness✅ Ready for maintainer review This PR remains useful: current main still lacks periodic recovery during a connected Activity stream. The prior parser finding is resolved, and this review found no new actionable defect or migration requirement. Priority: P2 Review scores
Verification
How this fits togetherThe X plugin receives bot mentions through Activity streaming and the mentions API. Both paths feed the existing deduplicating ingress queue, which checks sender access before dispatching agent turns and public replies. flowchart TD
A[Activity stream] --> C[Mention validation]
B[Periodic mentions backfill] --> D[Deduplicating ingress queue]
C --> D
C --> E[Parser warning and channel status]
D --> F[Current sender authorization]
F --> G[Agent turn and public reply]
B --> H[Completed backfill cursor]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +45, Tests +186, Docs +10. Total +241 across 6 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Technical reviewBest possible solution: Keep recovery in the existing mentions and ingress owners, with only completed backfills advancing the cursor and diagnostics excluding intentionally ignored events. Do we have a high-confidence way to reproduce the issue? Yes, from source: a connected stream can omit an older mention while a newer streamed post advances main's cursor past it. The saved-cursor regression exercises that scenario; this read-only review did not execute it. Is this the best way to solve the issue? Yes. Reusing the existing mentions API and deduplicating ingress queue avoids a competing delivery owner, and retaining the cursor until backfill completes addresses the gap directly. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 599bcd79e5ae. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
History |
|
Merged via explicitly authorized admin squash with attributed pre-existing CI failures.
|
…ble events (openclaw#165376) * fix(x): backfill mentions during Activity streaming and flag unparseable events * fix(x): ignore unrelated Activity events in parse diagnostics
Related: #165337
What Problem This Solves
Fixes missed X mentions when an Activity stream stays connected without delivering every event, and makes repeated unparseable events visible to operators.
User Impact
Streaming checks for missed mentions every four polling intervals (at least 60 seconds; 240 seconds by default), while the existing ingress queue deduplicates posts delivered by both paths. Three consecutive unparseable mention events or malformed lines produce one content-free warning and channel status message, cleared by the next good mention. Blank keep-alives and intentionally ignored event types do not count.
Why This Change Was Made
A connected stream previously backfilled only on connection. Periodic backfill now uses the existing mentions API and ingress admission paths. Only completed backfills advance the durable cursor, so a newer streamed post cannot hide an older missing mention from the next poll. There is no new configuration key; additional reads use the X API pricing described in the channel docs.
The existing documented-envelope parser and recipient verification are unchanged. The rebase also preserves the allowlist revocation fence introduced on main.
No persistent format or schema changes:
x.cursorstill stores{ userId, sinceId }, and ingress payload version 1 is unchanged. The monitor regression starts with the existing saved cursor and proves recovery/deduplication using that state. No migration is required.Evidence
5529f1f3cac7ccdbec95bcc07236b069a1c9f298:pnpm test extensions/x --maxWorkers=1passed 81 tests across 9 files in 121.72 seconds wall time. The development checkout also passed all 81 tests in 229.67 seconds.oxfmt --check,git diff --check, and docs MDX validation passed. SDK declaration preparation needed the supported longer preparation budget after an initial timeout; no checks were skipped.CI run 37276033172 tested this exact head merged with main. The X job passed 102 tests across 11 files, including the landed guest-mode tests, in two Vitest shards of 11.65 and 13.49 seconds (106 seconds total job time). X/extension typechecks, typed lint, docs, package boundaries, and security-fast passed.
Inherited CI exception:
check-test-types-core-5failed onsrc/gateway/server-lifecycle.catalog-write.test.ts:162with TS2739 because the existing fixture omitsresolveGatewayContextandloadSubagentRegistryActivation. The fixture andserver-startup-observers.tssignature owner are byte-identical in baselinefdd3a97f23ef, tested mergec20186e44d83, and independently inspected mainbbaabd6ced15; this PR changes neither file. Fail-fast then cancelled production types and core test-types stripe 2, and the aggregate failed. Those cancelled checks are not claimed as passing. Native landing retains the exact checkout, source-identity, failure, and cancellation evidence for the authorized inherited-failure exception; no CI rerun or proof-only push was made.Validation uses simulated X responses and the existing host queue double. No authenticated live X delivery test or deployment was performed, and no full local
pnpm buildwas run.