Repository navigation
improve(infra): reduce scheduling work for session notice bursts - #146818
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 September 13, 2026, 4:54 AM ET / 08:54 UTC (Revision 6). ClawSweeper reviewWhat this changesReduce repeated scheduling scans during bursts of session-state notices while preserving wake deadlines, ordering, and caller settlement. Merge readiness✅ Ready for maintainer review Keep open: this remains a useful, focused optimization absent from current main. No actionable correctness or security defect was found, and the previous review’s changed files are byte-identical at this head. Priority: P2 Review scores
Verification
How this fits togetherSession-state notices queue context for watching sessions and request heartbeat turns. The shared wake scheduler coalesces those requests, applies deadlines and concurrency limits, dispatches handlers, and settles waiting callers. flowchart TD
A[Session state changes] --> B[Queue watcher notices]
B --> C[Shared wake scheduler]
C --> D{Existing timer covers other work?}
D -->|Yes| E[Check changed target]
D -->|No or installation delay| F[Scan pending targets]
E --> G[Dispatch ready handlers]
F --> G
G --> H[Settle callers]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +13, Tests +69. Total +82 across 3 files. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Technical reviewBest possible solution: Keep scheduling in the existing owner, using its armed timer to avoid redundant admission scans while preserving lifecycle rescans and deadline semantics. Do we have a high-confidence way to reproduce the issue? Yes at source level: each current-main admission scans the growing pending-target map during synchronous notice bursts. Performance measurements are supplied, but this review did not execute them. Is this the best way to solve the issue? Yes: the optimization reuses the timer and queue owner, explicitly handles installation deferral, and leaves global barriers, dispatch, retry, and settlement policies intact. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against f01640e3fb78. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (5 earlier review cycles)
|
ec5b547 to
4ee1305
Compare
4ee1305 to
615c47b
Compare
|
Merged via squash.
|
* refs/heads/temp/pr-146883: (159 commits) fix: retain route ownership while discovering conversations (#146927) refactor: reuse plugin fixture shell runner (#146920) fix(worker): stop preparing disabled live previews (#146896) fix(runtime): support Bun across tooling suite (#146807) chore(i18n): refresh native locales (#146924) perf(secrets): limit expiry metadata to transient credentials (#146882) fix(ui): preserve queued refreshes during session discovery (#146535) test(ui): wait for quiet scrolling and close named file tabs (#146836) fix(ui): prevent Usage hour filters from freezing during DST (#146919) test(ui): share browser page cleanup across layout fixtures (#146805) ci: balance complete PR runtime test groups (#146916) improve(infra): reduce scheduling work for session notice bursts (#146818) improve: prepare Gateway skill commands asynchronously (#146812) improve(agents): skip unused assistant delivery parsing (#146858) improve(ui): reuse date formatters across timestamp lists (#146789) fix(tests): isolate installer and Docker shell snippets (#146897) test(heartbeat): share explicit channel configuration fixtures (#146853) fix: retain conversation reply claims through write admission (#146866) perf(sessions): bound history reads and stabilize cursor paging (#146770) fix(ui): let slow dashboard downloads finish before recovery (#146881) ...
* refs/heads/temp/pr-146833: (43 commits) fix(memory): preserve newer indexes and disclose automatic rebuild costs (#146908) fix: retain route ownership while discovering conversations (#146927) refactor: reuse plugin fixture shell runner (#146920) fix(worker): stop preparing disabled live previews (#146896) fix(runtime): support Bun across tooling suite (#146807) chore(i18n): refresh native locales (#146924) perf(secrets): limit expiry metadata to transient credentials (#146882) fix(ui): preserve queued refreshes during session discovery (#146535) test(ui): wait for quiet scrolling and close named file tabs (#146836) fix(ui): prevent Usage hour filters from freezing during DST (#146919) test(ui): share browser page cleanup across layout fixtures (#146805) ci: balance complete PR runtime test groups (#146916) improve(infra): reduce scheduling work for session notice bursts (#146818) improve: prepare Gateway skill commands asynchronously (#146812) improve(agents): skip unused assistant delivery parsing (#146858) improve(ui): reuse date formatters across timestamp lists (#146789) fix(tests): isolate installer and Docker shell snippets (#146897) test(heartbeat): share explicit channel configuration fixtures (#146853) fix: retain conversation reply claims through write admission (#146866) perf(sessions): bound history reads and stabilize cursor paging (#146770) ...
…ssion-list-roster-batch-20260913 * commit 'f513c0f345f7f2514c49ccfbc00adc3f78b9a755': (46 commits) chore(i18n): refresh native locales (#146924) perf(secrets): limit expiry metadata to transient credentials (#146882) fix(ui): preserve queued refreshes during session discovery (#146535) test(ui): wait for quiet scrolling and close named file tabs (#146836) fix(ui): prevent Usage hour filters from freezing during DST (#146919) test(ui): share browser page cleanup across layout fixtures (#146805) ci: balance complete PR runtime test groups (#146916) improve(infra): reduce scheduling work for session notice bursts (#146818) improve: prepare Gateway skill commands asynchronously (#146812) improve(agents): skip unused assistant delivery parsing (#146858) improve(ui): reuse date formatters across timestamp lists (#146789) fix(tests): isolate installer and Docker shell snippets (#146897) test(heartbeat): share explicit channel configuration fixtures (#146853) fix: retain conversation reply claims through write admission (#146866) perf(sessions): bound history reads and stabilize cursor paging (#146770) fix(ui): let slow dashboard downloads finish before recovery (#146881) fix: share Doctor lifecycle coordination with SQLite workers (#146714) fix: retain native session model provenance (#146801) fix: settle embedded transcript repairs before session cleanup (#146842) feat(macos): improve agent navigation and chat layout (#146531) ...
What Problem This Solves
Bursts of session-state notices repeatedly scan every pending wake target while waiting for their coalescing timer.
Closes #146796.
User Impact
Less scheduling work for larger distinct-target bursts, with unchanged wake ordering, deadlines and settlement. Small same-target controls regress on Node 24: eight notices increase from 0.1747 to 0.1874 ms, and eight public-heartbeat admissions from 0.0436 to 0.0531 ms. No universal per-enqueue improvement is claimed.
Why This Change Was Made
An armed timer normally covers unchanged targets, so a targeted admission checks only its changed group. Handler installation can deliberately defer already-ready work; the timer records that condition and keeps the full scan until that delay is cleared. Global barriers and lifecycle changes also retain the full scan. The change uses the existing timer and pending-work owner.
Evidence
enqueueSessionStateNoticesource-copy flow on Windows, three alternating pairs per runtime (three warmups and five measured bursts per cell), measured on final corrected source:canonicalProviderNameandlistPackagedStaticExtensionAssetOutputs), independently reproduced on clean baseline; production unused exports were zero. No guard was disabled or baseline changed.2e0bfa16with a byte-identical patch and unchanged measured source owners. Historical CI run 34748397234 attempt 1 failed after compact-large-9 and compact-large-11 did not acquire runners. Separate OpenGrep and sampled CodeQL jobs failed during code-scanning upload; the OpenGrep log records 106 rules on three files, zero findings and successful artifact upload, without making that failed scan a pass. Initial rerun calls returned HTTP 500 and 502 without starting another attempt. A later successful rerun request started attempt 2, which completed successfully at the unchanged reviewed head. The earlier upload/acquisition failures and uncertain lower-level causes remain recorded; the current CI result does not retroactively resolve or relabel them. Current exact-head CI run 34748397234, attempt 2 completed successfully at615c47b133b3b83524ee98349c9cdd8be4e86cff(2026-09-13T10:10:29Z). The current required-check query reportsopenclaw/ci-gateSUCCESS. This supports native preparation; it does not claim merge or cleanup, or a rerun of unchanged local performance proof.