Skip to content

fix: avoid chat metadata stalls during fleet startup - #149716

Merged
steipete merged 1 commit into
mainfrom
upd/fleet-chat-metadata
Sep 16, 2026
Merged

steipete merged 1 commit into
mainfrom
upd/fleet-chat-metadata

Conversation

@steipete

@steipete steipete commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

Refs #149538
Refs #148529

What Problem This Solves

Gateways with large agent fleets block HTTP service while startup eagerly prepares and retains chat command and model projections for every agent, before any metadata request.

User Impact

Metadata requests prepare their agent on demand and reuse bounded caches. History continues using already-settled optional catalogs; shared model/account publication fences and personal-account isolation remain in place. Other startup owners still need work to restore serving throughout startup on large fleets.

Why This Change Was Made

The existing chat-metadata owner now publishes captured owner facts on refresh. This removes the eager fleet loop, aggregate presentation wait, and staged-generation path. Command preparation and neutral/session projections use the existing 64-entry bound, and shutdown still joins evicted or superseded work.

Production: +51/-113 (−62). Tests: +207/-170 (+37). Docs: +5/-4 (+1). This runtime cache change requires no configuration or state migration. #149389’s model-row indexing fix is included by the required rebase; #148264’s cross-refresh reuse remains separate. The fingerprint owners in #149314 are untouched by this patch.

Evidence

Three new regression cases failed against unchanged production because refresh entered presentation preparation for all agents, including 200 builder calls in the fleet case. All 172 focused tests pass on the final rebased head, including a real HTTP health request while one agent is suspended, another agent's metadata response, bounded retention and rebuild after eviction, shutdown joins, real Gateway RPC failure isolation, native/personal-account behavior, optional history, and published SQLite model-owner fixtures.

node scripts/check-changed.mjs and git diff --check pass. Fresh local and committed-branch Codex reviews through P1 are scoped-clean. pnpm build passes at final head fce07c65784dfac5ae7f1535555525e995c459af. Its exact-head CI run is green.

#149389 merged while the 600-agent arm was running. The required rebase onto fbf926add80b is complete at fce07c65784d, with the identical stable patch ID d1b7c84609f3948dd96bd97ce44c898b91f140b9. The metadata owner/facts/lifecycle code is unchanged on the new base; the landed model-row index was verified with the expanded focused suites. Measurements below remain labeled with their actual original candidate revision.

200-agent results (before fa67da641b30, after 1b602e4a91ef):

Phase / observation Duration s eventLoopMax ms /health answered/total Peak RSS MiB
Chat metadata — before 83.535 39325.8 12/83 1309
Chat metadata — after 0.276 0.0 0/0 —
Post-attach aggregate — before 394.864 0.0 13/395 1345
Post-attach aggregate — after 160.383 0.0 0/161 1637
90 s after ready — before 90.000 34916.6 29/90 2239
90 s after ready — after 90.000 34684.9 35/90 2216

The after metadata phase finished between one-second probes/RSS samples, so its 0/0 is an empty observation interval. Trace histograms can miss blocks during timer starvation; the post-ready delay uses the independent sampler. The metadata invariant is also enforced by zero eager builder calls, successful health/other-agent work while one requested agent is suspended, and a 64-entry retention/rebuild boundary.

Process peak RSS remains about 2.2 GiB (2239.0 → 2215.5 MiB); this run does not establish a whole-process memory reduction. The startup owner now retains no command/model projections until requested, and populated caches remain bounded. Other owners still block serving: after-run health was 35/251 overall with 181 deadlines, and model-runtime preparation took 142.749 s. These original measurements predate the required rebase. The final base also includes the independent post-ready reconciliation fix in #149600, so those post-ready rows do not describe the final combined tree.

Bootstrap varied from 742.717 to 411.193 s, so the aggregate timing difference must not be attributed solely to this patch. Both observed Gateways exited normally after the rig's cutoff. Teardown probes are excluded.

The rig uses isolated state and a free loopback port, distinct workspaces and product-bootstrapped agent SQLite databases, 54 configured models per agent, 12 enabled bundled plugins, no channels, and a 2560 MiB heap cap. Node: 24.21.0. These are single observations on a shared host; process RSS and aggregate startup timings include other owners.

# In a disposable checkout, with the rig files below under .local/fleet-serve/:
git switch --detach fa67da641b300168698b89688fe4845031f16d46
pnpm build
/opt/homebrew/opt/node@24/bin/node .local/fleet-serve/run.mjs 200 baseline-200 profile pr-b-before
# Build the candidate commit, then repeat with the same fixture.
git switch --detach 1b602e4a91efe757d7f35f4f568e3a321665c385
pnpm build
/opt/homebrew/opt/node@24/bin/node .local/fleet-serve/run.mjs 200 baseline-200 profile pr-b-after
# One progress arm after marking this PR ready.
/opt/homebrew/opt/node@24/bin/node .local/fleet-serve/run.mjs 600 baseline-600 plain pr-b-after

Original-head CI run 35057945784 failed on three main-side issues: ui/src/pages/chat/chat-pane-render.ts has 702 counted lines; goals-operations.test.ts observes 4 reads against a bound of 3; and the CI-planner tail-48/tail-49 fixtures throw “expected fixture config to be defined”. CI tested merge commit 1c6d934d2cdf, whose main parent is f0eb01f0f160. Each failing file and its primary owner is byte-identical between that parent and the CI merge. The Goal assertion and planner fixtures came from #149537 and #149665 respectively. These unrelated repairs were kept outside this metadata change. The final rebased head’s CI is green.

ClawSweeper reviewed this exact head and found no patch defects. Its remaining merge-risk item concerns whole-fleet recovery. The maintainer scope for this series is one measured owner per PR: keep metadata preparation demand-driven here and track the remaining startup bottlenecks separately in #149538 and #148529. The 600-agent arm records progress without claiming whole-startup recovery.

The one 600-agent progress arm ran after the PR was marked ready, on original head 1b602e4a91ef before the mandatory rebase:

600-agent observation Result
Observation cutoff 1800.403 s
Listener / ready / chat-metadata phase Not reached
Health probes 0 attempted; probing begins at bind
Peak process RSS 1892.4 MiB
Independent sampler maximum delay 193390.6 ms, pre-bind
Stop Rig-issued SIGTERM; exit 0.106 s later; no forced kill

Four completed config-snapshot spans took 177.400, 193.400, 127.177, and 154.046 seconds; legacy-state migration took 259.058 seconds. The last completed trace was plugin-index persistence at 1499.425 seconds. Bootstrap had not settled at the cutoff, so this arm supplies no 600-agent observation of the repaired metadata owner. The rig stopped the observation; this was not an observed OOM. Whole-fleet startup recovery remains unproven.

An additional boot attempt on final head fce07c65784d exited 78 before bind because the retained fixture needed the newly landed agent-schema 20→21 migration. The authorized isolated doctor --fix --non-interactive run upgraded all 200 databases, using OPENCLAW_SERVICE_REPAIR_POLICY=external to skip native service maintenance and a free OPENCLAW_GATEWAY_PORT for the isolated target. After the plugin-index message, Doctor continued CPU-heavy diagnostics without finishing; the next contribution in its source is the per-agent active-tool-schema diagnostic. At 32m39s it used 81% CPU and 2154.9 MiB RSS. I stopped only that fixture process with SIGTERM and used the lane’s stop-report escape hatch for this additional verification. Full Doctor completion and a new final-head fleet boot measurement are not claimed. No host state or Gateway was modified.

# Additional final-head attempt and the required fixture migration:
git switch --detach fce07c65784dfac5ae7f1535555525e995c459af
pnpm install --frozen-lockfile
pnpm build
/opt/homebrew/opt/node@24/bin/node .local/fleet-serve/run.mjs 200 baseline-200 profile pr-b-after-rebase
/opt/homebrew/opt/node@24/bin/node .local/fleet-serve/doctor.mjs baseline-200

The generator and instrumentation remain untracked under .local/fleet-serve/. Reproduction source follows.

Synthetic fleet rig source

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)}.`);
Isolated Doctor helper used for the additional attempt
import fs from 'node:fs';
import path from 'node:path';
import net from 'node:net';
import {spawn} from 'node:child_process';
const root=path.resolve('.local/fleet-serve',process.argv[2]);
const configPath=path.join(root,'openclaw.json');
const cfg=JSON.parse(fs.readFileSync(configPath));
for(const agent of Object.values(cfg.agents.entries))for(const key of ['workspace','agentDir'])if(!path.resolve(agent[key]).startsWith(root+path.sep))throw new Error(`Fixture ${key} escapes the isolated root`);
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));
fs.copyFileSync(configPath,path.join(root,'openclaw.before-doctor.json'));
const env={HOME:root,OPENCLAW_HOME:root,OPENCLAW_STATE_DIR:path.join(root,'state'),OPENCLAW_CONFIG_PATH:configPath,OPENCLAW_GATEWAY_PORT:String(port),OPENCLAW_SERVICE_REPAIR_POLICY:'external',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_NO_RESPAWN:'1',OPENCLAW_TEST_DISABLE_UPDATE_CHECK:'1',npm_config_update_notifier:'false'};
const child=spawn(process.execPath,['--max-old-space-size=2560','dist/entry.js','doctor','--fix','--non-interactive'],{env,stdio:'inherit'});
const code=await new Promise(r=>child.on('exit',r));process.exitCode=code??1;

@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 agents Agent runtime and tooling size: L maintainer Maintainer-authored PR labels Sep 16, 2026
@steipete
steipete marked this pull request as ready for review September 16, 2026 05:02
@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 16, 2026, 3:43 AM ET / 07:43 UTC (Revision 4).

ClawSweeper review

What this changes

The PR prepares chat commands and model metadata when requested, bounds retained caches, and updates lifecycle tests and protocol documentation.

Merge readiness

✅ Ready for maintainer review

This remains a useful, scoped fix absent from current main. No actionable patch defects remain; the clarified owner-level scope resolves the previous whole-fleet concern without claiming that the broader startup issues are fixed.

Priority: P1
Reviewed head: fce07c65784dfac5ae7f1535555525e995c459af

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused simplification with relevant real Gateway measurements, meaningful regression coverage, and no identified correctness blocker.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The isolated 200-agent real Gateway comparison exercises startup metadata refresh and records 83.535 s → 0.276 s; the measured runtime, facts, and lifecycle blobs match this head. Boundary tests supplement that result. Whole-fleet recovery and a completed final-head fleet boot are expressly unclaimed.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The isolated 200-agent real Gateway comparison exercises startup metadata refresh and records 83.535 s → 0.276 s; the measured runtime, facts, and lifecycle blobs match this head. Boundary tests supplement that result. Whole-fleet recovery and a completed final-head fleet boot are expressly unclaimed.
Evidence reviewed 9 items Introduced production change: The pinned merge-base-to-head diff replaces eager generation preparation with demand-driven agent preparation. Refresh publishes facts synchronously after its prerequisite; command and projection caches retain at most 64 entries each.
Still necessary on main: Fetched main retains buildGeneration, the per-agent preparation loop, and aggregate preparation wait. The runtime, facts, and lifecycle files have no changes between the pinned merge base and fetched main.
Release check: GitHub identifies v2026.9.4 as the latest release. Its runtime source still calls buildGeneration during refresh; the inspected release blob is a666a6093746722f3e92ce5bb0b1e9cf40b93240.
Findings None None.
Security None None.

How this fits together

The Gateway's chat metadata service combines published model, account, and skill facts into responses for chat clients. Startup refreshes its facts, while metadata requests and optional history decorations consume its projections.

flowchart TD
  A[Published model and account facts] --> B[Metadata refresh]
  B --> C[Current generation]
  D[Chat metadata request] --> E[Prepare requested agent]
  C --> E
  E --> F[Bounded projection caches]
  F --> G[Metadata response]
  F --> H[Optional history catalogs]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source -62, Tests +37, Docs +1. Total -24 across 10 files.

View PR surface stats
Area Files Added Removed Net
Source 1 51 113 -62
Tests 8 207 170 +37
Docs 1 5 4 +1
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 10 263 287 -24

Review metrics

Metric Value Why it matters
Metadata startup measurement 83.535 s → 0.276 s with 200 agents The isolated Gateway comparison demonstrates the scoped owner improvement, without establishing whole-startup recovery.
Retained preparation bounds Commands and neutral projections: 64 entries each Fleet size no longer determines how many presentation results startup eagerly retains.

Technical review

Best possible solution:

Keep metadata preparation demand-driven within its existing lifecycle owner, preserving optional history reads and account freshness.

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

Yes: current main eagerly prepares every agent during metadata refresh, and the supplied isolated Gateway comparison measures that cost; this review did not execute the workload.

Is this the best way to solve the issue?

Yes: removing eager presentation work from the existing owner is a focused repair, with bounded reuse and preserved publication checks; other startup owners can be repaired independently.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 891a6b7d1977.

Labels

Label justifications:

  • P1: This addresses a measured metadata startup stall contributing to broken Gateway availability on real large-agent fleets.
  • 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 isolated 200-agent real Gateway comparison exercises startup metadata refresh and records 83.535 s → 0.276 s; the measured runtime, facts, and lifecycle blobs match this head. Boundary tests supplement that result. Whole-fleet recovery and a completed final-head fleet boot are expressly unclaimed.
  • proof: sufficient: Contributor real behavior proof is sufficient. The isolated 200-agent real Gateway comparison exercises startup metadata refresh and records 83.535 s → 0.276 s; the measured runtime, facts, and lifecycle blobs match this head. Boundary tests supplement that result. Whole-fleet recovery and a completed final-head fleet boot are expressly unclaimed.

Evidence

What I checked:

Likely related people:

  • steipete: 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.

History

Review history (3 earlier review cycles)
  • reviewed 2026-09-16T05:14:21.566Z sha 1b602e4a91efe757d7f35f4f568e3a321665c385 :: blocked before merge. :: none
  • reviewed 2026-09-16T06:12:55.885Z sha 1b602e4a91efe757d7f35f4f568e3a321665c385 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-16T06:58:40.691Z sha fce07c6 :: needs maintainer review before merge. :: none

@steipete
steipete force-pushed the upd/fleet-chat-metadata branch from 1b602e4 to fce07c6 Compare September 16, 2026 06:52
@steipete
steipete merged commit 8baa2e7 into main Sep 16, 2026
193 checks passed
@steipete
steipete deleted the upd/fleet-chat-metadata branch September 16, 2026 08:13
@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 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling 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: L 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