Skip to content

fix(memory): avoid false annotation indexing failures under load - #150260

Merged
steipete merged 1 commit into
mainfrom
upd/flake-memory-index-wallclock
Sep 16, 2026
Merged

steipete merged 1 commit into
mainfrom
upd/flake-memory-index-wallclock

Conversation

@steipete

Copy link
Copy Markdown
Contributor

Related: #150236, #138995.

What Problem This Solves

Fixes a memory indexing CI flake where worker startup, SQLite work, and host contention exceeded a three-second integration-test budget.

User Impact

No user-visible behavior change. Memory indexing retains the existing metadata and search behavior, and CI checks parser backtracking at the parser owner.

Why This Change Was Made

The protected invariant is that incomplete and mixed annotations preserve metadata without pathological parser backtracking. The 417-character witness from #138995 belongs in the pure curated-annotation parser test. Its two-second bound measures only parsing; the integration test retains every metadata, provider-mode, and search assertion. Long unfinished-carrier semantic coverage also remains.

This is a maintainer-requested repair of the failure observed while validating #150236. Production code is unchanged; the diff is test-only (+22 / -5).

Evidence

Initial isolated suffix/recall comparison on the same 417-character witness:

Implementation Elapsed CPU Scheduled callbacks
Historical suffix regex 43,958.548 ms 30,436.590 ms 0
Current recall scanner 0.084 ms 0.083 ms 0

This comparison measured suffix/recall processing alone. The committed regression calls the public parser with project-scope extraction enabled. Timer advances and provider-call counts cannot detect backtracking inside one regex execution.

  • Complete files: 87 tests passed (17 parser + 70 indexing).
  • Focused repetition: 20/20 complete, 60 affected-case executions passed (parser witness plus keyword-only and semantic indexing). The twelve completed original runs and eight resumed runs use the same unchanged patch. The run intentionally interrupted during the environment stop was excluded and replaced.
node scripts/run-vitest.mjs packages/memory-host-sdk/src/host/curated-annotations.test.ts extensions/memory-core/src/memory/index.test.ts -t 'parses incomplete recall annotations|preserves incomplete and mixed annotations'
  • Fresh Codex branch review against origin/main, maximum priority P1: scoped-clean, no accepted/actionable findings.
  • check:changed: 22 stages passed, including both test typechecks and core lint. Extension lint could not start because the nested-worktree declaration guard detected an ancestor node_modules input. The maintainer approved the direct lint substitute below; hosted CI's extension lint remains authoritative.
  • git diff --check passed.

Direct extension lint substitute, using the extension test config:

node_modules/.bin/oxlint --tsconfig test/tsconfig/tsconfig.extensions.test.json extensions/memory-core/src/memory/index.test.ts

Canary output after temporarily appending a deliberate debugger statement:

extensions/memory-core/src/memory/index.test.ts:2782:1: error eslint(no-debugger): `debugger` statement is not allowed help: Remove the debugger statement
Exit code: 1

The file was restored byte-for-byte; the same command then produced no findings and exited 0. No lint guard, dependency, or ancestor installation was modified.

Follow-up outside this PR: the two one-second writer-contention bounds in extensions/memory-core/src/memory/manager.borrowed-connection.test.ts (original lines 286 and 585) protect a different invariant and remain unchanged.

Keep incomplete and mixed annotation indexing coverage while timing the historical backtracking witness at the parser owner. Related: #150236, #138995.
@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.

@steipete
steipete marked this pull request as ready for review September 16, 2026 19:37
@openclaw-barnacle openclaw-barnacle Bot added extensions: memory-core Extension: memory-core size: XS maintainer Maintainer-authored PR labels Sep 16, 2026
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. 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 PM ET / 19:43 UTC.

ClawSweeper review

What this changes

Moves memory annotation timing coverage from full indexing to the parser while preserving metadata, search, provider-mode, and unfinished-input assertions.

Merge readiness

✅ Ready for maintainer review

Keep open: this remains a useful, focused repair for false test failures on current main. The regression still detects historical parser backtracking, integration assertions remain intact, and no actionable patch defect was found.

Priority: P3
Reviewed head: 3f00dd0513d19a5e615e25139f9fdd74d8654064

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused test repair with preserved integration coverage and useful reported mutation validation.
Proof confidence 🌊 off-meta tidepool Not applicable: The supplied repository context identifies a maintainer-authored repair with no production change, so the external-contributor runtime gate does not apply. Parser mutation results and repeated indexing tests directly support the changed test contract; this review did not execute tests.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The supplied repository context identifies a maintainer-authored repair with no production change, so the external-contributor runtime gate does not apply. Parser mutation results and repeated indexing tests directly support the changed test contract; this review did not execute tests.
Evidence reviewed 8 items Verified introduced scope: The pinned merge-base comparison changes only the two test files. The verified test-merge comparison against its main parent has the same scope; production, dependencies, workflows, and public APIs are unchanged.
Integration contract preserved: The complete affected case still indexes mixed and incomplete annotations in keyword-only and semantic modes, checks four metadata rows, verifies search results, and checks whether embeddings were invoked. Only the whole-sync stopwatch assertion is removed.
Regression exercises the production parser: The new case calls the existing public parser with curated recall and project extraction enabled, asserts completion below two seconds, and checks neutral recall metadata with invalid project scope. Index preparation calls this same parser for source spans; no test-only production seam is introduced.
Findings None None.
Security None None.

How this fits together

Memory Core indexes workspace notes for search and automatic recall. Its shared annotation parser extracts trigger phrases, importance, and project scope before indexing publishes searchable entries.

flowchart LR
  A[Workspace notes] --> B[Memory indexing]
  B --> C[Shared annotation parser]
  C --> D[Recall and project metadata]
  D --> E[Searchable memory index]
  F[Backtracking regression input] --> C
  C --> G[Parser timing and metadata checks]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Tests +17. Total +17 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 2 22 5 +17
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 22 5 +17

Review metrics

None.

Technical review

Best possible solution:

Keep performance regression detection at the shared parser and retain integration checks for indexed metadata, search, and provider behavior.

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

No deterministic reproduction of host contention was established in this read-only review; the captured hosted failure and retained whole-sync timing assertion support the reported flake.

Is this the best way to solve the issue?

Yes. Timing the historical witness through the actual parser separates backtracking detection from worker and SQLite delays, while the reported mutation failure demonstrates that the replacement assertion remains meaningful.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 387da5edaa9d.

Labels

Label changes:

  • add P3: This is a bounded test reliability improvement with no production behavior change.
  • 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: The supplied repository context identifies a maintainer-authored repair with no production change, so the external-contributor runtime gate does not apply. Parser mutation results and repeated indexing tests directly support the changed test contract; this review did not execute tests.

Label justifications:

  • P3: This is a bounded test reliability improvement with no production behavior change.
  • 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: The supplied repository context identifies a maintainer-authored repair with no production change, so the external-contributor runtime gate does not apply. Parser mutation results and repeated indexing tests directly support the changed test contract; this review did not execute tests.

Evidence

What I checked:

  • Verified introduced scope: The pinned merge-base comparison changes only the two test files. The verified test-merge comparison against its main parent has the same scope; production, dependencies, workflows, and public APIs are unchanged. (3f00dd0513d1)
  • Integration contract preserved: The complete affected case still indexes mixed and incomplete annotations in keyword-only and semantic modes, checks four metadata rows, verifies search results, and checks whether embeddings were invoked. Only the whole-sync stopwatch assertion is removed. (extensions/memory-core/src/memory/index.test.ts:261, 3f00dd0513d1)
  • Regression exercises the production parser: The new case calls the existing public parser with curated recall and project extraction enabled, asserts completion below two seconds, and checks neutral recall metadata with invalid project scope. Index preparation calls this same parser for source spans; no test-only production seam is introduced. (packages/memory-host-sdk/src/host/curated-annotations.test.ts:74, 3f00dd0513d1)
  • Captured validation and mutation evidence: The supplied full PR body reports a hosted whole-sync failure at 3,172.143 ms, a historical-regex mutation failure at 37,611.468 ms against the new 2,000 ms bound, 87 passing tests, and 60 passing affected-case executions across 20 completed runs. These are contributor-recorded results, not tests executed by this review. The linked hosted job independently reports failure. Captured context sourceRevision: eb8ba229242daee1669a75cb36069a5020de216d240385d3af07775e6d4c7452. (3f00dd0513d1)
  • Still necessary on main and latest release: Fetched main retains the one-second unfinished-carrier assertion and lacks the new isolated recall-parser witness. The latest supplied release, v2026.9.4, has the same parser-test blob as main. The earlier merged parser repair therefore does not supersede this test reliability change. (packages/memory-host-sdk/src/host/curated-annotations.test.ts:58, 387da5edaa9d)
  • Release tree verification: The v2026.9.4 parser test resolves to blob 31a3423a560a067abe8adae3648be763a89b7864, the unchanged main-side parser test in the reviewed diff. (packages/memory-host-sdk/src/host/curated-annotations.test.ts, 3a9d69db306c)

Likely related people:

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

@steipete
steipete merged commit fa53cf6 into main Sep 16, 2026
221 checks passed
@steipete
steipete deleted the upd/flake-memory-index-wallclock branch September 16, 2026 20:09
@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
…150260)

Keep incomplete and mixed annotation indexing coverage while timing the historical backtracking witness at the parser owner. Related: openclaw#150236, openclaw#138995.
roboclaw-bot pushed a commit that referenced this pull request Sep 17, 2026
Backport the exact test-only parser timing repair from #150260. Preserve the original malformed-annotation witness and both complete manager integration cases without maintaining a separate preparation test.

(cherry picked from commit fa53cf6)

Co-authored-by: steipete <[email protected]>
Co-authored-by: vincentkoc <[email protected]>
Co-authored-by: RomneyDa <[email protected]>
RomneyDa added a commit that referenced this pull request Sep 17, 2026
Backport the exact test-only parser timing repair from #150260. Preserve the original malformed-annotation witness and both complete manager integration cases without maintaining a separate preparation test.

(cherry picked from commit fa53cf6)

Co-authored-by: Peter Steinberger <[email protected]>
Co-authored-by: steipete <[email protected]>
Co-authored-by: vincentkoc <[email protected]>
Co-authored-by: RomneyDa <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extensions: memory-core Extension: memory-core maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XS 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