Repository navigation
perf(gateway): mark recovery before model preparation - #117544
Conversation
a117442 to
3c54e09
Compare
|
Correction: the exact source-performance artifact disproves this attempted fix.
The previously cited This PR is blocked and will not merge in its current form. I am continuing the root-cause investigation against the actual scale-many source artifact. @clawsweeper stop |
|
🦞✅ I added |
|
Codex review: needs maintainer review before merge. Reviewed August 1, 2026, 3:04 PM ET / 19:04 UTC. ClawSweeper reviewWhat this changesMoves Gateway startup orphan-session marking before prepared-model publication, keeps the broader recovery runtime lazy, and records separate recovery-load and recovery-scan startup spans. Merge readinessKeep this PR open for ordinary member-maintainer merge review. Current Priority: P2 Review scores
Verification
How this fits togetherGateway post-attach startup prepares the model runtime before starting channel transports. Main-session recovery marking updates persisted state for runs abandoned by the preceding Gateway lifecycle so later restart recovery has authoritative state. flowchart LR
A[Gateway restart] --> B[Startup orphan marking]
B --> C[Persisted recovery state]
B --> D[Prepared model runtime]
D --> E[Channel startup]
E --> F[Post-ready services]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +11, Tests +50. Total +61 across 2 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Land the focused ordering change after normal maintainer review, preserving the marking-only module boundary and the tested rule that prior-lifecycle session state is recorded before model preparation can fail. Do we have a high-confidence way to reproduce the issue? Not applicable: this is a targeted performance and lifecycle-ordering PR rather than a reporter-facing bug. The provided hosted source-performance probe and exact-head ordering tests give a concrete validation path for the changed behavior. Is this the best way to solve the issue? Yes: the marking function owns persisted prior-lifecycle state and does not consume prepared-model data, so moving only that marking import and scan ahead of model publication is narrower than broadly reordering recovery or channel startup. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 7563e40e47b7. 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)
|
3c54e09 to
12fe34c
Compare
12fe34c to
a8ab778
Compare
|
Current-head update:
Lifecycle-owner decision: startup orphan marking records runs abandoned by the previous Gateway lifecycle. It is intentionally persisted even if the new process later fails model preparation; otherwise a failed restart can leave prior runs falsely recorded as running. The current head documents this contract and adds a failure-path test proving marking completes before the model error propagates and channels remain stopped. @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Owner decision: accepted. Startup orphan marking records abandonment by the previous Gateway lifecycle. That prior-run state is authoritative independently of whether the replacement process later completes model preparation. If model preparation fails, leaving those prior runs recorded as The failure-path test on This resolves the remaining session-state owner decision and merge-risk item. @clawsweeper re-review |
|
The earlier human-review pause is resolved by the explicit owner acceptance above. Exact-head CI is green, and the failure-path contract is covered. @clawsweeper re-review |
|
Repository-native preparation is complete for
The lifecycle owner decision remains explicit and tested: prior-lifecycle orphan marking completes before a later model-preparation failure propagates. No ClawSweeper code, security, owner-decision, or merge-risk item remains. @clawsweeper re-review |
|
Merged via squash.
|
* origin/main: refactor(policy): centralize doctor health-check descriptors (openclaw#117578) perf(gateway): mark recovery before model preparation (openclaw#117544) fix(openai): keep embedding identity stable across upgrades (openclaw#117557) fix(googlechat): drop invalid thread resource names before send (openclaw#108324) fix(skills): preserve profile in ClawHub command hints (openclaw#117555) fix(cli): explain filtered plugin policy without unsafe recovery (openclaw#117556) fix(irc): strip markdown from outbound text (openclaw#112961)
* origin/main: (22 commits) refactor(ui): consolidate cron form control rendering (openclaw#117576) fix(memory): recover restored session freshness (openclaw#117548) fix(whatsapp): normalize future-proof QA poll and video note ingress (openclaw#117579) fix(perf): separate warm and first-device health probes (openclaw#117525) fix(ci): repair plugin prerelease validation (openclaw#117562) fix(tasks): sanitize every human task and flow detail (openclaw#117568) fix(feishu): cancel unread streaming-card error bodies before release (openclaw#117312) fix(status): honor explicit local RPC fallback timeouts (openclaw#117519) fix(ui): preserve Talk transcript surrogate bounds fix(tasks): validate notification policy before persistence (openclaw#117554) refactor: consolidate full release child workflows (openclaw#117385) refactor(policy): centralize doctor health-check descriptors (openclaw#117578) perf(gateway): mark recovery before model preparation (openclaw#117544) fix(ui): harden Talk transcript marker bounds test(openai): parse realtime websocket frames safely fix(openai): keep embedding identity stable across upgrades (openclaw#117557) fix(googlechat): drop invalid thread resource names before send (openclaw#108324) test(ui): cover bounded realtime Talk entries fix(ui): bound realtime Talk conversation text test(ui): cover reentrant Talk meter cleanup ...
* origin/main: perf(gateway): mark recovery before model preparation (openclaw#117544) fix(openai): keep embedding identity stable across upgrades (openclaw#117557) fix(googlechat): drop invalid thread resource names before send (openclaw#108324) fix(skills): preserve profile in ClawHub command hints (openclaw#117555) fix(cli): explain filtered plugin policy without unsafe recovery (openclaw#117556) fix(irc): strip markdown from outbound text (openclaw#112961) refactor(plugins): consolidate registry snapshots (openclaw#117561) fix(plugins): fail blocked enable commands (openclaw#117536) test(secrets): dedupe runtime state fixtures (openclaw#117563)
* origin/main: (28 commits) refactor(ui): consolidate cron form control rendering (openclaw#117576) fix(memory): recover restored session freshness (openclaw#117548) fix(whatsapp): normalize future-proof QA poll and video note ingress (openclaw#117579) fix(perf): separate warm and first-device health probes (openclaw#117525) fix(ci): repair plugin prerelease validation (openclaw#117562) fix(tasks): sanitize every human task and flow detail (openclaw#117568) fix(feishu): cancel unread streaming-card error bodies before release (openclaw#117312) fix(status): honor explicit local RPC fallback timeouts (openclaw#117519) fix(ui): preserve Talk transcript surrogate bounds fix(tasks): validate notification policy before persistence (openclaw#117554) refactor: consolidate full release child workflows (openclaw#117385) refactor(policy): centralize doctor health-check descriptors (openclaw#117578) perf(gateway): mark recovery before model preparation (openclaw#117544) fix(ui): harden Talk transcript marker bounds test(openai): parse realtime websocket frames safely fix(openai): keep embedding identity stable across upgrades (openclaw#117557) fix(googlechat): drop invalid thread resource names before send (openclaw#108324) fix(skills): preserve profile in ClawHub command hints (openclaw#117555) fix(cli): explain filtered plugin policy without unsafe recovery (openclaw#117556) fix(irc): strip markdown from outbound text (openclaw#112961) ...
* origin/main: (53 commits) fix(whatsapp): normalize future-proof QA poll and video note ingress (openclaw#117579) fix(perf): separate warm and first-device health probes (openclaw#117525) fix(ci): repair plugin prerelease validation (openclaw#117562) fix(tasks): sanitize every human task and flow detail (openclaw#117568) fix(feishu): cancel unread streaming-card error bodies before release (openclaw#117312) fix(status): honor explicit local RPC fallback timeouts (openclaw#117519) fix(tasks): validate notification policy before persistence (openclaw#117554) refactor: consolidate full release child workflows (openclaw#117385) refactor(policy): centralize doctor health-check descriptors (openclaw#117578) perf(gateway): mark recovery before model preparation (openclaw#117544) test(openai): parse realtime websocket frames safely fix(openai): keep embedding identity stable across upgrades (openclaw#117557) fix(googlechat): drop invalid thread resource names before send (openclaw#108324) fix(skills): preserve profile in ClawHub command hints (openclaw#117555) fix(cli): explain filtered plugin policy without unsafe recovery (openclaw#117556) fix(irc): strip markdown from outbound text (openclaw#112961) refactor(plugins): consolidate registry snapshots (openclaw#117561) test(ui): cover reentrant Talk meter cleanup fix(plugins): fail blocked enable commands (openclaw#117536) fix(ui): reclaim reentrant Talk audio meters ...
* perf(gateway): keep recovery runtime off startup path * perf(gateway): mark recovery before model preparation * test(gateway): lock recovery marking failure order
* origin/main: refactor(policy): centralize doctor health-check descriptors (openclaw#117578) perf(gateway): mark recovery before model preparation (openclaw#117544) fix(openai): keep embedding identity stable across upgrades (openclaw#117557) fix(googlechat): drop invalid thread resource names before send (openclaw#108324) fix(skills): preserve profile in ClawHub command hints (openclaw#117555) fix(cli): explain filtered plugin policy without unsafe recovery (openclaw#117556) fix(irc): strip markdown from outbound text (openclaw#112961)
* origin/main: (22 commits) refactor(ui): consolidate cron form control rendering (openclaw#117576) fix(memory): recover restored session freshness (openclaw#117548) fix(whatsapp): normalize future-proof QA poll and video note ingress (openclaw#117579) fix(perf): separate warm and first-device health probes (openclaw#117525) fix(ci): repair plugin prerelease validation (openclaw#117562) fix(tasks): sanitize every human task and flow detail (openclaw#117568) fix(feishu): cancel unread streaming-card error bodies before release (openclaw#117312) fix(status): honor explicit local RPC fallback timeouts (openclaw#117519) fix(ui): preserve Talk transcript surrogate bounds fix(tasks): validate notification policy before persistence (openclaw#117554) refactor: consolidate full release child workflows (openclaw#117385) refactor(policy): centralize doctor health-check descriptors (openclaw#117578) perf(gateway): mark recovery before model preparation (openclaw#117544) fix(ui): harden Talk transcript marker bounds test(openai): parse realtime websocket frames safely fix(openai): keep embedding identity stable across upgrades (openclaw#117557) fix(googlechat): drop invalid thread resource names before send (openclaw#108324) test(ui): cover bounded realtime Talk entries fix(ui): bound realtime Talk conversation text test(ui): cover reentrant Talk meter cleanup ...
* origin/main: perf(gateway): mark recovery before model preparation (openclaw#117544) fix(openai): keep embedding identity stable across upgrades (openclaw#117557) fix(googlechat): drop invalid thread resource names before send (openclaw#108324) fix(skills): preserve profile in ClawHub command hints (openclaw#117555) fix(cli): explain filtered plugin policy without unsafe recovery (openclaw#117556) fix(irc): strip markdown from outbound text (openclaw#112961) refactor(plugins): consolidate registry snapshots (openclaw#117561) fix(plugins): fail blocked enable commands (openclaw#117536) test(secrets): dedupe runtime state fixtures (openclaw#117563)
* origin/main: (28 commits) refactor(ui): consolidate cron form control rendering (openclaw#117576) fix(memory): recover restored session freshness (openclaw#117548) fix(whatsapp): normalize future-proof QA poll and video note ingress (openclaw#117579) fix(perf): separate warm and first-device health probes (openclaw#117525) fix(ci): repair plugin prerelease validation (openclaw#117562) fix(tasks): sanitize every human task and flow detail (openclaw#117568) fix(feishu): cancel unread streaming-card error bodies before release (openclaw#117312) fix(status): honor explicit local RPC fallback timeouts (openclaw#117519) fix(ui): preserve Talk transcript surrogate bounds fix(tasks): validate notification policy before persistence (openclaw#117554) refactor: consolidate full release child workflows (openclaw#117385) refactor(policy): centralize doctor health-check descriptors (openclaw#117578) perf(gateway): mark recovery before model preparation (openclaw#117544) fix(ui): harden Talk transcript marker bounds test(openai): parse realtime websocket frames safely fix(openai): keep embedding identity stable across upgrades (openclaw#117557) fix(googlechat): drop invalid thread resource names before send (openclaw#108324) fix(skills): preserve profile in ClawHub command hints (openclaw#117555) fix(cli): explain filtered plugin policy without unsafe recovery (openclaw#117556) fix(irc): strip markdown from outbound text (openclaw#112961) ...
* origin/main: (53 commits) fix(whatsapp): normalize future-proof QA poll and video note ingress (openclaw#117579) fix(perf): separate warm and first-device health probes (openclaw#117525) fix(ci): repair plugin prerelease validation (openclaw#117562) fix(tasks): sanitize every human task and flow detail (openclaw#117568) fix(feishu): cancel unread streaming-card error bodies before release (openclaw#117312) fix(status): honor explicit local RPC fallback timeouts (openclaw#117519) fix(tasks): validate notification policy before persistence (openclaw#117554) refactor: consolidate full release child workflows (openclaw#117385) refactor(policy): centralize doctor health-check descriptors (openclaw#117578) perf(gateway): mark recovery before model preparation (openclaw#117544) test(openai): parse realtime websocket frames safely fix(openai): keep embedding identity stable across upgrades (openclaw#117557) fix(googlechat): drop invalid thread resource names before send (openclaw#108324) fix(skills): preserve profile in ClawHub command hints (openclaw#117555) fix(cli): explain filtered plugin policy without unsafe recovery (openclaw#117556) fix(irc): strip markdown from outbound text (openclaw#112961) refactor(plugins): consolidate registry snapshots (openclaw#117561) test(ui): cover reentrant Talk meter cleanup fix(plugins): fail blocked enable commands (openclaw#117536) fix(ui): reclaim reentrant Talk audio meters ...
Status
Exact-head local proof is positive, and the behaviorally identical runtime diff passed the hosted source-performance workflow. Merge remains blocked until the durable exact-head ClawSweeper review clears every finding, owner decision, merge risk, and rank-up item.
Root Cause
The earlier import-only attempt did not improve
preparedRuntimeScaleMany / sidecars.main-session-recovery.Follow-up profiling separated the phase:
1ms1.03s20msThe recovery scan does not depend on prepared model state. Running it first removes startup-work contention while preserving the contract that orphan marking completes before channels start.
Changes
Exact-Head Evidence
Head:
a8ab778b7d85416548f7ad888b480c90a74bd27cBase:
f4253da3e40b6b65560fa4f9aa9d3fce1faceb97Before, exact hosted source probe at
3c54e096720545db480985e2054401bc6250761e:1275.3ms,1325.1ms,1274.5msAfter, hosted source probe at runtime-equivalent head
12fe34cac26650fd4c75f48a45fa93561d6ef412:8.6ms,8.6ms,9.2ms1.0ms,1.1ms,1.1ms6.2ms,6.1ms,6.6ms1014.2ms,994.6ms,1046.7ms4.6ms,4.0ms,4.1ms693.7ms,658.6ms,696.1msHosted source-performance run: https://github.com/openclaw/openclaw/actions/runs/30712533160
The current head only rebases onto unrelated latest-main changes and adds the lifecycle contract comment plus failure-path regression test. The measured runtime logic is unchanged.
Lifecycle Decision
Startup orphan marking records runs abandoned by the previous Gateway lifecycle. That state transition must occur even when the new process later fails model preparation; otherwise a failed restart can leave those prior runs falsely recorded as running. The current head documents this owner contract and tests that marking completes before a model-runtime failure propagates, while channels remain stopped.
Verification
OPENCLAW_BUILD_PRIVATE_QA=1 node scripts/build-all.mjs sourcePerformancenode scripts/run-vitest.mjs src/gateway/server-startup-post-attach.test.ts: 62/62 passedoxfmt --check,oxlint, andgit diff --check: passedThe old ClawSweeper finding was based on the disproven import-only head. The current head includes the measured root-cause fix, hosted proof, and explicit model-preparation failure-path contract above.