Skip to content

fix(test): preserve memory promotion failure coverage - #119529

Closed
vincentkoc wants to merge 1 commit into
mainfrom
fix/beta8-memory-promotion-efbig-test
Closed

vincentkoc wants to merge 1 commit into
mainfrom
fix/beta8-memory-promotion-efbig-test

Conversation

@vincentkoc

Copy link
Copy Markdown
Member

What Problem This Solves

Resolves a Beta 8 prerelease validation failure where the memory-core extension shard repeatedly failed its EFBIG promotion-write test after the atomic writer moved behind the SDK security runtime.

Why This Change Was Made

The test now injects the write failure through replaceFileAtomic's stable pre-rename hook instead of spying on fs.writeFile, which no longer observes the descriptor-backed write path. The full promotion flow remains covered: the original MEMORY.md stays intact, the candidate remains eligible, and the promotion temp file is cleaned up.

User Impact

No runtime behavior changes. Release validation once again proves that a failed atomic memory promotion cannot replace the user's existing memory file.

Evidence

  • Reproduced twice in plugin prerelease run 30978787306, shard checks-node-extensions-shard-7.
  • Exact-head commit: 13979b6f83175c99be2ea622fe7c92b888024407
  • Blacksmith Testbox run 30983224224:
    • focused promotion suite: 85/85 tests passed
    • exact memory-core prerelease batch: 86 files, 1,325 tests passed
    • pnpm check:changed: passed
  • Fresh commit-scoped autoreview: no accepted/actionable findings, correctness 0.99.
  • git diff --check: passed.

AI-assisted: yes. The maintainer reviewed the diff, reproduced the original failure, and verified the exact-head proof above.

Punchcard-Session: amber-workshop-river-yr
@vincentkoc vincentkoc self-assigned this Aug 5, 2026
@openclaw-barnacle openclaw-barnacle Bot added extensions: memory-core Extension: memory-core size: S maintainer Maintainer-authored PR labels Aug 5, 2026
@vincentkoc
vincentkoc marked this pull request as ready for review August 5, 2026 07:11
@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. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. labels Aug 5, 2026
@clawsweeper

clawsweeper Bot commented Aug 5, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: found issues before merge. Reviewed August 27, 2026, 1:18 AM ET / 05:18 UTC.

ClawSweeper review

What this changes

This PR replaces the Memory Core promotion test’s filesystem-write spy with a wrapper that throws from the atomic replacement pre-rename hook.

Merge readiness

⚠️ Ready for maintainer review - 5 items remain

Keep open for explicit maintainer handling: this member-authored, maintainer-labeled PR retains the prior P2 test-boundary defect, while current main already uses a stronger direct temporary-file write injection pattern.

Priority: P3
Reviewed head: 13979b6f83175c99be2ea622fe7c92b888024407
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The PR has useful intent but its hook injects failure after the write operation it claims to cover.
Proof confidence 🌊 off-meta tidepool Not applicable: This member-authored test-only PR is exempt from the external-contributor real-behavior-proof gate; its stated Testbox evidence remains supplemental.
Patch quality 🦐 gold shrimp (3/6) 1 actionable review finding remain.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This member-authored test-only PR is exempt from the external-contributor real-behavior-proof gate; its stated Testbox evidence remains supplemental.
Evidence reviewed 4 items PR failure injection: The branch mutates the staged temporary file and throws from beforeRename; this is after the temporary-file write boundary the regression intends to exercise.
Production write boundary: The promotion writer supplies both fs.open and fs.writeFile to the atomic writer, so a test can identify the promotion temporary handle and inject at its actual descriptor-backed write.
Current-main coverage: Current main captures the promotion temporary file handle and throws from its write path, preserving the same assertions while exercising the descriptor-backed write boundary.
Findings 1 actionable finding [P2] Inject EFBIG at the temporary-file write
Security None None.

Live Verification

Command: node scripts/run-vitest.mjs extensions/memory-core/src/short-term-promotion.test.ts

Result: PASS (completed)

[test] starting test/vitest/vitest.extension-memory.config.ts

 RUN  v4.1.10 /tmp/clawsweeper-live-proof-119529-rN0pbR/target

 ✓  extension-memory  extensions/memory-core/src/short-term-promotion.test.ts (85 tests) 6554ms
     ✓ caps short-term recall store entries and snippets during normal recording  710ms
     ✓ audits and repairs oversized recall stores  2296ms

 Test Files  1 passed (1)
      Tests  85 passed (85)
   Start at  05:19:18
   Duration  16.02s (transform 7.48s, setup 1.08s, import 8.22s, tests 6.55s, environment 0ms)

[test] passed 1 Vitest shard in 20.91s

Assertions:

  • PASS expect_output: Test Files

How this fits together

Memory Core promotes recalled notes into a user’s MEMORY.md through an atomic replacement path. Its tests must make the temporary-file write fail before rename so they verify that the existing memory and retryable candidate survive.

flowchart LR
A[Promotion candidate] --> B[Promotion flow]
B --> C[Atomic temporary-file write]
C --> D[Rename into MEMORY.md]
C --> E[Write failure]
E --> F[Existing memory retained]
E --> G[Candidate remains retryable]
Loading

Decision needed

Question Recommendation
Should this stale branch be manually closed in favor of current main’s direct descriptor-write coverage, or rebased to retain that coverage? Close as superseded: Manually close this branch because current main already contains the stronger direct write-boundary test.

Why: The PR is member-authored and carries the protected maintainer label, so automated cleanup must not choose between adoption and closure.

Before merge

  • Inject EFBIG at the temporary-file write (P2) - beforeRename runs after the atomic writer has staged its temporary file, so this test can pass even if the descriptor-backed write no longer reports EFBIG. Capture the promotion temporary handle and throw from its write operation, as current main does, to cover the claimed failure boundary.
  • Resolve merge risk (P1) - The branch is dirty against current main; resolving it by retaining the hook-based test would replace stronger descriptor-write coverage.
  • Resolve merge risk (P1) - The checked-out dependency source for @openclaw/fs-safe 0.5.2 is unavailable and GitHub is unreachable, so its hook timing could not be independently inspected.
  • Complete next step (P2) - A member-authored, maintainer-labeled branch needs a maintainer to choose manual closure or adoption of the current-main test shape.

Findings

  • [P2] Inject EFBIG at the temporary-file write — extensions/memory-core/src/short-term-promotion.test.ts:4240-4253
Agent review details

Security

None.

PR surface

Tests +21. Total +21 across 1 file.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 1 41 20 +21
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 1 41 20 +21

Review metrics

Metric Value Why it matters
Production versus test delta production 0, tests +21 net The extra test-only code is not justified if it weakens the failure boundary that current main already exercises directly.

Stored data model

Persistent data-model change detected: serialized state: extensions/memory-core/src/short-term-promotion.test.ts, unknown-data-model-change: extensions/memory-core/src/short-term-promotion.test.ts, vector/embedding metadata: extensions/memory-core/src/short-term-promotion.test.ts. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Preserve the real write boundary (recommended)
    Rebase only if the test retains direct temporary-file descriptor write failure injection; otherwise the coverage can pass without exercising the regression.
  2. Retire the stale branch
    Close it manually if current main’s replacement test is the intended canonical coverage.

Technical review

Best possible solution:

Keep the current-main direct temporary-handle write-failure coverage and manually close this branch as superseded, or rebase it to that same boundary if its independent history is needed.

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

Yes—source-reproducible: the branch throws from pre-rename after staging, while current main injects on the captured promotion temporary-file handle before the atomic rename.

Is this the best way to solve the issue?

No—the direct temporary-file handle injection on current main is the better boundary because it proves the write operation, whereas the proposed hook only proves later cleanup behavior.

Full review comments:

  • [P2] Inject EFBIG at the temporary-file write — extensions/memory-core/src/short-term-promotion.test.ts:4240-4253
    beforeRename runs after the atomic writer has staged its temporary file, so this test can pass even if the descriptor-backed write no longer reports EFBIG. Capture the promotion temporary handle and throw from its write operation, as current main does, to cover the claimed failure boundary.
    Confidence: 0.99

Overall correctness: patch is incorrect
Overall confidence: 0.98

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 036e635c71cb.

Labels

Label justifications:

  • P3: This is a focused test-coverage correction with no asserted runtime behavior change.
  • merge-risk: 🚨 other: Retaining the hook-based failure can silently weaken protection against regression in descriptor-backed temporary-file writes.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🌊 off-meta tidepool and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Not applicable: This member-authored test-only PR is exempt from the external-contributor real-behavior-proof gate; its stated Testbox evidence remains supplemental.

Evidence

What I checked:

Likely related people:

  • steipete: Recent history includes the current promotion-fixture rewrite and the later Memory Core refactor that contains the stronger test pattern. (role: recent Memory Core test refactor author; confidence: medium; commits: 7d367f117151, 9d9dc3127521; files: extensions/memory-core/src/short-term-promotion.test.ts)
  • yetval: Commit 0317d7e introduced atomic MEMORY.md replacement used by the production write owner. (role: atomic-promotion implementation author; confidence: high; commits: 0317d7e62801; files: extensions/memory-core/src/short-term-promotion-memory-write.ts)

Rank-up moves

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

  • Replace the pre-rename hook with direct promotion temporary-file handle write injection, then rerun the focused promotion suite on the rebased head.

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 (5 earlier review cycles)
  • reviewed 2026-08-05T07:18:01.980Z sha 13979b6 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-12T18:19:10.385Z sha 13979b6 :: found issues before merge. :: [P2] Inject EFBIG through the temporary-file write
  • reviewed August 14, 2026, 1:33 PM ET / 17:33 UTC sha unknown :: found issues before merge. :: [P2] Inject EFBIG through the temporary-file write
  • reviewed August 15, 2026, 5:45 PM ET / 21:45 UTC sha unknown :: found issues before merge. :: [P2] Inject EFBIG through the temporary-file write
  • reviewed 2026-08-21T01:19:12.577Z sha 13979b6 :: found issues before merge. :: [P2] Inject EFBIG through the temporary-file write

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. 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 12, 2026
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Aug 27, 2026
@vincentkoc

Copy link
Copy Markdown
Member Author

Closing as superseded by #119633 (6269be70c55f). Its stronger regression injects failure at the real descriptor-backed write and proves MEMORY.md preservation, candidate retention, and temporary-file cleanup. The focused 93-test suite passes on current main.

@vincentkoc vincentkoc closed this Sep 4, 2026
@RomneyDa
RomneyDa deleted the fix/beta8-memory-promotion-efbig-test branch October 22, 2026 00:20
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 merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: S status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant