Repository navigation
Description
Summary
Expose the authoritative previous note path from the accepted move transaction even when the old note version was never materialized to storage.
Regression context
Basic Memory Cloud issue basicmachines-co/basic-memory-cloud#1500 and PR basicmachines-co/basic-memory-cloud#1506 need to publish a canonical note.moved activity event with previousNotePath.
The accepted move runner already captures entity.file_path as existing_file_path inside the same transaction that loads and commits the move. However, the accepted result only exposes that path through cleanup_after_write, and cleanup_after_write is intentionally absent when the old object was never materialized.
Cloud cannot recover the missing path safely with a separate pre-read: another accepted move can land between that read and the core move transaction, causing activity to report a stale source path.
Ownership
This is a Basic Memory accepted-mutation contract gap, not a Cloud routing or persistence bug. The authoritative value exists in basic_memory.indexing.accepted_note_mutation_runner._run_accepted_note_move and must be carried out of that transaction.
Suggested fix
- Add an optional previous_file_path field to the accepted write/move result contract, preferably RuntimePendingNoteMaterialization or RuntimeAcceptedNoteChange.
- In _run_accepted_note_move, set it from the transaction-local existing_file_path regardless of whether previous_file_delete is planned.
- Preserve cleanup_after_write for storage deletion only; do not overload cleanup presence as move provenance.
- Propagate the field through response replacement and queue-neutral runtime helpers without changing non-move behavior.
- Add regressions for:
- materialized move: previous_file_path and cleanup are both present;
- never-materialized move: previous_file_path is present and cleanup is absent;
- update/create: previous_file_path remains absent.
Cloud follow-up
After the Basic Memory dependency is updated, Cloud PR #1506 should consume this accepted-result field, remove its separate pre-read, and keep committed cleanup metadata only as backward-compatible deployment handling if needed.
Activity
claude commentedon Jul 16, 2026
Claude finished @phernandez's task in 6m 5s —— View job
Implementation complete — push blocked by permissions
Todo list:
_run_accepted_note_moveand result contracts (RuntimePendingNoteMaterialization/RuntimeAcceptedNoteChange)previous_file_pathout of the transactionWhat changed
src/basic_memory/runtime/note_content.pyprevious_file_pathfield toRuntimePendingNoteMaterialization, threaded throughplan_pending_note_materialization,plan_accepted_note_materialization_change, andplan_accepted_note_write_change.RuntimeNoteMaterializationJobRequest/plan_note_materialization_job_request, so a job rebuilt from a persisted payload still carries it.src/basic_memory/indexing/accepted_note_mutation_runner.py_run_accepted_note_movenow setsprevious_file_path=existing_file_pathunconditionally (not derived fromcleanup_after_write), so the transaction-local previous path is always exposed on the accepted result — even when the old note was never materialized to storage.previous_file_pathstays absent for those operations.tests/runtime/test_pending_note_materialization.py,tests/runtime/test_accepted_note_response_planning.py,tests/indexing/test_accepted_note_mutation_runner.py, andtests/test_runtime.pycovering:previous_file_pathandcleanup_after_writeboth presentprevious_file_pathpresent,cleanup_after_writeabsentprevious_file_pathremains absentThis gives Cloud (basicmachines-co/basic-memory-cloud#1506) a safe way to read
accepted.materialization.previous_file_pathdirectly off the accepted move result instead of racing a separate pre-read.Blockers I hit
just fast-check,uv run ...,python3 -m pytest, and evenpip showall required approval that wasn't grantable in this session, so I could not runjust fast-check/just fast-test/just doctorto verify. Please re-run these locally or update--allowedToolsif you'd like me to verify directly.81dee7c) is made locally onclaude/issue-1072-20260716-0555, but pushing failed withPermission to basicmachines-co/basic-memory.git denied to github-actions[bot](403). This looks like a token/permission-scope issue with this workflow run rather than something in my control — the branch on GitHub does not yet have this commit. Someone with push access may need to either re-run with a token that has write access, or I can retry if permissions are adjusted.