Skip to content

perf(team-reports): defer catch-up until scheduled runs - #165356

Merged
steipete merged 1 commit into
mainfrom
steipete/perf-micro-team-reports-off-main-20260919
Oct 5, 2026
Merged

steipete merged 1 commit into
mainfrom
steipete/perf-micro-team-reports-off-main-20260919

Conversation

@steipete

@steipete steipete commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

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 on ddf95b6c52db:

  • 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 for extensions/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.
  • Real dist Gateway + explicit disposable source-plugin copy, real RPC/service/scheduler/store/report workers, synthetic HTTP, summaries disabled: 300.103 s after readiness with no automatic runs.
Synthetic workload Cold worker Warm worker
Main-thread loop-delay maximum 12.10 ms 8.33 ms
Job wall time 951 ms 436 ms

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)
Phase Cold Warm
worker-startup 6.23 3.91
github-roster-repositories 1.09 no sample
github-issues 1.92 1.78
github-commits 1.84 1.54
github-comments-advisories 1.62 1.57
discord-topology 1.06 1.06
discord-messages 5.96 1.92
aggregate-render-persist 12.10 8.33

Earlier Testbox tbx_01m4550v479katcs22rs3k0ehg proved the baseline-failing startup regression, full pnpm build, and the focused pnpm test extensions/team-reports/src/scheduler.test.ts --maxWorkers=1 cost: 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, including openclaw/ci-gate and 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.

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.
@clawsweeper

clawsweeper Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation plugin: team-reports size: M labels Oct 5, 2026
@steipete
steipete marked this pull request as ready for review October 5, 2026 05:32
@steipete
steipete enabled auto-merge (squash) October 5, 2026 05:33
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 5, 2026
@clawsweeper

clawsweeper Bot commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed October 5, 2026, 1:37 AM ET / 05:37 UTC.

ClawSweeper review

What this changes

Team 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
Reviewed head: 7590c50b2e0eb679916ba5deba41ea4041a5ba40

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused simplification with relevant production-path observations, meaningful scheduling coverage, and no actionable correctness findings.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The captured Testbox output exercises the real Gateway/service scheduler and report workers, observing 300.103 seconds without automatic runs and successful report generation with matching output hashes. Focused regressions supplement this with UTC-boundary and restart-reuse coverage; no stored-data contract changes require migration proof.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The captured Testbox output exercises the real Gateway/service scheduler and report workers, observing 300.103 seconds without automatic runs and successful report generation with matching output hashes. Focused regressions supplement this with UTC-boundary and restart-reuse coverage; no stored-data contract changes require migration proof.
Evidence reviewed 8 items Pinned introduced change: Reviewed the merge-base-to-head delta rather than endpoint drift. The scheduler removes the startup history scan and catch-up timer, applies startup grace, and promotes the first admitted scheduled run to closed-day collection.
Still necessary on current main: Current main retains startOnce, the successful-run history scan, and the catch-up callback scheduled 60 seconds after startup. The requested scheduling change is therefore not already implemented there.
Owner and recovery boundary: The service creates the scheduler with the existing report runner. Accepted closed-day reuse remains owned by report generation, requires healthy source statuses and matching organization scope, and does not apply to manual generation. No stored format or schema changes are introduced.
Findings None None.
Security None None.

How this fits together

Team 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]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source -26, Tests -23, Docs +2. Total -47 across 4 files.

View PR surface stats
Area Files Added Removed Net
Source 1 23 49 -26
Tests 1 65 88 -23
Docs 2 16 14 +2
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 104 151 -47

Review metrics

Metric Value Why it matters
Automatic startup collection 60-second catch-up replaced by scheduled execution after at least 5 minutes Operators intentionally receive automatic reports later after restart, with manual generation still immediately available.

Technical review

Best 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.

Labels

Label changes:

  • add P2: This is a bounded scheduling and startup-performance improvement in an optional reporting plugin.
  • add proof: sufficient: Contributor real behavior proof is sufficient. The captured Testbox output exercises the real Gateway/service scheduler and report workers, observing 300.103 seconds without automatic runs and successful report generation with matching output hashes. Focused regressions supplement this with UTC-boundary and restart-reuse coverage; no stored-data contract changes require migration proof.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The captured Testbox output exercises the real Gateway/service scheduler and report workers, observing 300.103 seconds without automatic runs and successful report generation with matching output hashes. Focused regressions supplement this with UTC-boundary and restart-reuse coverage; no stored-data contract changes require migration proof.

Label justifications:

  • P2: This is a bounded scheduling and startup-performance improvement in an optional reporting plugin.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The captured Testbox output exercises the real Gateway/service scheduler and report workers, observing 300.103 seconds without automatic runs and successful report generation with matching output hashes. Focused regressions supplement this with UTC-boundary and restart-reuse coverage; no stored-data contract changes require migration proof.
  • proof: sufficient: Contributor real behavior proof is sufficient. The captured Testbox output exercises the real Gateway/service scheduler and report workers, observing 300.103 seconds without automatic runs and successful report generation with matching output hashes. Focused regressions supplement this with UTC-boundary and restart-reuse coverage; no stored-data contract changes require migration proof.

Evidence

What I checked:

  • Pinned introduced change: Reviewed the merge-base-to-head delta rather than endpoint drift. The scheduler removes the startup history scan and catch-up timer, applies startup grace, and promotes the first admitted scheduled run to closed-day collection. (extensions/team-reports/src/scheduler.ts:78, 7590c50b2e0e)
  • Still necessary on current main: Current main retains startOnce, the successful-run history scan, and the catch-up callback scheduled 60 seconds after startup. The requested scheduling change is therefore not already implemented there. (extensions/team-reports/src/scheduler.ts:93, f27df1d88709)
  • Owner and recovery boundary: The service creates the scheduler with the existing report runner. Accepted closed-day reuse remains owned by report generation, requires healthy source statuses and matching organization scope, and does not apply to manual generation. No stored format or schema changes are introduced. (extensions/team-reports/src/run.ts:84, 7590c50b2e0e)
  • Scheduling regression coverage: The changed tests exercise quiet startup, skipped intraday boundaries, delayed daily execution across midnight, daily recurrence, accepted report reuse after restart, immediate manual generation, and nonoverlapping collection using fake time and real SQLite storage. (extensions/team-reports/src/scheduler.test.ts:475, 7590c50b2e0e)
  • Captured runtime evidence: The supplied PR body reports Testbox tbx_01m457e541ppwvc4jd6zs2t1wt exercising a real dist Gateway, disposable source-plugin copy, RPC/service/scheduler/store/report workers, and synthetic HTTP with summaries disabled: no automatic runs for 300.103 seconds after readiness, followed by cold/warm report generation with matching normalized JSON and Markdown hashes. It also records 271 passing plugin tests and explicitly distinguishes the inherited aggregate-check failure from successful selected checks. These are supplied observations, not reviewer-executed tests. (7590c50b2e0e)
  • Intentional startup tradeoff: The maintainer-authored proposal explicitly accepts waiting until the next scheduled collection instead of collecting after startup, documents skipped grace-period intraday boundaries, and preserves immediate manual generation. This timing tradeoff is stated in both the captured body and user-facing documentation. Public docs: docs/plugins/team-reports.md. (docs/plugins/team-reports.md:345, 7590c50b2e0e)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Vincent Koc: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@steipete
steipete merged commit df96d22 into main Oct 5, 2026
171 of 174 checks passed
@steipete
steipete deleted the steipete/perf-micro-team-reports-off-main-20260919 branch October 5, 2026 05:41
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 6, 2026
)

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation P2 Normal backlog priority with limited blast radius. plugin: team-reports proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant