Skip to content

Advisor: interaction-summary capture is best-effort (logout-only) + cache-only durability #1118

Description

@bjagg

Summary

The Advisor persists a per-session interaction summary to the learner's Person record, but two gaps make that capture unreliable and non-durable.

Persistence path today: POST /logoutsave_interaction_summary task → MCP lif_mutation → GraphQL updatePerson → Query Planner /updateLIF Cache /update → MongoDB LIF.person, appended under the person's interactions array. The saved object is a rollup (summary, sentiment, severity, followupRequired, interactionStart/End, channel=AI_AGENT, interactionType=ADVISING) — not the turn-by-turn transcript (that lives only in-memory: conversation_states + LangGraph InMemorySaver).

Gap 1 — capture is best-effort, tied to explicit logout

bases/lif/advisor_restapi/core.py:286-307 only summarizes when the user hits /logout and there's a live in-memory agent (if state and state.get("lif_ai_agent")). So no summary is saved when:

  • the user just closes the tab / navigates away,
  • the access token expires without an explicit logout,
  • the session was restored after an advisor-api restart (no in-memory agent), or
  • the advisor-api process restarts/redeploys mid-session (single worker, in-memory state — the whole conversation is lost before it can be summarized).

There is no turn-level or periodic persistence — it's all-or-nothing at logout.

Gap 2 — cache-only durability (no source of truth)

The interaction is written only to the LIF Cache (components/lif/query_planner_service/core.py:178-193 — "Execute a LIF update on the LIF Cache"; query_cache_service/core.py:34-35, Mongo LIF.person). Unlike other LIF fragments, which the orchestrator can re-pull from upstream source systems, advisor interactions have no upstream source — nothing writes them back. Their longevity is therefore bounded by the cached Person document's lifetime; if that record is evicted or rebuilt, the interactions are gone with no way to recover them.

Impact

Advisor interaction history (and the sentiment/severity/follow-up signals derived from it) is lossy and non-durable — fine for a demo, but not a dependable record of advising interactions.

Possible directions (not prescriptive)

  • Capture incrementally / on a heartbeat rather than only at logout (survives tab-close, token expiry, and restarts).
  • Give advisor interactions a real system of record (a durable store or a designated source) rather than writing learner-data mutations into the cache — ties into ADR-0002/ADR-0003 (cache vs. source, mutation write-back semantics).
  • At minimum, document the current behavior as demo-tier best-effort so it isn't mistaken for a reliable audit trail.

Found while answering an architecture question about advisor chat-session storage.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    Status
    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions