Skip to content

Native memory callbacks retain their conversation protection - #850

Merged
zlareb1 merged 2 commits into
mainfrom
feat/framework-session-capture
Nov 18, 2026
Merged

zlareb1 merged 2 commits into
mainfrom
feat/framework-session-capture

Conversation

@zlareb1

@zlareb1 zlareb1 commented Nov 18, 2026 •

Copy link
Copy Markdown
Member

Related: #840
Related: #849

Changelog category (leave one):

  • Improvement

Changelog entry (one or two sentences a user of Loom can read without the diff; the release pull request collects these into the release notes):

Agent Framework and Pipecat memory callbacks retain protection for every contributing conversation. Protection stops later automatic recall and extraction across client rebinding and deferred callbacks.

Why

Native callbacks can run after their originating context exits or the Loom client is rebound. Retaining only the current client handle loses the conversation that supplied the text. Each adapter therefore retains its constructor and callback contributors for the lifetime of its conversation instance.

Scope and risk

Both adapters use one private helper to retain the application-owned handle union and enter the existing automatic SDK context. No native user or session id selects protection authority. The transport keeps response observation and the final credential and dispatch barriers.

A first marked recall can reach native prompt assembly after durable protection. Later automatic reads and extraction refuse, including subsequent batches. Agent Framework propagates suppression through its existing provider lifecycle; a failure after the model answers cannot undo that answer or tool effects.

Pipecat retains callback handles before awaiting the native frame processor, including committed context frames whose capture runs later. Suppression skips automatic memory work while frames keep flowing. Protection clears only service-owned retry references and write tracking, preserving application history and avoiding acknowledgment of unsent batches. Existing speculative-frame exclusion and clean partial-capture retry behavior remain.

Use one provider or service per logical conversation family, with its existing application-owned capsule bound before construction. Restored families reopen their existing authority. Explicit selected tools and other adapters are unchanged. This change creates no capsule, sends no capability declaration and does not qualify a host, platform backend or fleet.

Compatibility, rollout and rollback

  • Wire: no operation, field, header or SDK constructor argument changes.
  • Storage: no schema or durable capsule format change.
  • Operators: none. Applications provide complete contributor authority and retain the same capsule on restore.
  • Rollback: no migration. Keep durable protection records; an older callback implementation cannot declare session protection support.
  • The gateway bearer-fixture clock correction from the related SDK PR is carried for CI: it isolates the gateway clock without changing production policy or token assertions.

Tests

  • A focused native callback cohort reproduces 11 protection failures before the fix while two ordinary controls pass.
  • The corrected focused cohort passes 15 cases in 1.48 seconds: those 11 cases, two additional callback-binding changes during native processor awaits, and two ordinary controls. It uses installed Agent Framework and Pipecat protocols with an inert model client and HTTPX MockTransport; no service or provider starts.
  • Checks cover constructor and ambient contributors, rebinding, first marked recall, later extraction suppression, credential waits, batch stops, native frame forwarding, owned retry cleanup and preservation of application history.
  • Scoped Ruff formatting/lint, strict typing for the three changed source modules, documentation formatting, prose and diff checks pass.
  • The unchanged bearer-fixture correction has its causal attributed-clock failure and 16 passing targeted cases on the related SDK PR.
  • Full unit, SDK adapter, package and integration checks run in GitHub CI and must pass on the final head. No broad local suite ran.

AI assistance in the code (leave one; writing this description with AI is fine):

  • AI-generated: Codex wrote the change; fresh independent whole-diff review and final-head CI are required before merge.

  • I can explain every line of this diff and how it interacts with the rest of Loom.

Checklist

  • Full final-head CI passes.
  • Fresh whole-diff review has no findings or nits.
  • Documentation states callback ownership, suppression and restore requirements.
  • No generated operation, migration, plugin or frontend changes.
  • Public text follows repository copy rules.
  • Commits are signed off.

Keep constructor and callback contributors across rebinding and native awaits. Stop later automatic capture after a marked recall while preserving native history and unacknowledged batch semantics.

Signed-off-by: zlareb1 <[email protected]>
A shared monotonic patch could expire a freshly loaded model-call policy before the bearer test reached its first request. Exercise the same attributed token rotation at two clock epochs without changing the policy clock.

Signed-off-by: zlareb1 <[email protected]>
@zlareb1
zlareb1 merged commit 29a8da8 into main Nov 18, 2026
45 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant