Repository navigation
improve(msteams): reduce repeated reads during poll cleanup - #146575
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: blocked before merge. Reviewed September 12, 2026, 8:22 PM ET / September 13, 2026, 00:22 UTC (Revision 2). ClawSweeper reviewWhat this changesThe Teams plugin reuses vote data during poll cleanup, serializes legacy imports with voting, and adds a published-upgrade validation scenario. Merge readiness⛔ Blocked before merge - 2 items remain Keep open: this is useful, maintainer-sponsored work absent from current main and v2026.9.4. Source review found no blocking introduced code defect. Priority: P2 Review scores
Verification
How this fits togetherThe Teams plugin stores poll metadata and votes in OpenClaw’s shared SQLite database. Poll creation, incoming votes, and Doctor’s legacy imports access this state before subsequent poll reads and cleanup. flowchart TD
A[Poll creation and incoming votes] --> C[Shared poll mutation lock]
B[Doctor legacy import] --> C
C --> D[Poll metadata and vote storage]
D --> E{Expired or excess polls?}
E -->|Yes| F[Cleanup using one vote snapshot]
E -->|No| G[Retained polls and votes]
F --> G
Before merge
Agent review detailsSecurityNone. PR surfaceSource +18, Tests +446, Other +221. Total +685 across 13 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep one poll mutation lock and a lazy per-prune snapshot while preserving existing votes, retention, archive bytes, and upgrade behavior. Do we have a high-confidence way to reproduce the issue? Yes, from source: pruning multiple polls repeats full bucket reads, and an unlocked importer can overwrite a vote submitted between its lookup and write. This review did not execute a reproduction. Is this the best way to solve the issue? Yes. Reusing the existing lock and a mutation-local snapshot addresses both mechanisms without adding a competing store, SDK API, schema, or configuration option. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 94a56b2f78fb. LabelsLabel justifications:
EvidenceWhat 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 (1 earlier review cycle)
|
|
Merged via squash.
|
…#146575) * improve(msteams): reduce repeated reads during poll cleanup * test(upgrade): preserve balanced recovery scenario blocks --------- Co-authored-by: Peter Steinberger <[email protected]>
Related: #146197
What Problem This Solves
Teams poll creation repeatedly fetches every stored vote bucket when cleaning up several expired or excess polls. A concurrent Doctor import can also race with a vote submitted through the direct CLI path.
User Impact
Poll cleanup loads fewer rows while preserving retained polls and votes. Doctor imports share the existing poll mutation lock, so they cannot overwrite a concurrent vote. No new storage migration, configuration change, or operator action is required.
Why This Change Was Made
Reuse one ordered vote-bucket snapshot within each locked prune, loading it only after the first metadata deletion. The legacy poll importer uses that same lock through import, verification, and archival. Existing quotas, retention, transaction boundaries, and partial-failure ordering stay intact.
An opt-in published-upgrade scenario installs the standalone Teams plugin, checks upgrade survival, then verifies installed candidate code before exercising a separate candidate Doctor import.
Evidence
Validation completed:
Timings are from one WSL Linux host with Node 26.8.2 and include lock acquisition, store open, metadata/vote writes, and pruning. Fixture backup and verification are outside timing. The no-prune case shows no demonstrated timing change. Three bounded benchmark harness invocations reached their 180-second limit; the larger fixture has only three completed measured pairs and no counted sample, so it is excluded from this table. Completed results were preserved between the last two invocations.
All 264 planner, assertion and upgrade-fixture tests pass, as do six Doctor declaration/closure guards. Fresh independent review found no actionable P0-P2 findings. Production, extension-test, script and root-test types pass, along with formatting, lint and selected guards. All 264 harness tests and 15 poll tests pass again on the final source checkout. Initial test-style errors were fixed; the nested-install lint guard was resolved with a separate physical worktree and its own frozen install.
CI exposed a test extraction starting inside the newly guarded consent block. The follow-up extracts the complete recovery region without changing assertions: the original test fails with an unmatched
fi, and all 37 mobile, watchOS and Teams scenario tests pass after the repair. Scoped checks and fresh independent review pass.The opt-in upgrade scenario uses published OpenClaw and Teams 2026.9.4. It checks first-hop preservation, then compares installed JavaScript against the candidate Teams archive before importing a separate legacy specimen through candidate Doctor. The first specimen may be imported before the external plugin refresh; it is not attributed to the new importer. Package Acceptance run 34726845164 tests source 8ed0875; the final follow-up cfd3dc2 changes only the unpublished mobile test. All product, build and upgrade-runner sources are unchanged. This supports reuse of the runtime proof, but does not claim byte-identical rebuilt packages or acceptance on the final commit. Final-head required CI 34727480190 passed. Package Acceptance 34726845164 passed on its first attempt: exactly one Teams cell, 570 seconds, no retries or timeouts. The retained log confirms published-driver migration, byte-for-byte verification of all 35 installed candidate runtime files, a separately seeded Doctor import, subsequent survival assertions, and Gateway start/health/status. The survival assertions verify complete metadata/votes, storage keys, null TTLs and exact archive bytes. The uploaded artifact retains the lane log, plan and summary; raw database/archive files were not uploaded for separate inspection. Restart mode was manual. No live Teams messages or production state are used.
Candidate core tarball SHA-256:
07c513888262fd8d74246736db376874d3acf62b7da7b1220c2cf3bfd5af09e4. Candidate Teams tarball SHA-256:8aa6c09f33b5746644f803b080d3d2ba8bc583d23f7ed5f8cd95986da759238b. Upgrade evidence artifact.Native landing completed as
369f63b633d879eddabff4e3da6d3cb8306b6388and was verified on main. Native completion.