Repository navigation
perf(team-reports): defer catch-up until scheduled runs - #165356
Conversation
Remove the startup catch-up timer and unbounded run-history read. Recover yesterday in the first scheduled worker run, reuse accepted closed reports, and keep automatic collection outside a five-minute startup grace period. Preserve UTC cadence, daily recurrence across midnight, and manual generation.
|
🦞👀 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, 1:37 AM ET / 05:37 UTC. ClawSweeper reviewWhat this changesTeam Reports defers automatic catch-up to scheduled collection after a five-minute startup grace period, updates scheduling regressions and documentation, and changes an example summary model. Merge readiness✅ Ready for maintainer review This PR remains useful: current main still performs startup catch-up after 60 seconds. No actionable introduced defect was found, and the supplied production-path evidence supports the startup change. Likely related people: steipete and Vincent Koc, based on prior merged work in scheduling and report preservation. Priority: P2 Review scores
Verification
How this fits togetherTeam Reports collects GitHub and optional Discord activity into stored daily reports and weekly/monthly aggregates. Its service scheduler starts report workers, while manual generation remains available through Gateway commands. flowchart TD
A[Service startup] --> B[Startup grace and UTC schedule]
B --> C[First scheduled run]
C --> D[Reuse accepted yesterday report]
C --> E[Collect missing and current activity]
F[Manual generation] --> E
D --> G[Stored reports and aggregates]
E --> G
G --> H[Reports pages and exports]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource -26, Tests -23, Docs +2. Total -47 across 4 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Use the existing service scheduler and report worker as the single automatic collection path, preserving UTC recurrence, accepted reports, and immediate manual generation. Do we have a high-confidence way to reproduce the issue? Not applicable as a bug reproduction requirement: source inspection establishes the existing 60-second catch-up mechanism, and the supplied runtime evidence observes quiet startup after the change. Is this the best way to solve the issue? Yes. Folding catch-up into the existing scheduled worker path removes duplicate startup work while retaining manual generation and the established report-reuse contract. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against f27df1d88709. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
) Remove the startup catch-up timer and unbounded run-history read. Recover yesterday in the first scheduled worker run, reuse accepted closed reports, and keep automatic collection outside a five-minute startup grace period. Preserve UTC cadence, daily recurrence across midnight, and manual generation.
What Problem This Solves
Team Reports queued catch-up collection 60 seconds after service startup, overlapping client reconnection and running separately from its UTC schedule. Startup also loaded all successful run history to decide whether to collect.
User Impact
Automatic collection waits at least five minutes after service start. The first scheduled run recovers yesterday and refreshes today; later intraday runs retain their UTC cadence. Intraday boundaries within the grace period are skipped; a daily run due in that window waits until its end. Manual generation remains immediately available.
Why This Change Was Made
The fetch/parse/report pipeline already runs in the SDK worker pool (#159101). This change removes the startup timer and history scan and uses the existing worker's accepted-closed-day reuse. Daily recurrence stays anchored to its original scheduled date, including a startup delay across midnight. No new config, schema, worker, or rendering path.
Production code: 23 added / 49 removed, net -26 lines. Including the README, the production-path diff (
git diff --stat origin/main...HEAD -- ':!*.test.ts' ':!*test-support*' ':!docs/*') is 27 added / 51 removed, net -24.Evidence
Before: automatic catch-up at 60 seconds. After: a noon start first collects at 16:00 UTC; a 03:59 start skips 04:00 and collects at 08:00. A daily run due at 00:05 after a 00:04 start waits until 00:09. The regression fails on the original scheduler.
Final proof used Blacksmith Testbox (
blacksmith-testbox)tbx_01m457e541ppwvc4jd6zs2t1wt, based onddf95b6c52db:node scripts/run-vitest.mjs extensions/team-reports --maxWorkers=1: 271 tests / 18 files passed, 53.52 s wall time.node scripts/check-changed.mjs --staged: stops on the inherited stale max-lines entry forextensions/oc-path/src/oc-path/universal.ts. Continuing the unchanged selected check plan yielded 28/29 passing, including production/test types, lint, dead exports, plugin boundaries, and runtime guards. The aggregate gate is not green; that unrelated baseline is unchanged by this PR.node --import ./scripts/tsx.mjs scripts/build-all.mts sourcePerformance: passed, 39.5 s.Fixture: 93 repos, 2,000 issues, 1,000 commits, 692 Discord threads, 1,500 messages. Both runs produced identical daily/monthly report JSON and Markdown hashes after normalizing generation timestamps.
Main-thread loop-delay max by phase (ms)
Earlier Testbox
tbx_01m4550v479katcs22rs3k0ehgproved the baseline-failing startup regression, fullpnpm build, and the focusedpnpm test extensions/team-reports/src/scheduler.test.ts --maxWorkers=1cost: 35 tests, 26.72 s wall time including compiled-worker preparation. Independent Codex review returned scoped-clean, no actionable P0–P2 findings.These are cold/warm measurements of the existing worker pipeline, not a claim that this scheduling diff removed historical multi-second parsing stalls. Live API latency/model calls and the original stall attribution remain unproven.
Exact-head CI run 37268268035 passed on
7590c50b2e0e, includingopenclaw/ci-gateand the baseline-ratchet job. The extension bundle job took 109 CI seconds.A separate CodeQL Critical Quality shard-selection job failed before analysis because its GitHub installation API returned HTTP 403 rate-limit exhaustion. This is an infrastructure gap, not a report-test or typecheck failure.