Repository navigation
Conversation
Stream source activity through bounded SQLite batches, preserve report outputs, and reuse accepted closed days during boot retries.
|
🦞👀 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 26, 2026, 3:15 PM ET / 19:15 UTC. ClawSweeper reviewWhat this changesMoves Team Reports collection and aggregation into workers, stages activity in bounded SQLite batches, and lets boot catch-up reuse accepted closed daily reports. Regression provenancePossible regression — suspected (reviewed change). No predecessor PR is attributed. Merge readiness⛔ Blocked before merge - 3 items remain Current main still runs Team Reports collection on the Gateway event loop, so this PR remains useful. One introduced catch-up check can silently reuse a daily report after its source settings change and should be repaired before merge. Priority: P2 Review scores
Verification
How this fits togetherThe Team Reports plugin collects GitHub and optional Discord activity, combines it with a roster, and stores daily and summary reports in its SQLite database. The Gateway serves those reports through plugin routes and commands. flowchart LR
A[GitHub and Discord] --> B[Collection worker]
B --> C[Bounded activity batches]
C --> D[SQLite store worker]
D --> E[Daily and period reports]
E --> F[Gateway report views]
G[Catch-up settings] --> B
Before merge
Findings
Agent review detailsSecurityNone. PR surfaceSource +495, Tests +678, Docs +24, Config +1, Other +4. Total +1202 across 29 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Copy recommended automerge instructionTechnical reviewBest possible solution: Keep collection and aggregation in workers, and reuse a stored day during catch-up only when its source settings can be verified against the current settings; otherwise recollect it. Do we have a high-confidence way to reproduce the issue? Yes, from source: save a healthy GitHub-only closed day during a partially failed run, enable Discord, then restart into boot catch-up. The new condition skips that day because only GitHub organizations are compared; this scenario was not executed in this read-only review. Is this the best way to solve the issue? Yes for the worker cutover, subject to the catch-up repair. The existing Plugin SDK worker pool and SQLite store owner fit this performance change; stored-day reuse needs a complete scope check. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against cafb3a4d1ca2. LabelsLabel changes:
Label justifications:
EvidenceAcceptance criteria:
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
|
…law#159101) * perf(team-reports): move report collection off the gateway thread Stream source activity through bounded SQLite batches, preserve report outputs, and reuse accepted closed days during boot retries. * chore(team-reports): register the fixture benchmark entrypoint
What Problem This Solves
Large Team Reports collection runs parse source responses and aggregate activity on the Gateway event loop, causing heap churn and pauses while reports are generated.
User Impact
Report collection runs in a worker, with bounded batches staged in SQLite. Report counts, attribution, JSON, and Markdown stay unchanged. Boot catch-up reuses accepted closed days when retrying a partially failed run; explicit manual generation still refreshes the requested day.
There is no new configuration, durable schema migration, or retention change. Existing databases reopen unchanged. Scratch activity belongs to the existing store connection and disappears on close. Week/month reports already used stored days on this base; this preserves that behavior.
Why This Change Was Made
Uses the existing public
WorkerTaskPool/serveWorkerTaskscontract fromopenclaw/plugin-sdk/process-runtimeandopenclaw/plugin-sdk/worker-task-server, documented in worker task admission. The host retains the SQLite broker and LLM capability; it forwards bounded requests and drains admitted callbacks before closing storage. No new SDK surface or alternate inline production execution path is added.Collectors upsert at most 100 events per batch. Aggregation decodes payloads in bounded queries, caps retained evidence while counting, and reads daily rollups under one SQLite snapshot. Compact sort identities still scale with event count to preserve the existing JavaScript collation; full source bodies no longer accumulate for the period. Production growth is about 500 lines, above the lane's 150-line guideline because this includes the complete worker lifecycle/host bridge and store cutover.
Evidence
Synthetic fixture: 2,000 issues, 1,000 commits, 1,500 Discord messages, 93 repositories, 12 channels, and 692 threads. Real collectors, generation, SQLite backend, and production worker run with fixture HTTP responses; summaries are disabled. Measurements include instrumentation and worker startup.
An earlier same-lease worker run measured 52.02 MiB / 5.54 ms synchronous / 6.40 ms event-loop turn. Both worker runs meet the <100 MiB / <50 ms targets. Worker startup and IPC increase this zero-latency fixture's elapsed time; the intended improvement is Gateway responsiveness. Running the new streaming collector directly measured 80.91 MiB and 16.72 ms synchronous, with aggregation still in the SQLite worker.
Daily and monthly report JSON and Markdown SHA-256 values match the baseline exactly in all runs. This fixture measures main-isolate heap, not total process RSS, and does not reproduce the full production multi-GB burst. No live API run, deployment, restart, or Gateway instrumentation was performed.
All heavy proof used
blacksmith-testbox, profileopenclaw-check:tbx_01m3fbd407ym1nb3j74jhpdtqbpnpm install --frozen-lockfilepassed. Two plugin-suite attempts stopped at checksum-sync timeout before tests ran.tbx_01m3fct9bg88ccbkctzmjp2zahnode scripts/run-vitest.mjs extensions/team-reports --maxWorkers=1: 271 tests / 17 files passed, 50.77 s wrapper wall time. Changed checks identified missing safety comments, subsequently fixed. Reuse eventually hit the same sync timeout.tbx_01m3fdmypdkpy63hfq39mt1cj1node scripts/check-changed.mjs --base HEADfound a flattened LLM request union, then lint issues; all were fixed. Production/test typechecks, metadata, dependency and dead-export guards passed. Reuse hit a checksum-sync timeout.tbx_01m3ferha8qptqsht2zpfqbzmrcheck-plugin-npm-runtime-builds.mts --package extensions/team-reportsbuilt all four runtime entries. Final worker/direct benchmarks passed with matching output hashes.node scripts/check-changed.mjs --base HEADpassed, including production/test types, all extension lint, metadata, dependency/dead-export/sidecar/cycle guards.tbx_01m3fhcfk5h41ftdx2b2rgcxtypnpm deadcode:fullandnode --import ./scripts/tsx.mjs scripts/check-deadcode-unused-files.mtspassed; both unused-file scans reported zero entries.Changed-test costs on the final lease, measured with
/usr/bin/time pnpm test <file> --maxWorkers=1 --reporter=dot: aggregate 1.84 s; scheduler 26.40 s; store 9.86 s; GitHub source 1.75 s; Discord source 1.62 s; worker lifecycle 5.64 s. All passed. Scheduler/store wall time includes worker compilation/import and real SQLite lifecycle coverage; the new worker test itself took about 0.15 s.The new lifecycle test exercises real worker exit and retained host callback settlement. Added coverage also protects batch backpressure, cross-batch upserts/comment deduplication, exact Unicode comment identity, and boot catch-up after partial failure. The benchmark is standalone test support, adding no per-PR timed benchmark. Existing test coverage remains intact. All leases are stopped at handoff.
Reproduce the benchmark with:
Independent Codex autoreview: no actionable P0–P2 findings. The first GitHub CI run passed its four selected test jobs (55, 90, 103, and 110 seconds) and completed type checks, but the dependency lane found the standalone benchmark absent from the unused-file entrypoint graph. The benchmark's real command is now documented and registered in the test-aware Knip configuration, with no ignore or baseline relaxation. The exact failed scans pass on the repair lease above. Final CI succeeded on
acb327afa77d4208a35d1c9e971b8188e5f9ca85, includingopenclaw/ci-gate. The selected node jobs completed in 57–109 seconds.