[Bug]: Event-memory extraction fails when a new page_id has no resolved URI
Bug Description
Session memory extraction can fail after a successful archive commit when an events operation refers to a new page id that never resolves to a URI.
The archive is written successfully, but the asynchronous extraction task fails during apply, so the session cannot produce a memory_diff.
Steps to Reproduce
- Use OpenViking v0.4.9 with memory extraction enabled.
- Ensure the user's
viking://user/<user>/memories/eventscollection exists but has no child event pages. - Replay or commit a historical coding-agent session that causes the extractor to propose an event-memory operation.
- Wait for the phase-2 extraction task to complete.
Expected Behavior
A newly proposed event should receive a resolvable URI and be created, or an invalid operation should be isolated with a structured diagnostic. A single unresolved event target should not make a successfully archived session unrecoverably fail its whole extraction pass.
Actual Behavior
The archive commit succeeds, then the extraction task fails during memory apply with:
Cannot apply operations: missing resolved URIs for events(page_id=102)
The server source raises this from openviking/session/memory/memory_updater.py while validating resolved operation URIs.
Environment
- OS: macOS
- OpenViking: v0.4.9
- Workflow: official
openviking-server ingest backfillreplaying a Claude Code JSONL session - Server: remote/shared OpenViking Server
Additional Context
The failure was reproduced from the official ingestion path, not a custom writer. The source transcript was archived and is still readable; only asynchronous memory extraction failed.
This matters for historical-session backfill because the failed session is already durably committed, so retry behavior needs to be safe and observable. A useful fix would include a regression test for an empty events collection plus a newly generated event page id.
I reproduced this on current main. The failure is in the batch-level URI guard: one event with no resolved target raises before any resolved operations are applied. I’m working on a focused fix that records an error for that operation and lets the rest of the batch proceed, with a regression test covering a valid event alongside an unresolved new page_id.