Repository navigation
fix: project memory misses its budget on large Knowledge vaults - #198441
Conversation
Reuse the scan owner’s file stats and validated approval facts instead of repeating that work on every recall. Preserve successful prompt bytes and the one-second deadline; record a skipped diagnostic outcome when the deadline expires. Add synthetic owner measurements and regression coverage.
|
🦞👀 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 Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex review: needs maintainer review before merge. What this changesReuse scan-owned approval facts and file metadata, and emit a diagnostic event when project recall exceeds its budget. Example: Warm project recall over 62,000 Knowledge memories across 2,000 projects.
Review scores
ProductKind: Performance · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR makes a useful, focused improvement to large-vault recall. The prior suppression finding is fixed, and no actionable introduced defect was found; current-head CI remains pending. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherAgent prompt preparation requests project candidates from the selected memory provider; Knowledge scans the authorized vault and returns approved summaries, while the host bounds preparation to one second. flowchart TD
A[Agent prompt preparation] --> B[Project recall budget]
B --> C[Knowledge memory provider]
C --> D[Authorized storage operation]
D --> E[Validated vault scan]
E --> F[Approved project summaries]
F --> A
B --> G[Skipped recall diagnostic]
Technical reviewBest possible solution: Keep the optimization within the existing scan owner and preserve the deadline, eligibility rules, and explicit skipped outcome. Do we have a high-confidence way to reproduce the issue? Base source shows two stats per catalog entry and repeated approval validation during candidate selection; supplied controlled measurements exercise this work, but no target code was executed during this read-only review. Is this the best way to solve the issue? The patch removes repeated work at its existing owner without introducing another invalidation policy; cold index loading remains an explicitly documented limitation. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 3991f8f22494. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +23, Tests +79, Docs +8, Other +223. Total +333 across 14 files. Added test files: 0. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (1 earlier review cycle)
Reviewed November 13, 2026, 3:53 PM ET / 20:53 UTC (Revision 2). |
Remove benchmark lint suppressions by binding instance methods, snapshot cold phase counters before warmup, and keep cold module loading outside the audience contract test. Production recall behavior is unchanged.
|
Addressed item 1 on
The additional audience-test CI failure is also addressed: audience.test.ts:17 preloads the runtime before the real lineage assertions. The initial CI case took 4.98 seconds versus ~0.2 seconds for subsequent cases. Fixed Bun proof passes all three cases with a fresh transpiler cache. The exact-parent replay passed, so this is not being claimed as proven inherited or used for an admin exception; fresh CI must pass. The PR body now contains the completed synthetic large-store controls. Selected measured output (production sources unchanged by this test-only repair): {
"nativeWarmSamplesPerArm": 50,
"wallMs": {"before": {"p50": 776.04, "p95": 891.63}, "after": {"p50": 279.60, "p95": 314.09}},
"processCpuMs": {"before": {"p50": 929.38, "p95": 1369.31}, "after": {"p50": 302.50, "p95": 343.35}},
"sampledStorageBytesPerCall": {"before": 793081391, "after": 219026805},
"statsPerWarmCall": {"before": 124022, "after": 62022},
"successfulPromptSha256": "2aec53284a444ed9d14f7ff82d25a0c955e0a92a021f128b344b66b6c7595ac2",
"coldSkippedCalls": {"before": 5, "after": 5},
"coldSkippedDiagnosticEvents": {"before": 0, "after": 5}
}Cold reopen remains ~27 seconds; no claim that this fixes initial loading. The native cold-path probe observes the real trusted diagnostic event; a separate isolated real-model Gateway proof verifies successful project-memory use. Its inspected result is @clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Merged via squash auto-merge.
|
…claw#198441) * fix(knowledge): reduce project recall budget misses Reuse the scan owner’s file stats and validated approval facts instead of repeating that work on every recall. Preserve successful prompt bytes and the one-second deadline; record a skipped diagnostic outcome when the deadline expires. Add synthetic owner measurements and regression coverage. * test(memory): bind recall probes and preload audience runtime Remove benchmark lint suppressions by binding instance methods, snapshot cold phase counters before warmup, and keep cold module loading outside the audience contract test. Production recall behavior is unchanged.
Release adaptation: extract only fragment-before-decode repair and focused scan/backlink regression from openclaw#191791; retain baseline parser and unrelated test cleanup. Later openclaw#195027, openclaw#196767 and openclaw#198441 changes are unrelated and already represented by baseline parser structure; no later PR-number follow-up. (cherry picked from commit 2563438) Co-authored-by: RomneyDa <[email protected]> (cherry picked from commit 7fdc9ad3b334ac08cb9a76604cfbb78ec56ef479) (cherry picked from commit af609748bca14f61086ecfa82a961787701bdfcd)
What Problem This Solves
Fixes avoidable project-memory omissions when a large Knowledge vault exhausts the one-second recall budget.
User Impact
Warm recall does less repeated work while preserving successful prompt bytes. If the budget still expires, the existing diagnostics stream records an explicit skipped outcome, including its reason and budget, for the existing tracing exporter. Cold index loading and queued work can still exceed the unchanged deadline. No configuration or schema migration is required.
Why This Change Was Made
The scanner statted every entry twice and candidate selection revalidated approval metadata already validated by the scan. Reuse the observed stat and the validated facts owned by the existing, file-stamp-invalidated scan snapshot. This adds no independent cache or invalidation policy.
Production code grows by 23 lines: 11 for the skip event and 12 for the scan-owned approval facts and stat reuse.
Evidence
Regression tests fail on the exact parent and pass on this head: repeated approval validation is removed, unchanged records receive one stat, eligible candidates remain identical, and budget omissions emit the trusted diagnostic event. Focused Knowledge vault/link/provider/save-cost tests and 43 core/audience/prefix/compact tests pass. Runtime build and Codex autoreview pass. An isolated Gateway with a real model returned a random phrase available only in approved project memory.
Controlled native Linux/btrfs A,A,B,A,B,B,A,B,A,B runs (50 warm samples per arm) on 62,000 memories / 2,000 projects, a separate 62,000-file / 1.1 GB workspace, and a synthetic 35.7 GiB agent DB with 5,001 sessions:
All 100 successful native prompts have the same SHA-256. The initial A/A medians differ by 0.42%; the full baseline median range is 676–810 ms versus 261–306 ms after the fix. Allocation sampling ran separately in A,B,A,B processes (10 calls each); repeat averages differ by 0.69% before and 0.13% after. These direct-storage allocation samples exclude transport and caller allocation. Native timings use the default writes-enabled provider path; the attribution probe uses writes-disabled storage. Queue wait p95 stays below 0.03 ms, and main-thread CPU p95 stays below 2.6 ms.
Cold reopen settlement remains about 27 seconds in both arms, so this does not solve initial index loading. All five fixed cold skips emit the new diagnostic, versus none before. No warm sample skipped. A separate oversized-import fixture exposed an existing Git change-batch string-size limit; that setup failure is excluded from the results.
Measured production bytes are at 53c8b90 against parent cda1842. The subsequent CI repair only binds benchmark instrumentation to its instances; production is unchanged. Initial CI rejected benchmark lint suppressions; all three are removed, and the failed policy test, script typecheck, and script lint pass locally. The probe also snapshots cold phase counters before explicit warmup; reported warm statistics and cold wall/CPU measurements are unaffected.
pnpm check:changedpasses its selected checks except inherited dead-export failures, independently reproduced on the exact parent cda1842. These are main regressions, not passing checks:TELEPORT_PTandQA_UX_STREAM_END_MARKER: introduced by 858b5b0 (chore(ios): measure chat scroll and streaming stability on the simulator #198293).RELEASE_VALIDATION_WAIVERS: remaining consumers removed by b9f1e62 (test(release): remove waiver regression coverage #198274).adoptTelegramDmTopicMessageandTELEGRAM_DM_TOPIC_ADOPT_WINDOW_SEC, introduced without external production consumers by 90c620b (fix(telegram): first DM message lands in root chat when the client creates the topic separately #169444).The same first CI run also failed the audience integration test's first case (4.98 s; subsequent cases ~0.2 s). That test now preloads the runtime before checking real lineage semantics, keeping cold module loading outside this audience assertion. The fixed test passes under Bun with a fresh transpiler cache. The exact-parent replay passed too, so this is not claimed as a proven inherited failure or an admin-merge exception. Fresh CI is required.