Skip to content

fix: harden turn manifest storage and overlap#323

Open
compoodment wants to merge 2 commits into
xDarkicex:mainfrom
compoodment:fix/manifest-store-integrity
Open

fix: harden turn manifest storage and overlap#323
compoodment wants to merge 2 commits into
xDarkicex:mainfrom
compoodment:fix/manifest-store-integrity

Conversation

@compoodment

Copy link
Copy Markdown
Collaborator

Summary

  • Stores turn manifests under hashed session-id filenames and validates the embedded sessionId before trusting a file.
  • Defers manifest directory creation until save time and honors OPENCLAW_STATE_DIR before falling back to the default state root.
  • Replaces unordered content-hash overlap with ordered tail-prefix matching, while using message-id hashes to disambiguate single repeated-content turns.
  • Adds unit coverage for lazy directory creation, sanitizer-collision session IDs, session mismatch rejection, ordered overlap, rotated synthetic IDs, and single-turn repeated content.

Fixes #309.
Fixes #310.
Fixes #311.

Verification

  • pnpm exec tsc --noEmit — PASS
  • pnpm run clean:test && pnpm exec tsc -p tsconfig.tests.json && node --test .ts-build/test/unit/manifest.test.js && node --test --test-name-pattern="afterTurn is idempotent" .ts-build/test/unit/context-engine.test.js — PASS
  • pnpm check — FAILS after TypeScript/plugin inspector, in existing unrelated context-engine/memory-provider/slot-conflict unit tests.
  • npm run test:integration — FAILS in existing unrelated checklist/host-flow expectation tests; manifest-targeted and markdown/dream integration coverage passes.

Stack note: this branch includes #318 so test compilation is unblocked before this focused manifest change.

– Vale

@coderabbitai

coderabbitai Bot commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@compoodment, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 1 hour. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 77677346-dd8c-4368-b555-198913f711c3

📥 Commits

Reviewing files that changed from the base of the PR and between 6d47279 and a22d6ee.

📒 Files selected for processing (3)
  • src/manifest.ts
  • test/integration/markdown-ingest.test.ts
  • test/unit/manifest.test.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@compoodment
compoodment marked this pull request as ready for review June 5, 2026 20:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant