fix(store-runtime): guard retained memory by served store identity - #1192
Conversation
…plan-reopened' into fix/retained-memory-identity-guards
|
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8b5c535d11
ℹ️ 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".
| #[cfg(test)] | ||
| pub async fn publish_read_only_memory_owner_for_test( |
There was a problem hiding this comment.
Remove the test-only registry publication port
This adds a #[cfg(test)] method directly to the production registry that fabricates a detached, read-only memory-owner state which no production lifecycle publishes. Consequently, same_project_record_retrieval_degrades_when_owner_is_not_writable can pass without proving that the fallback works through a real user journey; exercise a reachable production owner transition instead, or remove the unreachable fallback and this synthetic publication seam.
AGENTS.md reference: AGENTS.md:L121-L123
Useful? React with 👍 / 👎.
Performance Comparison
|
4e1d27b
into
codex/tracedecay-total-redesign-plan-reopened
Fixes defects introduced by #1179 (
extract retained owners from the root crate), found in independent review.test+fix(store-runtime): guard retained memory by served store identity— the move turned two live guards into self-comparisons:authority.project_rootwas compared against itself andFactOwnerV1was fabricated from the request scope instead of read from the store. The open guard now compares the served instance'sproject_rootandstore_layout.identity.project_idagainst the admitted request scope (plus the restored mounted-scope vs request-scope check), denying withNotFoundOrNotAuthorized; the owner stamped on facts is store-derived. RED→GREEN:..._denies_when_store_layout_identity_disagrees,..._served_root_disagrees,..._mounted_scope_disagrees.fix(store-runtime): honor read access with read-only leases—Read(get/list/contradict/status and probe/related/reason, which never recorded retrieval) takesissue_database_read_only_lease();RecordRetrieval(search) takes a write lease on a writable graph sotrack_explicit_search/project_memory_update_retrieval_projection_txkeep updatingretrieval_count/last_retrieved_at(perdocs/TRUST-DECAY-SEMANTICS.md, doc corrected to name the function), and degrades to a read-only lease with truthfulReadOnlytelemetry when the graph or owner is not writable instead of failingUnavailable;Writeon a read-only graph is a typed refusal. Tests:memory_recall_updates_retrieval_count(bump + funnel),..._read_open_issues_a_read_only_lease,..._degrades_when_owner_is_not_writable.refactor(daemon): drop retained owner facade— thepub(crate) usefaçade over session-runtime is gone; six call sites import the owner crate directly.AssembledRetainedAutomationstays: it mustcg.read().awaitper call, which a mount-time value cannot express.fix(daemon): resolve retained memory identity per call— the port no longer snapshots identity at mount (which would go stale across branch reopen) nortry_reads the lock at mount (which fails under a queued writer and would leave memory permanently "not mounted"); each call takes a real read lock (no nested guard — the mount site no longer locks) and builds authority from the currentArc<TraceDecay>.assembled_memory_authority_tracks_swapped_graph_identityproves it.project_memory_read_onlyis byte-identical to the base — a review caught an intermediate version publishing a read-only owner into the registry, which would have let a cross-project read of X make X's own memory non-writable;read_only_open_does_not_publish_a_project_memory_ownerguards that, and the degrade test uses a#[cfg(test)]seam.Verification:
retained_memory10;session_registry97; rootdaemon::retained_owner8;session_suite(test-transport) 462; MCPlcm_test/session_search_test/memory_facts_test/status_without_retained48; clippy-D warnings --testson store-runtime/session-runtime/root after merging #707; fmt; commitlint. Four independent Opus review rounds.