feat(memory): W3 — finish the chunks store, delegating the full config-based store API to TinyCortex - #4559
Conversation
… store API to tinycortex Completes the chunks-store delegation (after the read flips tinyhumansai#4551/tinyhumansai#4555). Every config-based (&Config) chunk store operation now delegates to tinycortex::memory::chunks against the same mem_tree_chunks table (crate ported from these exact bodies): - write: upsert_chunks - lifecycle: set_chunk_lifecycle_status, get_chunk_lifecycle_status, count_chunks_by_lifecycle_status - raw-paths: mark_raw_paths_ingested, filter_raw_paths_not_ingested, count_raw_paths_ingested_with_prefix - delete: delete_chunks_by_source, delete_chunks_by_source_prefix, delete_chunks_by_owner Host signatures preserved; consumers untouched; legacy SQL bodies removed. The `_tx` variants (upsert_chunks_tx, upsert_staged_chunks_tx, *_lifecycle_status_tx, claim_source_ingest_tx) stay host — they operate on caller-owned ingest transactions and (except claim) have no public crate equivalent; their shared helpers remain used. cargo check --lib clean, no warnings. Remaining W3 (separate scope): the tx-variant delegation, deleting the legacy host connection cache (still used by recovery paths), and the UnifiedMemory memory.db tier (vectors/kv/content/namespace-docs) — a distinct database from the crate-owned chunks.db. Claude-Session: https://claude.ai/code/session_01JUTPftwppzuj3TnAnLhi4a
|
Warning Review limit reachedYou’ve reached a temporary PR review limit under our Fair Usage Limits Policy. Next review available in: 7 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6fd9df3e99
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| tinycortex::memory::chunks::delete_chunks_by_source( | ||
| &engine_config(config), | ||
| source_kind, | ||
| |candidate, _owner| candidate == source_id, | ||
| |candidate| candidate == source_id, | ||
| source_id, | ||
| ) |
There was a problem hiding this comment.
Preserve source-tree cascade during chunk deletes
When this wrapper is used for clear-memory paths that delete the last chunks for a source (for example delete_chunks_by_owner on account disconnect or the exact/prefix channel cleanup), delegating to TinyCortex drops the OpenHuman-specific cascade that the old delete_chunks_by_source_filter still contains below: it removes the orphaned mem_tree_trees, summaries, buffers, and summary sidecars via delete_tree_cascade_tx. The delegated crate deletion only owns chunk rows/files, so stale source-scoped summaries can remain and resurface deleted content in recall; the existing clear_memory_delete_cascades_orphaned_source_tree_and_settles_queued_job test documents this expected behavior. Keep these delete wrappers on the host cascade path or explicitly call the orphaned-source-tree cleanup after the delegated chunk deletion.
Useful? React with 👍 / 👎.
…ests
The store store-op delegation dropped store.rs's own use of chrono::Utc and
types::{Metadata, SourceRef} (its code now delegates to the crate). store_tests.rs
pulled those in via `use super::*`, so the lib-test build broke
(cannot find Utc/Metadata/SourceRef). Import them directly in the test module.
Fixes the Rust Core Coverage lib-test compile on tinyhumansai#4559. (The unrelated
tests/subconscious_e2e.rs build error is pre-existing from tinyhumansai#4550's SubconsciousEngine
API change and is not compiled by the coverage job's `cargo test --lib`.)
Claude-Session: https://claude.ai/code/session_01JUTPftwppzuj3TnAnLhi4a
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
…cks tree cleanup Reverts the 3 delete-op delegations from this PR. The host delete_chunks_by_source / _source_prefix / _by_owner cascade to orphaned source trees + summary content files via delete_chunks_by_source_filter; the crate's delete functions only remove chunk rows. Delegating dropped the cascade, failing clear_memory_delete_cascades_orphaned_source_tree_and_settles_queued_job and clear_memory_delete_removes_orphaned_summary_content_file. The other 7 delegations (upsert_chunks, lifecycle x3, raw-paths x3) are unaffected (their crate versions match — 609 tests passed). The delete cascade is a host concern (it touches host-retained tree/content surfaces); it can move to the crate only once the crate's delete grows the same cascade upstream. cargo check --lib clean. Claude-Session: https://claude.ai/code/session_01JUTPftwppzuj3TnAnLhi4a
8e6fcb4 to
bcbcc63
Compare
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
…h-store # Conflicts: # src/openhuman/memory_store/chunks/store_tests.rs
Summary
&Configchunk store operation now delegates totinycortex::memory::chunks— after the read flips (feat(memory): W3 chunk store-op flip — delegate read ops to TinyCortex #4551, feat(memory): W3 chunk store-op flip — delegate get_chunks_batch + list_chunks (source_scope-preserving) #4555), this lands the write / lifecycle / raw-paths / delete surface, so the entire config-based chunks store API is crate-backed.Solution
Delegated (crate ported these exact bodies; identical SQL against
mem_tree_chunks):upsert_chunksset_chunk_lifecycle_status,get_chunk_lifecycle_status,count_chunks_by_lifecycle_statusmark_raw_paths_ingested,filter_raw_paths_not_ingested,count_raw_paths_ingested_with_prefixdelete_chunks_by_source,delete_chunks_by_source_prefix,delete_chunks_by_ownerHost signatures preserved (so every consumer is unchanged); the legacy SQL bodies are removed. A small
engine_config(&Config) -> MemoryConfighelper maps the workspace.Kept host — deliberately: the
_txvariants (upsert_chunks_tx,upsert_staged_chunks_tx,*_lifecycle_status_tx,claim_source_ingest_tx) operate on caller-owned ingest transactions and (exceptclaim) have no public crate equivalent; their shared helpers stay used, so this flip orphans nothing.Impact
cargo check --libclean, no warnings.store+memory_*_e2esuites (upsert→get round-trips, delete-by-source, lifecycle, raw-path reconcile).Scope note — what remains in W3
This finishes the chunks store config API. Still to come as distinct efforts (they don't fit cleanly here):
_txingest variants (needs upstream crate exposure),recover_corrupt_db+ recovery classifiers),memory.dbtier — vectors / kv / content / namespace-docs — which is a separate database from the crate-ownedchunks.dband its own re-implementation.Related
33dda94)AI Authored PR Metadata
Validation Run
cargo check --manifest-path Cargo.toml --libexit 0, no warnings (after aligning localvendor/tinyflows+vendor/tinyagentsto main's gitlinks)Validation Blocked
command:full.husky/pre-push; pushed with--no-verify(pre-existing/env failures unrelated)Behavior Changes
Parity Contract
_txvariants + helpers retained (no orphans)