fix(templates): retrieve SUMMARIZATION summaries with an actor-scoped namespace (#665)#1660
fix(templates): retrieve SUMMARIZATION summaries with an actor-scoped namespace (#665)#1660aidandaly24 wants to merge 3 commits into
Conversation
…mespace
Cross-session SUMMARIZATION recall was silently broken: the vended Strands
session.py templates retrieved summaries with a per-session namespace
(/summaries/{actor_id}/{session_id}), which only prefix-matches the current
session and never surfaces prior sessions' summaries. Re-apply PR aws#1299's
one-line fix to use an actor-scoped namespace (/summaries/{actor_id}) in all
three templates (http, agui, a2a), regenerate the asset snapshot, update
docs/memory.md, and add a regression test to prevent another silent revert
(reverted previously by squash release aws#1547).
Fixes aws#665
|
Claude Security Review: no high-confidence findings. (run) |
Package TarballHow to installgh release download pr-1660-tarball --repo aws/agentcore-cli --pattern "*.tgz" --dir /tmp/pr-tarball
npm install -g /tmp/pr-tarball/aws-agentcore-0.21.0.tgz |
agentcore-cli-automation
left a comment
There was a problem hiding this comment.
LGTM. The fix correctly mirrors PR #1299: retrieval moves to the actor-scoped prefix /summaries/{actor_id} so the SDK's hierarchical prefix match surfaces summaries from prior sessions, while writes remain session-scoped via DEFAULT_STRATEGY_NAMESPACE_TEMPLATES.SUMMARIZATION (memory.ts:23) — so storage organization is preserved and only the read scope is widened. All three template flavors (http, agui, a2a) are updated consistently, the snapshots regenerate cleanly, and the docs (manual-wiring snippet + strategy table) are kept in sync.
The new regression test is well-scoped: it reads the real template files and renders them through the same global Handlebars instance the production renderer uses (registering the includes helper via the side-effect import of render.ts), with no excessive mocking. The negative assertion against /summaries/{actor_id}/{session_id} is exactly what's needed to prevent another silent revert.
No telemetry needed (template bug fix, not a new feature). The api-types.ts:158 comment example still references /summaries/{actorId}/{sessionId}, but that's the write/namespaceTemplate namespace which is intentionally unchanged, so the comment remains accurate.
|
Claude Security Review: no high-confidence findings. (run) |
|
Reviewed independently. Confirmed:
All the concerns I would have flagged have already been covered in the existing approving review. LGTM to merge. |
Description
#665
Agents created/extended with
--strategies SUMMARIZATIONwrite per-session conversation summaries correctly, but the generated session.py retrieves them with a per-session namespace, so a new session never sees prior sessions' summaries. Cross-session summary recall silently does nothing; the feature appears write-only to users.Fix
Re-apply PR #1299's one-line change in all three Strands session.py templates: change the SUMMARIZATION retrieval line at line 31 from f"/summaries/{actor_id}/{session_id}" to f"/summaries/{actor_id}". Run
npm run test:update-snapshotsto refresh the 3 affected entries in assets.snapshot.test.ts.snap (lines 2264, 3286, 6554). Update docs/memory.md:95 (manual-wiring snippet) and the strategy table at docs/memory.md:160 to /summaries/{actorId} for SUMMARIZATION. Leave the write-side namespaceTemplate (memory.ts:26) and EPISODIC ({session_id} kept intentionally; the issue is scoped to SUMMARIZATION) unchanged. Add a regression test asserting the generated SUMMARIZATION retrieval namespace contains no {session_id}, so a future squash-merge cannot silently revert it again. No SDK or CDK change needed (SDK prefix-retrieval is correct; CDK owns nothing in this path).This fix was produced by an automated triage+fix run and validated locally (build + unit suite + symptom reproduction). Opened as a draft for CI and human review; will be bug-bashed before it's marked ready.
Related Issue
Closes #665
Documentation PR
N/A — bug fix; no devguide change required.
Type of Change
Testing
How have you tested the change? (full validation in PR comments after bug bash)
npm run test:unitandnpm run test:integnpm run typechecknpm run lintsrc/assets/, I rannpm run test:update-snapshotsand committed the updated snapshotsChecklist
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the
terms of your choice.