Repository navigation
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 25, 2026, 2:56 PM ET / 18:56 UTC. ClawSweeper reviewWhat this changesThe PR skips definitely absent configured session-store files before alias grouping and adds a regression test that bounds the resulting filesystem probes. Merge readinessNo blocking patch finding: the owner-level prefilter removes the absent-store quadratic path while retaining existing and inaccessible-path handling. The PR is still necessary because current main lacks this repair; it awaits normal exact-head integration validation. Priority: P1 Review scores
Verification
Live VerificationCommand: Result: FAIL (partial) — step 2 Assertions:
How this fits togetherGateway startup runs a legacy session-store migration before the HTTP listener is available. The migration derives store ownership from configured and discovered agents, then reads and canonicalizes real session-store files. flowchart LR
A[Gateway startup] --> B[Session migration]
C[Configured agent stores] --> D[Store ownership mapping]
D --> E{Regular file exists?}
E -->|No| F[Skip absent path]
E -->|Yes or inaccessible| G[Alias safety checks]
G --> H[Session migration results]
Before merge
Agent review detailsSecurityNone. PR surfaceSource 0, Tests +23. Total +23 across 2 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Land the owner-boundary prefilter after current-head checks confirm it integrates cleanly, retaining the existing alias and inaccessible-path safeguards. Do we have a high-confidence way to reproduce the issue? Yes—source establishes the quadratic scan over absent configured paths, and the PR’s exact-head terminal run exercises the real migration owner with up to 10,000 such paths. Is this the best way to solve the issue? Yes—the prefilter is at the migration owner that creates the unnecessary alias groups; an inode-index redesign would be broader and would need to preserve unknown-identity fail-closed behavior. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 858d95fa4dcf. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (12 earlier review cycles; latest 8 shown)
|
caf039b to
c6e4ad1
Compare
10f5eb3 to
509eb2c
Compare
Co-authored-by: goutamadwant <[email protected]>
509eb2c to
faaceab
Compare
|
Merged via squash.
|
…enclaw#126685) Co-authored-by: Peter Steinberger <[email protected]>
Closes #126676.
What Problem This Solves
Gateway session migration performs quadratic filesystem alias detection when many configured agents have no existing session stores. A 500-agent state previously performed 124,750 filesystem probes and stalled the migration owner for approximately 5.5 seconds; larger deployments scale significantly worse.
Why This Change Was Made
Check whether each candidate session-store path actually exists before adding it to physical-path alias grouping. Definitely absent paths are skipped immediately, while existing files and inaccessible paths preserve the original conservative, fail-closed alias ownership and warning behavior. Reuse the existing owner map to keep the production change net-neutral.
Production LOC: +9/-9 (net 0). Regression tests: +23.
User Impact
Session-store migration now scales linearly with absent per-agent stores. Existing aliases, shared stores, symlinks, hardlinks, inaccessible paths, and migration idempotence retain their previous behavior.
Evidence
509eb2c53f055f75eb1fdeb6cff92de374b4f60d.Co-authored-by: goutamadwant <[email protected]>.Inspectable real production-owner terminal proof
node --import tsx --input-type=module -e 'import fs from "node:fs"; import os from "node:os"; import path from "node:path"; import { performance } from "node:perf_hooks"; import { migrateOrphanedSessionKeys } from "./src/infra/state-migrations.session-store.ts"; import { EMPTY_LEGACY_SESSION_SURFACES } from "./src/plugins/legacy-session-surfaces.types.ts"; for (const agents of [100,250,500,10000]) { const state=fs.mkdtempSync(path.join(os.tmpdir(),"openclaw-session-proof-")); const stat=fs.statSync; let probes=0; fs.statSync=function(candidate,...args){ if(String(candidate).endsWith("sessions.json"))probes++; return stat.call(fs,candidate,...args) }; const started=performance.now(); try { const result=await migrateOrphanedSessionKeys({cfg:{session:{store:path.join(state,"stores","{agentId}","sessions.json")},agents:{list:Array.from({length:agents},(_,index)=>({id:`agent-${index}`}))}},env:{OPENCLAW_STATE_DIR:state},additionalAgentIds:[],legacySessionSurfaces:EMPTY_LEGACY_SESSION_SURFACES}); console.log(JSON.stringify({agents,sessionStoreStatProbes:probes,durationMs:Math.round(performance.now()-started),changes:result.changes.length,warnings:result.warnings.length})); } finally {fs.statSync=stat;fs.rmSync(state,{recursive:true,force:true})} }' {"agents":100,"sessionStoreStatProbes":100,"durationMs":1,"changes":0,"warnings":0} {"agents":250,"sessionStoreStatProbes":250,"durationMs":1,"changes":0,"warnings":0} {"agents":500,"sessionStoreStatProbes":500,"durationMs":1,"changes":0,"warnings":0} {"agents":10000,"sessionStoreStatProbes":10000,"durationMs":26,"changes":0,"warnings":0}This is real production migration-owner execution against genuine configured agent lists and isolated temporary filesystem state. It is not a full Gateway startup measurement and does not require or expose provider credentials.
Disclosure: AI was used to understand the codebase and review the fix.