Skip to content

fix(memory): distinguish missing file reads - #125979

Merged
steipete merged 3 commits into
mainfrom
steipete/funny-franklin-b6d9ba
Aug 20, 2026
Merged

steipete merged 3 commits into
mainfrom
steipete/funny-franklin-b6d9ba

Conversation

@steipete

@steipete steipete commented Aug 18, 2026 •

Copy link
Copy Markdown
Contributor

Related: #125978

AI-assisted implementation; reviewed and verified by the maintainer.

What Problem This Solves

Fixes an issue where memory_get could return a missing file as an empty successful read. That made a genuinely absent memory file indistinguishable from a valid empty excerpt and could cause agents to treat missing content as present.

Why This Change Was Made

Canonical memory reads now return an explicit status: "ok" or status: "not_found", so empty files and empty ranges cannot collide with missing files. Because pre-status memory-manager results shipped publicly, plugin registration accepts that legacy input temporarily and the host normalizes it once at manager acquisition. All statusless legacy results preserve their prior successful-read semantics; only an explicit not_found reports absence. The adapter preserves stable manager identity, receiver binding, and lifecycle behavior.

This is PR 1 of the memory contract repair series. Corpus availability, source drift/status, and source-aware guidance remain tracked by #125978 and will land separately.

Production LOC: +121/-19 (net +102). Tests/support: +268/-65. Docs: +14. The growth is concentrated in the versioned registered-input/current-output contract, one host adapter, its compatibility record, and external producer/consumer type coverage.

User Impact

Built-in memory reads reliably distinguish missing files from valid empty excerpts. Existing registered memory managers keep their historical statusless success behavior through the next Plugin SDK major, while new producers can report absence explicitly.

Evidence

Validated against PR base af3b86091f4bdc564c2df005259239c09cbc3e4f; current head is f121f4365454a07b844f3c44297593c9ce99d0ac.

  • Focused read-contract and compatibility suites passed across memory-host SDK, plugin manager acquisition, memory-core tools, and memory-wiki consumers; the final compatibility-policy suite passed 26/26 tests.
  • Public SDK type smoke covers a legacy registered producer and current consumer metadata access.
  • Per-commit assertion-safety ratchet and git diff --check: passed.
  • Exact-base clean-clone node scripts/check-changed.mjs: passed across SDK surface checks, core/extension/script typechecks, lint, dead-export scans, compatibility guards, and architecture/storage guards.
  • Fresh Codex autoreview on the final branch: clean, no accepted/actionable findings; correctness 0.97.
  • Authenticated isolated live turn on exact head: anthropic/claude-sonnet-4-6 called memory_get for memory/definitely-missing-live-proof.md, received status: "not_found", and replied STATUS=not_found; 9 transcript events were verified in the isolated agent database.

No operator gateway or normal OpenClaw state was touched. No LanceDB path, SQLite schema version, protocol version, lockfile, or changelog is changed.

@clawsweeper

clawsweeper Bot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation extensions: memory-core Extension: memory-core extensions: memory-wiki size: XL maintainer Maintainer-authored PR labels Aug 18, 2026
@steipete steipete self-assigned this Aug 18, 2026
@steipete
steipete force-pushed the steipete/funny-franklin-b6d9ba branch from bbb281c to 703470b Compare August 18, 2026 19:55
@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 18, 2026
@clawsweeper

clawsweeper Bot commented Aug 18, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 19, 2026, 10:50 PM ET / August 20, 2026, 02:50 UTC.

ClawSweeper review

What this changes

This PR adds explicit success/not-found statuses to memory-file reads, adapts legacy registered memory managers at acquisition, and updates memory consumers, SDK exports, tests, and migration guidance.

Regression provenance

Possible regression — probable (reviewed change; reproduction). No predecessor PR is attributed.

Merge readiness

⚠️ Ready for maintainer review - 3 items remain

The final head addresses the prior compatibility blocker: statusless legacy reads now normalize to successful reads, while only explicit not-found values represent absence. This maintainer-owned draft remains necessary because current main still uses the ambiguous result shape; it needs exact-head validation before merge.

Priority: P1
Reviewed head: f121f4365454a07b844f3c44297593c9ce99d0ac

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The repaired compatibility path is source-backed and focused, with the remaining confidence gap limited to validation recorded against the preceding head.
Proof confidence 🌊 off-meta tidepool Not applicable: This maintainer-authored PR includes an isolated live missing-file demonstration in its body; contributor-proof gating does not apply, though exact-head focused validation still needs refresh.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This maintainer-authored PR includes an isolated live missing-file demonstration in its body; contributor-proof gating does not apply, though exact-head focused validation still needs refresh.
Evidence reviewed 5 items Current-main gap: Current main still defines a memory read as an untagged object, so an empty successful read and an absent file share the same observable shape; this PR remains necessary.
Canonical producer and consumers: The branch makes missing files explicit at the file-read producer and has both the memory tool and wiki consumer branch on the discriminant instead of inferring absence from empty metadata.
Legacy compatibility repair: The adapter preserves every statusless registered result as status ok, including an empty result without range metadata; the focused test covers bare empty, ranged empty, nonempty, canonical success, canonical absence, stable adapter identity, and receiver-bound lifecycle calls.
Findings None None.
Security None None.

Live Verification

Command: pnpm openclaw --help

Result: PASS (completed)

pnpm openclaw --helprunner@runnervmzvulz:/tmp/clawsweeper-live-proof-125979-vhV8hP/target$ pnpm openclaw --help
pnpm openclaw --help
$ node scripts/run-node.mjs --help
[openclaw] Building TypeScript (dist is stale: missing_build_stamp - build stamp missing).
[openclaw] Building bundled plugin assets.
[canvas] build: node scripts/bundle-a2ui.mjs
[log] ‹DIR›/a2ui.bundle.js  chunk │ size: 399.96 kB
[log] ‹DIR›/a2ui-v0.9.bundle.js  chunk │ size: 615.66 kB
[log]
[success] rolldown v1.2.0 Finished in 104.34 ms
[diffs] build: node --import tsx ../../scripts/build-diffs-viewer-runtime.mts curated
[diffs-language-pack] build: node --import tsx ../../scripts/build-diffs-viewer-runtime.mts full
[discord] build: node --import tsx ../../scripts/build-discord-activity-sdk.mts
[tsdown-build] invocation 1/2 finished in 0.7s
node_modules/web-tree-sitter/web-tree-sitter.js (2343:30) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
      ╭─[ node_modules/web-tree-sitter/web-tree-sitter.js:2343:31 ]
      │
 2343 │           ASM_CONSTS[start] = eval(func);
      │                               ──┬─
      │                                 ╰─── Use of direct ˋevalˋ here.
      │
      │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
──────╯

node_modules/web-tree-sitter/web-tree-sitter.js (2366:32) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
      ╭─[ node_modules/web-tree-sitter/web-tree-sitter.js:2366:33 ]
      │
 2366 │           moduleExports[name] = eval(func);
      │                                 ──┬─
      │                                   ╰─── Use of direct ˋevalˋ here.
      │
      │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
──────╯

node_modules/playwright-core/lib/coreBundle.js (65821:28) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
       ╭─[ node_modules/playwright-core/lib/coreBundle.js:65821:29 ]
       │
 65821 │               const value = eval(ˋ(${expr})ˋ);
       │                             ──┬─
       │                               ╰─── Use of direct ˋevalˋ here.
       │
       │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
───────╯

node_modules/playwright-core/lib/coreBundle.js (65828:28) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
       ╭─[ node_modules/playwright-core/lib/coreBundle.js:65828:29 ]
       │
 65828 │               const value = eval(ˋ(${expr})ˋ);
       │                             ──┬─
       │                               ╰─── Use of direct ˋevalˋ here.
       │
       │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
───────╯

[tsdown-build] invocation 2/2 finished in 13.8s
[plugin-control-plane-loads] verified 36 built modules with native require and checked doctor closures
runtime-postbuild: 10 phases completed in 4344ms (slowest: built plugin control-plane loads 3563ms)

OpenClaw 2026.8.1 (f121f43) — All your chats, one OpenClaw.

Usage: openclaw [options] [command]

Options:
  --container ‹name›   Run the CLI inside a running Podman/Docker container named ‹name› (default: env OPENCLAW_CONTAINER)
  --dev                Dev profile: isolate state under ~/.openclaw-dev, default gateway port 19001, and shift derived ports (browser/canvas)
  -h, --help           Display help for command
  --log-level ‹level›  Global log level override for file + console 
… output truncated …

Assertions:

  • PASS expect_output: OpenClaw

How this fits together

Memory plugins supply file excerpts to memory-core tools and the memory-wiki lookup path. The plugin runtime normalizes manager output before those consumers decide whether to return content, fall back to another corpus, or skip an absent file.

flowchart LR
  A[Memory file request] --> B[Memory manager]
  B --> C[Plugin runtime adapter]
  C --> D{Read status}
  D -->|ok| E[Memory tool or wiki result]
  D -->|not found| F[Fallback or skip]
  G[Legacy manager result] --> C
Loading

Before merge

  • Resolve merge risk (P1) - This is a public Plugin SDK result-shape change; external registered managers remain safe only if the statusless-input adapter and its documented next-major removal boundary are retained.
  • Resolve merge risk (P1) - The PR body’s recorded validation names an earlier head, while the current head contains the behavioral compatibility repair; exact-head focused validation should be recorded before merge.
  • Complete next step (P2) - This protected maintainer PR has no mechanical repair remaining; refresh exact-head validation and review the public SDK compatibility window before merge.
Agent review details

Security

None.

PR surface

Source +99, Tests +174, Docs +14, Other +32. Total +319 across 22 files.

View PR surface stats
Area Files Added Removed Net
Source 13 127 28 +99
Tests 7 230 56 +174
Docs 1 14 0 +14
Config 0 0 0 0
Generated 0 0 0 0
Other 1 32 0 +32
Total 22 403 84 +319

Review metrics

Metric Value Why it matters
Production versus test delta production +127/-19; tests/support +253/-65; docs +12 The positive production delta is the versioned result contract and one registration-bound compatibility adapter; the public SDK compatibility surface merits exact-head validation.

Stored data model

Persistent data-model change detected: migration/backfill/repair: src/plugins/compat/registry-records.ts, serialized state: extensions/memory-core/src/memory/search-manager.test.ts, serialized state: scripts/fixtures/packed-plugin-sdk-type-smoke.ts, serialized state: src/plugins/memory-runtime.test.ts, serialized state: src/plugins/memory-runtime.ts, serialized state: src/plugins/registry-contribution-types.ts, and 17 more. Confirm migration or upgrade compatibility proof before merge.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #125978
Summary: This PR is the stated first repair for the missing-read discriminator within the broader memory-coverage issue.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge-risk options

Maintainer options:

  1. Refresh exact-head compatibility proof (recommended)
    Run and record the focused memory-runtime and memory-host SDK checks on the current head before marking this draft ready for merge.
  2. Pause for SDK contract review
    Keep the draft open if maintainers want to change the next-major compatibility window or the public result contract before validating it.

Technical review

Best possible solution:

Land one canonical discriminated read-result contract with the registration-bound legacy adapter, after exact-head validation confirms both absent files and statusless empty legacy successes remain distinct.

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

Yes—source inspection gives a high-confidence path: current main returns an untagged empty result for a missing file, while the branch’s producer and consumer tests exercise explicit not-found and empty-success outcomes. This review did not execute the suite locally.

Is this the best way to solve the issue?

Yes—the producer-owned discriminated result plus a single registration-bound legacy adapter is the narrowest maintainable repair; it removes consumer-side heuristics without breaking statusless registered managers during the announced window.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 29cfd195d19d.

Labels

Label changes:

  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-authored PR includes an isolated live missing-file demonstration in its body; contributor-proof gating does not apply, though exact-head focused validation still needs refresh.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.
  • remove status: ⏳ waiting on author: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P1: Current main can present an absent memory file as a successful empty read, which can silently mislead memory consumers.
  • merge-risk: 🚨 compatibility: The PR changes a shipped plugin-facing memory-manager result contract and temporarily supports statusless external producer output.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-authored PR includes an isolated live missing-file demonstration in its body; contributor-proof gating does not apply, though exact-head focused validation still needs refresh.

Evidence

What I checked:

Likely related people:

  • steipete: Authored the current-head compatibility normalization and the focused lifecycle/legacy-result regression coverage. (role: current memory-contract implementer; confidence: high; commits: f121f4365454, 6d3fde4f037c; files: src/plugins/memory-runtime.ts, src/plugins/memory-runtime.test.ts, packages/memory-host-sdk/src/host/types.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Record the focused memory runtime and host SDK suites against f121f43.

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 (6 earlier review cycles)
  • reviewed 2026-08-18T20:02:21.713Z sha 703470b :: found issues before merge. :: [P1] Report the wiki outcome on successful all-corpus reads
  • reviewed 2026-08-20T01:15:19.551Z sha 6d134ff :: found issues before merge. :: [P1] Preserve legacy metadata access on the not-found result | [P1] Make an empty success unambiguous before legacy normalization
  • reviewed 2026-08-20T01:41:10.505Z sha 6d134ff :: found issues before merge. :: [P1] Preserve legacy metadata access on the not-found result | [P1] Do not infer missing from a metadata-free empty success | [P2] Reconcile the external migration claim with SDK visibility
  • reviewed 2026-08-20T02:07:57.489Z sha 6d3fde4 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-20T02:23:24.315Z sha 990d0ba :: found issues before merge. :: [P1] Preserve statusless empty successes during migration
  • reviewed 2026-08-20T02:34:29.148Z sha 990d0ba :: found issues before merge. :: [P1] Preserve statusless empty successes during migration

@steipete
steipete force-pushed the steipete/funny-franklin-b6d9ba branch from 703470b to 6d134ff Compare August 20, 2026 01:06
@steipete steipete changed the title fix(memory): keep partial corpus failures visible fix(memory): distinguish missing file reads Aug 20, 2026
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Aug 20, 2026
@steipete
steipete force-pushed the steipete/funny-franklin-b6d9ba branch from 6d134ff to 6d3fde4 Compare August 20, 2026 02:01
@openclaw-barnacle openclaw-barnacle Bot added the scripts Repository scripts label Aug 20, 2026
@clawsweeper clawsweeper Bot added 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. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 20, 2026
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed 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 Aug 20, 2026
@clawsweeper clawsweeper Bot added 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. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 20, 2026
@steipete
steipete marked this pull request as ready for review August 20, 2026 02:58
@clawsweeper

clawsweeper Bot commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@steipete

Copy link
Copy Markdown
Contributor Author

Land-ready proof for f121f4365454a07b844f3c44297593c9ce99d0ac:

  • Focused memory read/compatibility suites passed; final legacy-policy matrix passed 26/26.
  • Exact-base clean-clone node scripts/check-changed.mjs passed SDK surface checks, core/extension/script typechecks, lint, dead-export scans, compatibility guards, and architecture/storage guards.
  • Authenticated isolated live turn with anthropic/claude-sonnet-4-6: memory_get returned status: "not_found" for memory/definitely-missing-live-proof.md; the model consumed it and replied STATUS=not_found (9 transcript events verified).
  • Fresh Codex autoreview: clean, no accepted/actionable findings; correctness 0.97.
  • Exact-head CI: green, run https://github.com/openclaw/openclaw/actions/runs/32326553381.
  • ClawSweeper reviewed this exact head with no findings. Its compatibility-policy finding was resolved by preserving every statusless registered-manager result as ok; only explicit not_found reports absence. Its exact-head proof rank-up move is satisfied by the evidence above and the updated PR body.
  • Production LOC: +121/-19 (net +102). Tests/support: +268/-65. Docs: +14.
  • Review artifacts validated with READY FOR /prepare-pr, zero findings.

No LanceDB path, schema/protocol version, lockfile, or changelog is changed. Issue #125978 remains open for the separately split corpus-outcome, source-status, and guidance repairs.

@steipete
steipete merged commit 35e0bc2 into main Aug 20, 2026
298 of 299 checks passed
@steipete
steipete deleted the steipete/funny-franklin-b6d9ba branch August 20, 2026 03:08
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

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 extensions: memory-core Extension: memory-core extensions: memory-wiki maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. scripts Repository scripts 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.

1 participant