fix(agentcore): async-native client, task tracking, drop per-package CHANGELOGs#1313
Merged
nicoloboschi merged 2 commits intomainfrom Apr 29, 2026
Merged
fix(agentcore): async-native client, task tracking, drop per-package CHANGELOGs#1313nicoloboschi merged 2 commits intomainfrom
nicoloboschi merged 2 commits intomainfrom
Conversation
…on tasks Use client.arecall/areflect/aretain directly instead of wrapping the sync methods in run_in_executor (which spawned a worker thread that itself created a new event loop per call). Matches the pipecat integration's pattern. Track fire-and-forget retention tasks in a set with a done-callback discard so asyncio cannot GC them mid-flight. Drop the unused threading.local client cache and the deprecated asyncio.get_event_loop() calls. Type _format_memories against RecallResult attributes instead of getattr fallbacks. Drop the unimplemented 'hybrid' mode from the RecallPolicy docstring.
The canonical changelog for each integration lives at hindsight-docs/src/pages/changelog/integrations/<name>.md and is written by ./scripts/release-integration.sh at release-cut time. Per-package CHANGELOG.md files duplicate that content and encourage pre-staging Unreleased entries, which CLAUDE.md disallows.
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
Follow-up fixes for #822.
client.arecall/areflect/aretaindirectly, instead of wrapping the sync methods inrun_in_executor(which spawned a worker thread that then created a fresh event loop per call). Matches the pipecat integration's pattern.asyncio.create_task+self._pending: set[asyncio.Task]+add_done_callback(self._pending.discard)so asyncio's weak-ref bookkeeping can't GC retention mid-flight.asyncio.get_event_loop(). All three call sites are gone with the executor refactor._format_memoriesagainstRecallResult. No moregetattrfallbacks — direct attribute access.'hybrid'mode fromRecallPolicydocstring.CHANGELOG.mdfiles for bothagentcoreandpipecat. The canonical changelog lives inhindsight-docs/src/pages/changelog/integrations/<name>.mdand is written by./scripts/release-integration.shat release-cut time. Per-package files duplicate that and encourage pre-staging Unreleased entries (disallowed by CLAUDE.md).Test plan
uv run pytest tests -vinhindsight-integrations/agentcore/— 42 pass, 1 skipped (live test, needsHINDSIGHT_API_KEY)TestRetainAsync::test_pending_task_tracked_and_completescovers the strong-ref behavioruv run ruff check .andruff format --check .cleantest-agentcore-integrationjob