feat(viking): defer viking_remember to turn-boundary capture with memory-diff steer - #355
Merged
Conversation
…ory-diff steer viking_remember() becomes a zero-argument deferred capture: the tool only queues the optional reason, and the next before_model_request drains the real conversation (shared cursor with auto_ingest, disjoint ranges) into a remember-* session with <memory-intent> markers. Commit is synchronous (HTTP round-trip only); on success the cursor advances and reasons clear, on failure they are retained for retry (capped at 3). A background task polls the extraction task and steers the memory diff (added/updated/deleted URIs) into the session via session_pool.steer_from_background_task, gated by remember_notify. after_run now flushes pending remember intents plus the trailing [cursor, end] messages, closing the long-standing gap where the final assistant message was never ingested (dead _pending_conversation field removed). Also fixes: commit retention kwarg renamed to the SDK's real keep_recent_count (old name TypeErrored against a live server whenever auto_ingest_keep_recent_turns > 0), and the canned mock client is extracted to a shared tests/capabilities/viking/conftest.py Tests: 434 viking tests pass (was 420); new coverage for deferral, merge, retry semantics, sanitize-always, provenance prefix, after_run flush gate, and the steer notify path.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Redesigns
viking_remember(OpenSpec changeviking-remember-deferral) from a synchronousmessages=[...]tool into a deferred, zero-argument capture:reason; the nextbefore_model_requestdrains the real conversation (shared cursor withauto_ingest, disjoint ranges, remembered-capture runs before auto-ingest in the chain) into aremember-*session with<memory-intent>markers.session_pool.steer_from_background_task(survives run boundaries), gated by new configremember_notify(default True).after_runnow flushes pending remember intents plus the trailing[cursor, end]messages — closing the historical gap where the final assistant message was never ingested. The dead_pending_conversationfield is removed (was written, never read).Bugs fixed along the way
_pending_conversation— final assistant turn was silently never ingested.commit_sessionretention kwarg renamedkeep_recent_turn_count→keep_recent_count(the SDK's real name; the old name raisedTypeErroragainst a live server wheneverauto_ingest_keep_recent_turns > 0— hidden by the canned mock).source_typewas a dead parameter — verifiedcreate_session/commit_sessionhave no such SDK surface; provenance is now expressed via the session-id prefix (remember-/ingest-), per updated spec.SDK discovery
openviking_sdk.AsyncHTTPClientsignatures were inspected directly:create_session(session_id, telemetry, memory_policy),add_message(session_id, role, content, ...),commit_session(session_id, telemetry, *, keep_recent_count). Nosource_typesurface exists.Testing
test_providers/test_multimodal.py::test_vision(ALLOW_MODEL_REQUESTS gate) — reproduced onmain.uv run pytest tests/capabilities/viking/ --record-mode=onceand commit the cassettes when a server is available.