powermem icon indicating copy to clipboard operation
powermem copied to clipboard

bug: Jupyter tutorials still use obsolete Memory fields after Atomic Memory migration

Open hireview001 opened this issue 1 month ago • 1 comments

Describe the bug

The Jupyter tutorials still access Memory response fields from before the Atomic Memory migration. Four model-free introductory lessons fail when executed unchanged against the current Server and Python client:

  • MemoryMutationResponse.entry no longer exists; the response has changed and records.
  • AtomicMemorySearchHit.text no longer exists; the record is nested under hit.memory.
  • AtomicMemoryRecord.citation no longer exists; the current record exposes artifact and state/version fields.

The Chinese README directs new users to these tutorials and states that the first seven require no model or API key. The failures prevent completing the documented introductory memory, scope, and prepared-context workflows.

Reconfirmed on the original regression commit bcdac7322aa2cfadb10c3da3ac1c353ca91ffbef and upstream master at 40bd8481809dedd2ad34c877496dbe89f679c6f6 on October 16, 2026.

Steps to reproduce

From a clean checkout, without configuring any model provider:

uv sync --locked --group notebooks
uv run --locked --group notebooks python examples/jupyter/run.py \
  --only 01 02 03 04 \
  --output-dir /tmp/pc-notebook-contract-repro

The official runner launches a fresh Python kernel for each notebook. Each tutorial starts its own actual loopback HTTP Server with a fresh file-backed SQLite database. The executed notebooks, HTML output, and summary.json retain the failed cell output. The notebook source files were not edited.

Equivalent project target:

make notebooks-test ARGS='--only 01 02 03 04 --output-dir /tmp/pc-notebook-contract-repro'

Expected behavior

The unmodified introductory tutorials should complete against the current checked-in Atomic Memory contract. Examples and assertions should use the current mutation records, nested search hits, exact Artifact references, and state/version semantics throughout each lesson.

Updating only the first failing attribute would leave later legacy assumptions in place; the complete memory lifecycle, restart/readback, scope-isolation, and prepared-context workflows should be executed after the examples are aligned.

Actual behavior

Both tested commits produced 0 passed, 4 failed, 0 not_run and a nonzero runner exit status:

Notebook Failing cell index (zero-based, including Markdown cells) First exception
01_memory_across_sessions.ipynb 6 AttributeError: 'MemoryMutationResponse' object has no attribute 'entry'
02_memory_lifecycle.ipynb 5 AttributeError: 'MemoryMutationResponse' object has no attribute 'entry'
03_scopes.ipynb 9 AttributeError: 'AtomicMemorySearchHit' object has no attribute 'text'
04_prepared_context.ipynb 13 AttributeError: 'AtomicMemoryRecord' object has no attribute 'citation'

For example, lesson 01 successfully calls client.remember_memory(...) and then fails here:

assert saved.entry is not None
citation = saved.entry.citation

Lesson 03 successfully creates and searches memories in both scopes, then fails while formatting hit.text. Lesson 04 reaches context preparation and fails in its final comparison of [entry.citation for entry in after.entries].

The current contract instead defines:

MemoryMutationResponse:
  changed: bool
  records: list[AtomicMemoryRecord]

AtomicMemoryRecord:
  artifact, kind, text, state, state_version, merged_into_id

AtomicMemorySearchHit:
  memory: AtomicMemoryRecord
  score, matched_by

Relevant current source:

Environment

  • PowerContext baseline: 1.3.1.dev61+gbcdac7322 / bcdac7322aa2cfadb10c3da3ac1c353ca91ffbef.
  • Also executed the original tutorials and runtime from an isolated checkout of upstream 40bd8481809dedd2ad34c877496dbe89f679c6f6, with its src on PYTHONPATH for the fresh kernels. The four notebooks, _tutorial.py, pyproject.toml, and uv.lock are byte-identical between these commits.
  • Linux x86_64; Python 3.12.14; SQLite 3.53.1; Pydantic 2.13.4; FastAPI 0.139.2; HTTPX 0.28.1.
  • Actual local HTTP servers, file-backed databases, and independent Python kernels; no mocked responses or LLM calls. This reproduction is limited to lessons 01–04 and does not claim that every notebook fails.

hireview001 avatar Oct 16 '26 08:10 hireview001

please assign it for me

chenncy avatar Oct 16 '26 08:10 chenncy