Skip to content

fix(cron): keep skill review reconciliation responsive - #149600

Merged
steipete merged 1 commit into
mainfrom
upd/fleet-startup-serve
Sep 16, 2026
Merged

steipete merged 1 commit into
mainfrom
upd/fleet-startup-serve

Conversation

@steipete

@steipete steipete commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

Refs #149538
Refs #148529

What Problem This Solves

Large agent fleets can stop answering Gateway health requests after readiness while weekly skill-review jobs reconcile.

User Impact

Weekly review eligibility is projected from prepared policy, one agent at a time, while the Gateway can service requests between updates. Existing schedules, job identities, stored execution preferences, and runtime admission remain unchanged. Existing installations need no configuration or database migration.

This addresses review reconciliation; the separate plugin-registration, model-runtime, and chat-metadata startup blocks remain outside this change.

Why This Change Was Made

Static monitor eligibility called the general fallback resolver without a captured manifest view. Its cache preflight entered provider load planning and repeatedly scanned the fleet's configured runtimes. The monitor now carries the selected manifest policy through static model resolution, including aliases and fallback candidates, without runtime normalization.

The specification array is replaced with incremental iteration through the existing serialized reconciliation. Duplicate cleanup, per-row error handling, authority checks, and stale cleanup retain their order. The existing retained-job map identifies stale rows, replacing the separate desired-agent set.

The production delta is +20 lines: the added capability is incremental static projection with explicit prepared-policy inputs across the existing selectors. No parallel cache or compatibility wrapper is added. Test delta is +136 lines; docs +2.

Evidence

The two new boundary regressions fail on the original implementation and pass after the repair. They reject provider-load planning from monitor projection and verify that a real /health request succeeds while the first committed row is held, before the remaining fleet is projected. Final persisted rows retain an ineligible agent's disabled monitor and both eligible siblings.

  • 238 focused tests passed across Gateway reconciliation/lifecycle, cron persistence, model fallback, and the Claw deletion consumer. Both new tests passed again after lint-only corrections.
  • node scripts/check-changed.mjs: passed, including core/test typechecks, lint, database guards, and import-cycle checks.
  • pnpm build: passed on the exact candidate commit.
  • git diff --check: passed.
  • Fresh Codex branch review against origin/main, through P1: scoped-clean.
  • PR CI is attached to the exact head; its latest observed status is in progress. Exact-head ClawSweeper review found no actionable defects or before-merge requests.

200-agent measurement

Both arms use Node 24.21.0 on macOS, isolated retained state, separate workspaces and current-schema databases, 54 synthetic configured models per agent, twelve enabled bundled plugins (six activated), no channels, and a loopback listener. The Gateway runs built dist/entry.js with a 2560 MiB old-space cap. An external probe requests /health every second with a five-second deadline; an in-process timer samples event-loop delay. The post-ready window is 90 seconds.

Measurement Before (431f7748b548) After (cafcc973b684)
Review reconciliation inclusive sampled CPU 27.643 s 0.053 s
Post-ready event-loop maximum 29889.5 ms 4228.4 ms
Post-ready /health answered/total 59/90 89/90
Peak process RSS 2275.8 MiB 1804.5 MiB

CPU figures come from V8 samples in reconcileSkillCollectionReviewJobs; they exclude awaited I/O and are not wall-clock phase durations. These measurements establish this owner-level improvement, not a whole-startup latency or memory guarantee. Other startup bottlenecks remain visible in the rig.

Exact rig commands from the checkout:

pnpm build
/opt/homebrew/opt/node@24/bin/node .local/fleet-serve/run.mjs 200 baseline-200 profile pr-a-before
/opt/homebrew/opt/node@24/bin/node .local/fleet-serve/run.mjs 200 baseline-200 profile pr-a-after
node .local/fleet-serve/summarize.mjs .local/fleet-serve/baseline-200/pr-a-before/measurement.json
node .local/fleet-serve/summarize.mjs .local/fleet-serve/baseline-200/pr-a-after/measurement.json

The synthetic generator uses the real shared-state and agent database bootstrap APIs. Generator, probe driver, raw traces, and profiles remain task-local under .local/fleet-serve/; they are not committed as product code. The before and after commands run against their respective built revisions.

600-agent progress

The progress arm, started after the PR was marked ready, used 600 agents on cafcc973b684 and stopped at its 30-minute observation limit before Gateway readiness. The listener bound at 855.244 s; 0/945 health probes answered before the cutoff. Failures were 127 five-second deadlines, 646 connection resets, and 172 broken pipes. Peak RSS was 3243.1 MiB.

Model-runtime preparation remained unfinished for at least 789.576 s after its nested model-auth span. The independent timer was silent for at least 944.850 s. Chat metadata and this PR's post-ready reconciliation were not reached, so this arm does not establish 600-agent recovery.

The rig requested SIGTERM at the observation limit, then force-stopped only its isolated process after 30 seconds without settlement. This was a rig-initiated SIGKILL, not an observed OOM. Thirty additional failed probes during teardown are excluded from the 0/945 observation count.

Completed 600-agent phase Duration Trace eventLoopMax Health answered/total Peak RSS
Process bootstrap 614.219 s 0.0 ms 0/0 2484 MiB
Schema preflight 69.381 s 37.9 ms 0/0 2516 MiB
Startup maintenance 149.043 s 1158.7 ms 0/0 2558 MiB
Post-bind plugin registration 146.535 s 0.0 ms 0/147 2606 MiB

Nested trace histograms can report zero before a blocked timer samples; the independent timer silence and external HTTP failures remain the starvation evidence. The unfinished model-runtime duration is a lower bound.

/opt/homebrew/opt/node@24/bin/node .local/fleet-serve/run.mjs 600 baseline-600 plain pr-a-after

Related work: #149314 owns the activation/metadata fingerprint path and is left untouched. #141018 changes weekly review reasoning; this patch preserves the existing payload behavior.

Synthetic rig source (saved under .local/fleet-serve)

seed.mts

import fs from 'node:fs';
import path from 'node:path';
const root = path.resolve(process.argv[2]);
const count = Number(process.argv[3]);
const {openOpenClawStateDatabase, closeOpenClawStateDatabaseForTest} = await import('../../src/state/openclaw-state-db.js');
const {openOpenClawAgentDatabase, closeOpenClawAgentDatabaseByPath} = await import('../../src/state/openclaw-agent-db.js');
const plugins = ['codex','openai','anthropic','google','minimax','amazon-bedrock','github-copilot','opencode','ollama','openrouter','memory-core','qwen'];
const models = Array.from({length:54}, (_,i)=>({id:`fleet-model-${String(i+1).padStart(2,'0')}`,name:`Synthetic fleet model ${i+1}`,reasoning:false,input:['text'],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:128000,maxTokens:8192}));
const agentModels = Object.fromEntries(models.map(m=>[`openai/${m.id}`,{agentRuntime:{id:'openclaw'}}]));
const entries = {};
const state = openOpenClawStateDatabase({env:process.env});
for(let i=0;i<count;i++){
 const id=`fleet-${String(i+1).padStart(4,'0')}`;
 const workspace=path.join(root,'workspaces',id);
 fs.mkdirSync(workspace,{recursive:true});
 fs.writeFileSync(path.join(workspace,'AGENTS.md'),'Synthetic fleet startup fixture. No external actions.\n');
 entries[id]={workspace,agentDir:path.join(root,'state','agents',id,'agent'),model:{primary:'openai/fleet-model-01'},models:agentModels};
 const db=openOpenClawAgentDatabase({agentId:id,env:process.env});
 closeOpenClawAgentDatabaseByPath(db.path);
 if((i+1)%50===0) console.log(`seeded ${i+1}/${count}`);
}
closeOpenClawStateDatabaseForTest();
const config={browser:{enabled:false},discovery:{mdns:{mode:'off'}},gateway:{mode:'local',bind:'loopback',auth:{mode:'none'},controlUi:{enabled:false},tailscale:{mode:'off'}},logging:{file:path.join(root,'gateway-file.log'),consoleStyle:'pretty'},agents:{ownership:'explicit',entries},models:{providers:{openai:{baseUrl:'http://127.0.0.1:1/v1',api:'openai-completions',models}}},plugins:{enabled:true,allow:plugins,entries:Object.fromEntries(plugins.map(id=>[id,{enabled:true}]))},channels:{}};
fs.writeFileSync(path.join(root,'openclaw.json'),JSON.stringify(config,null,2)+'\n');
console.log(JSON.stringify({agents:count,workspaces:count,agentDatabases:count,configuredModels:count*54,plugins}));

run.mjs

import fs from 'node:fs';
import path from 'node:path';
import net from 'node:net';
import http from 'node:http';
import {spawn,execFileSync} from 'node:child_process';
const count=Number(process.argv[2]||200), label=process.argv[3]||`fleet-${count}`;
const base=path.resolve('.local/fleet-serve'), root=path.join(base,label);
fs.mkdirSync(root,{recursive:true});
fs.mkdirSync(path.join(root,'tmp'),{recursive:true});
const env={HOME:root,OPENCLAW_HOME:root,OPENCLAW_STATE_DIR:path.join(root,'state'),OPENCLAW_CONFIG_PATH:path.join(root,'openclaw.json'),PATH:process.env.PATH,LANG:'en_US.UTF-8',USER:'fleet-rig',LOGNAME:'fleet-rig',TMPDIR:path.join(root,'tmp'),CI:'1',NO_COLOR:'1',OPENCLAW_GATEWAY_STARTUP_TRACE:'1',OPENCLAW_NO_RESPAWN:'1',OPENCLAW_TEST_DISABLE_UPDATE_CHECK:'1',npm_config_update_notifier:'false'};
if(!fs.existsSync(env.OPENCLAW_CONFIG_PATH)){
 const seed=spawn(process.execPath,['--import','./scripts/tsx.mjs',path.join(base,'seed.mts'),root,String(count)],{env,stdio:'inherit'});
 const code=await new Promise(r=>seed.on('exit',r));if(code!==0)process.exit(code||1);
}
if(process.argv[4]==='seed-only')process.exit(0);
const reservation=net.createServer(); await new Promise(r=>reservation.listen(0,'127.0.0.1',r));const port=reservation.address().port;await new Promise(r=>reservation.close(r));
const outputRoot=process.argv[5]?path.join(root,process.argv[5]):root;fs.mkdirSync(outputRoot,{recursive:true});
const started=Date.now(); const record={count,label,root,outputRoot,port,started,head:execFileSync('git',['rev-parse','HEAD'],{encoding:'utf8'}).trim(),node:process.version,phases:[],samples:[],rss:[],probes:[]};
const out=fs.createWriteStream(path.join(outputRoot,'boot.log'));
const child=spawn(process.execPath,['--max-old-space-size=2560','--import',path.join(base,'sampler.mjs'),...(process.argv[4]==='profile'?['--import',path.join(base,'profile.mjs')]:[]),'dist/entry.js','gateway','run','--port',String(port),'--bind','loopback','--auth','none','--tailscale','off'],{env,stdio:['ignore','pipe','pipe']});
record.pid=child.pid;let ended=false,stop=false;const pending=new Set();
function line(text){out.write(text+'\n');const at=Date.now();const sample=text.indexOf('FLEET_SAMPLE ');if(sample>=0){record.samples.push(JSON.parse(text.slice(sample+13)));return;}
 const match=text.match(/startup trace: (\S+) ([\d.]+)ms total=([\d.]+)ms/);
 if(match){record.phases.push({name:match[1],durationMs:Number(match[2]),at,line:text}); console.log(`${label} ${match[1]} ${match[2]}ms`);}
 if(/\[gateway\] (?:gateway )?ready(?:\s|$)/.test(text)&&!record.readyAt){record.readyAt=at; console.log(`${label} READY ${(at-started)/1000}s`);}
 if(/error|failed|refus|Invalid config/i.test(text))console.log(text);
}
for(const stream of [child.stdout,child.stderr]){let buffer='';stream.on('data',chunk=>{buffer+=chunk;let n;while((n=buffer.indexOf('\n'))>=0){line(buffer.slice(0,n));buffer=buffer.slice(n+1);}});stream.on('end',()=>{if(buffer)line(buffer);});}
const exitPromise=new Promise(r=>child.on('exit',(code,signal)=>{ended=true;record.exit={code,signal};r();}));
function probe(){const at=Date.now();const p=new Promise(resolve=>{let complete=false;const req=http.get({hostname:'127.0.0.1',port,path:'/health',agent:false},res=>{res.resume();res.on('end',()=>finish(res.statusCode));});const timer=setTimeout(()=>req.destroy(new Error('deadline')),5000);function finish(status,error){if(complete)return;complete=true;clearTimeout(timer);record.probes.push({at,latencyMs:Date.now()-at,status,error});resolve();}req.on('error',e=>finish(null,e.message));});pending.add(p);p.finally(()=>pending.delete(p));}
const tcp=setInterval(()=>{if(record.boundAt||ended)return;const sock=net.connect({host:'127.0.0.1',port});sock.on('connect',()=>{if(!record.boundAt){record.boundAt=Date.now();console.log(`${label} BOUND ${(record.boundAt-started)/1000}s`);probe();}sock.destroy();});sock.on('error',()=>sock.destroy());sock.setTimeout(500,()=>sock.destroy());},100);
const interval=setInterval(()=>{if(ended)return;if(record.boundAt)probe();try{const kb=Number(execFileSync('/bin/ps',['-o','rss=','-p',String(child.pid)],{encoding:'utf8'}).trim());record.rss.push({at:Date.now(),rssMb:kb/1024});}catch{}
 if(!stop&&((record.readyAt&&Date.now()-record.readyAt>90000)||Date.now()-started>1800000)){stop=true;record.stoppingAt=Date.now();child.kill('SIGTERM');setTimeout(()=>{if(!ended){record.forcedStop=true;child.kill('SIGKILL');}},30000).unref();}
 fs.writeFileSync(path.join(outputRoot,'measurement.json'),JSON.stringify(record,null,2)+'\n');},1000);
process.on('SIGINT',()=>{stop=true;child.kill('SIGTERM');});
await exitPromise;clearInterval(tcp);clearInterval(interval);await Promise.all(pending);record.endedAt=Date.now();record.stoppedByRig=stop;out.end();
fs.writeFileSync(path.join(outputRoot,'measurement.json'),JSON.stringify(record,null,2)+'\n');
console.log(JSON.stringify({label,readySeconds:record.readyAt?(record.readyAt-started)/1000:null,boundSeconds:record.boundAt?(record.boundAt-started)/1000:null,probes:record.probes.length,answered:record.probes.filter(p=>p.status===200).length,maxRssMb:Math.max(...record.rss.map(s=>s.rssMb)),maxLoopMs:Math.max(...record.samples.map(s=>s.loopMaxMs)),exit:record.exit}));

sampler.mjs

import {isMainThread} from 'node:worker_threads';
import {performance} from 'node:perf_hooks';
if(isMainThread){
 let previous=performance.now(), maximum=0;
 setInterval(()=>{const now=performance.now();maximum=Math.max(maximum,now-previous-10);previous=now;},10).unref();
 setInterval(()=>{console.log('FLEET_SAMPLE '+JSON.stringify({at:Date.now(),loopMaxMs:maximum,...process.memoryUsage()}));maximum=0;},1000).unref();
}

profile.mjs

import {isMainThread} from 'node:worker_threads';
import {Session} from 'node:inspector';
import fs from 'node:fs';
import path from 'node:path';
if(isMainThread){
 const session=new Session();session.connect();
 const call=(method,params={})=>new Promise((resolve,reject)=>session.post(method,params,(err,result)=>err?reject(err):resolve(result)));
 await call('Profiler.enable');await call('Profiler.setSamplingInterval',{interval:1000});await call('Profiler.start');
 let index=0,busy=false;
 const save=async()=>{if(busy)return;busy=true;try{const {profile}=await call('Profiler.stop');fs.writeFileSync(path.join(path.dirname(process.env.OPENCLAW_STATE_DIR),`main-${process.pid}-${++index}.cpuprofile`),JSON.stringify(profile));await call('Profiler.start');}finally{busy=false;}};
 setInterval(()=>void save(),30000).unref();
 process.on('SIGTERM',()=>void save());
}

summarize.mjs

import fs from 'node:fs';
const r=JSON.parse(fs.readFileSync(process.argv[2],'utf8'));
r.samples=fs.readFileSync((r.outputRoot??r.root)+'/boot.log','utf8').split('\n').filter(l=>l.includes('FLEET_SAMPLE ')).map(l=>JSON.parse(l.slice(l.indexOf('FLEET_SAMPLE ')+13)));
const phases=['process.bootstrap','cli.main.gateway-run-bootstrap','state.schema-preflight','startup.maintenance','plugins.runtime-post-bind','sidecars.model-runtime','sidecars.chat-metadata','sidecars.reply-runtime','runtime.post-attach'];
function row(name,start,end,duration,eventLoop){const probes=r.probes.filter(p=>p.at>=start&&p.at<=end);const rss=r.rss.filter(p=>p.at>=start&&p.at<=end);return `| ${name} | ${(duration/1000).toFixed(3)} | ${eventLoop??'—'} | ${probes.filter(p=>p.status===200).length}/${probes.length} | ${rss.length?Math.max(...rss.map(s=>s.rssMb)).toFixed(0):'—'} |`;}
console.log(`Head: ${r.head}; Node: ${r.node}; agents: ${r.count}; bound: ${r.boundAt?(r.boundAt-r.started)/1000:'not observed'}s; ready: ${r.readyAt?(r.readyAt-r.started)/1000:'not observed'}s\n`);
console.log('| phase | duration s | eventLoopMax ms | /health answered/total | peak RSS MiB |\n|---|---:|---:|---:|---:|');
for(const name of phases){for(const p of r.phases.filter(p=>p.name===name)){console.log(row(name,p.at-p.durationMs,p.at,p.durationMs,p.line.match(/eventLoopMax=([\d.]+)ms/)?.[1]));}}
const end=Math.min(r.endedAt??Date.now(),r.stoppingAt??Infinity,r.readyAt?r.readyAt+90000:Infinity);if(r.readyAt)console.log(row('after ready',r.readyAt,end,end-r.readyAt,Math.max(0,...r.samples.filter(s=>s.at>=r.readyAt&&s.at<end).map(s=>s.loopMaxMs)).toFixed(1)));
const postBind=r.probes.filter(p=>p.at>=r.boundAt&&p.at<end);const ok=postBind.filter(p=>p.status===200);console.log(`\nHealth: ${ok.length}/${postBind.length}, >1s: ${ok.filter(p=>p.latencyMs>1000).length}, peak success latency: ${Math.max(0,...ok.map(p=>p.latencyMs))}ms; timeouts: ${postBind.filter(p=>p.error==='deadline').length}.`);
console.log(`Peak RSS ${Math.max(0,...r.rss.map(s=>s.rssMb)).toFixed(1)} MiB; sampler max ${Math.max(0,...r.samples.map(s=>s.loopMaxMs)).toFixed(1)}ms; exit ${JSON.stringify(r.exit)}.`);

profile-summary.mjs

import fs from 'node:fs';
import path from 'node:path';
const root=process.argv[2];
for(const file of fs.readdirSync(root).filter(f=>f.endsWith('.cpuprofile')&&(!process.argv[3]||f===process.argv[3]))){
 const p=JSON.parse(fs.readFileSync(path.join(root,file)));const nodes=new Map(p.nodes.map(n=>[n.id,n]));const parents=new Map();for(const n of p.nodes)for(const c of n.children??[])parents.set(c,n.id);
 const totals=new Map();let elapsed=0;
 for(let i=0;i<(p.samples?.length??0);i++){const time=p.timeDeltas[i]??0;elapsed+=time;const n=nodes.get(p.samples[i]);const seen=new Set();let id=n.id;while(id!==undefined){const x=nodes.get(id);if(!x)break;const f=x.callFrame;const key=`${f.functionName||'(anonymous)'} ${f.url}:${f.lineNumber+1}`;if(!seen.has(key)){seen.add(key);const stat=totals.get(key)??{self:0,total:0};stat.total+=time;if(id===n.id)stat.self+=time;totals.set(key,stat);}id=parents.get(id);}}
 console.log(`\n${file}: ${(elapsed/1e6).toFixed(3)}s sampled`);
 console.log('Top self time:');for(const [key,t] of [...totals].sort((a,b)=>b[1].self-a[1].self).slice(0,10))console.log(`${(t.self/1e6).toFixed(3)}s ${key}`);
 console.log('Top inclusive time:');
 for(const [key,t] of [...totals].filter(([key])=>!key.startsWith('(root)')).sort((a,b)=>b[1].total-a[1].total).slice(0,25))console.log(`${(t.total/1e6).toFixed(3)}s inclusive ${(t.self/1e6).toFixed(3)}s self ${key}`);
}

Project weekly review eligibility from the selected manifest policy instead
of re-entering provider activation planning for every agent. Yield monitor
specifications incrementally through the existing serialized reconciliation
so preparation yields between agents throughout the update pass.

Preserve stored execution preferences, weekly schedules, job identity,
per-row failure handling, and reconciliation authority guards.

Refs #149538
Refs #148529
@clawsweeper

clawsweeper Bot commented Sep 16, 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 gateway Gateway runtime size: M maintainer Maintainer-authored PR labels Sep 16, 2026
@steipete
steipete marked this pull request as ready for review September 16, 2026 02:17
@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. 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 Sep 16, 2026
@clawsweeper

clawsweeper Bot commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 15, 2026, 10:57 PM ET / September 16, 2026, 02:57 UTC (Revision 2).

ClawSweeper review

What this changes

The PR prepares weekly skill-review jobs incrementally using existing plugin metadata, allowing Gateway requests to progress between agent updates.

Merge readiness

✅ Ready for maintainer review

This remains a useful, focused repair that is absent from the inspected main revision. No actionable introduced defect was found, and the recorded fleet measurements support the scoped responsiveness claim.

Priority: P1
Reviewed head: cafcc973b6843cec798038a99a3b3c2fb21cd50b

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, maintainable repair with convincing scoped runtime measurements and meaningful preservation coverage.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): The matching captured body records built-Gateway before/after runs on macOS with 200 agents and external HTTP probes, showing substantially less reconciliation CPU and improved post-ready health responses. The separate 600-agent run never reached this owner and establishes no broader recovery claim.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The matching captured body records built-Gateway before/after runs on macOS with 200 agents and external HTTP probes, showing substantially less reconciliation CPU and improved post-ready health responses. The separate 600-agent run never reached this owner and establishes no broader recovery claim.
Evidence reviewed 9 items Introduced scope and current-main necessity: The pinned introduction contains only the six reported files. Comparing the merge base with fetched main produced no differences in either production owner, so main still has the eager projection and uncaptured fallback-resolution path.
Existing prepared-policy contract: The fallback resolver immediately accepts explicitly supplied manifest metadata before entering provider-load planning. The PR uses that existing contract and disables executable plugin normalization during static projection.
Reconciliation and caller compatibility: Duplicate cleanup, per-row failure handling, and pre-mutation authority guards remain intact. Removing each desired agent from the retained map before its upsert preserves existing rows when an upsert fails. Other production consumers spread the iterable and remain compatible.
Findings None None.
Security None None.

How this fits together

The Gateway reconciles configured agents into system-owned weekly Skill Workshop review jobs. Eligibility projection determines which jobs remain enabled, while the existing cron service owns persistence, scheduling, and execution.

flowchart TD
  A[Agent configuration] --> C[Project one review job]
  B[Prepared plugin metadata] --> C
  C --> D[Check runtime eligibility]
  D --> E[Yield and check current authority]
  E --> F[Persist enabled or disabled job]
  E --> G[Serve Gateway requests]
  F --> H[Remove stale review jobs]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +20, Tests +136, Docs +2. Total +158 across 6 files.

View PR surface stats
Area Files Added Removed Net
Source 2 34 14 +20
Tests 3 146 10 +136
Docs 1 2 0 +2
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 6 182 24 +158

Review metrics

Metric Value Why it matters
Observed post-ready health 59/90 → 89/90 successful probes The recorded 200-agent real-Gateway comparison demonstrates improved request service during the affected phase.
Reconciliation sampled CPU 27.643 s → 0.053 s Inclusive V8 samples support the owner-level improvement, without claiming whole-startup recovery.

Technical review

Best possible solution:

Keep incremental preparation within the existing reconciliation owner, preserving cron identity and admission while broader fleet-startup bottlenecks remain separately tracked.

Do we have a high-confidence way to reproduce the issue?

Yes: source exposes eager fleet projection and repeated provider planning, and the recorded before/after Gateway run demonstrates the scoped failure. This review did not execute a new reproduction.

Is this the best way to solve the issue?

Yes: the patch uses existing prepared-metadata and serialized reconciliation contracts without adding a competing cache, configuration option, or persistence format.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 7b4fbc2f4b68.

Labels

Label justifications:

  • P1: The repair addresses observed Gateway health starvation during large-fleet review reconciliation.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster 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 matching captured body records built-Gateway before/after runs on macOS with 200 agents and external HTTP probes, showing substantially less reconciliation CPU and improved post-ready health responses. The separate 600-agent run never reached this owner and establishes no broader recovery claim.
  • proof: sufficient: Contributor real behavior proof is sufficient. The matching captured body records built-Gateway before/after runs on macOS with 200 agents and external HTTP probes, showing substantially less reconciliation CPU and improved post-ready health responses. The separate 600-agent run never reached this owner and establishes no broader recovery claim.

Evidence

What I checked:

  • Introduced scope and current-main necessity: The pinned introduction contains only the six reported files. Comparing the merge base with fetched main produced no differences in either production owner, so main still has the eager projection and uncaptured fallback-resolution path. (src/cron/skill-collection-review-monitor.ts:209, 7b4fbc2f4b68)
  • Existing prepared-policy contract: The fallback resolver immediately accepts explicitly supplied manifest metadata before entering provider-load planning. The PR uses that existing contract and disables executable plugin normalization during static projection. (src/agents/model-fallback-candidates.ts:183, cafcc973b684)
  • Reconciliation and caller compatibility: Duplicate cleanup, per-row failure handling, and pre-mutation authority guards remain intact. Removing each desired agent from the retained map before its upsert preserves existing rows when an upsert fails. Other production consumers spread the iterable and remain compatible. (src/gateway/server-cron-skill-review-jobs.ts:54, cafcc973b684)
  • Runtime boundary: Rooted-review admission remains an OpenClaw-owned predicate and is unchanged. The Codex runtime string in fixtures exercises that predicate's exclusion; this patch neither executes nor changes the Codex dependency contract. (src/cron/execution-root-runtime.ts:11, cafcc973b684)
  • Real Gateway proof and captured-body identity: Read the complete live PR body and verified it matches the supplied 19,159-unit snapshot, SHA-256 29d9150edcc5dc291912951e04bf3262ad411a93fc50f9b0e284c33c2a8860be. Its macOS/Node 24.21.0 comparison runs the built Gateway with 200 agents and external HTTP probes: post-ready health responses improve from 59/90 to 89/90, and reconciliation sampled CPU falls from 27.643 s to 0.053 s. The disclosed 600-agent arm never reached reconciliation. Embedded rig scripts were inspected, not executed. (cafcc973b684)
  • Focused regression and preservation coverage: The new boundary test observes a real health response after the first durable row and before remaining agents are projected. Existing tests cover duplicate/stale cleanup, failed mutations, stored execution preferences, restart convergence, and revocation. The body reports 238 focused tests plus build and changed checks; this read-only review did not rerun them. (src/gateway/server-cron-skill-review-jobs.responsiveness.test.ts:91, cafcc973b684)

Likely related people:

  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; confidence: low)
  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; 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.

History

Review history (1 earlier review cycle)
  • reviewed 2026-09-16T02:25:12.915Z sha cafcc97 :: needs maintainer review before merge. :: none

@holny holny left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checked the iterable migration across the tree: both production callers are shape-safe now — claws-monitors.ts spreads the specs, server-cron-skill-review-jobs.ts iterates — and nothing else consumes the resolver's return as an array, so the lazy projection can't strand a .map/.length caller.

The retained.delete(spec.agentId) placement is load-bearing: deleting before cron.add means a failed add leaves the agent out of retained, so its existing job survives the removal pass instead of being torn down right after a failed add. That matches the previous desired behavior, but the ordering is now the contract — worth a one-line comment there so the next reader doesn't move it after the try block.

The spy on isPluginProvidersLoadInFlight in the new responsiveness test pins the expensive path well; it fails loudly if the projection ever reaches provider load planning again.

@steipete
steipete merged commit c561f0d into main Sep 16, 2026
273 checks passed
@steipete
steipete deleted the upd/fleet-startup-serve branch September 16, 2026 03:44
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 16, 2026
Project weekly review eligibility from the selected manifest policy instead
of re-entering provider activation planning for every agent. Yield monitor
specifications incrementally through the existing serialized reconciliation
so preparation yields between agents throughout the update pass.

Preserve stored execution preferences, weekly schedules, job identity,
per-row failure handling, and reconciliation authority guards.

Refs openclaw#149538
Refs openclaw#148529
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 gateway Gateway runtime maintainer Maintainer-authored PR P1 High-priority user-facing bug, regression, or broken workflow. 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.

2 participants