fix(templates): allow actor_id overrides to match harness behavior - #2306
Conversation
There was a problem hiding this comment.
AgentCore Harness Review
Verdict: Looks good
Nice refactor of the agent-python-strands template. parse.py is a good separation of concerns, the lru_cache on _get_agent is cleaner than the hand-rolled closure and has the benefit of a bounded size, and the README now documents the payload shape and where session_id actually comes from.
A couple of small, non-blocking observations:
- Behavior change on missing
session_id(local dev only):memory/session.pyused to fall back touuid.uuid4().hexwhensession_idwasNone; that fallback is now gone andmain.pysubstitutes the fixed string"default-session"instead. In deployed AgentCore this doesn't matter (the header is always set), but for local dev multiple invocations will now share the same session/agent (via_get_agent's cache) rather than getting a fresh one. That seems like the intended tradeoff (deterministic local session), just worth noting. - Sibling
export-harness-pythontemplate is now inconsistent: it still referencesstrip_trailing_tool_use(),agent_factory(), andget_or_create_agent(...)in bothmain.pyandREADME.md. If the intent is to align the two templates, a follow-up PR to port the same refactor would be worthwhile — not required for this one.
No changes required to merge.
|
Claude Security Review: no high-confidence findings. (run) |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## refactor #2306 +/- ##
=========================================
Coverage 97.06% 97.06%
=========================================
Files 569 569
Lines 39322 39322
=========================================
Hits 38167 38167
Misses 1155 1155 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Claude Security Review: no high-confidence findings. (run) |
0de49e8 to
d557834
Compare
|
Claude Security Review: no high-confidence findings. (run) |
Problem
This PR addresses a few related problems:
user_idis not injected via the app context, or the headers so the invoke handler always defaulting todefault-user.Solution
actor_idto be injected at invoke time to determine the memory namespace (not runtime user id).We also simplify the template and improve documentation:
parse.py.Future Work
Testing / Verification
deployed and verified e2e that actorId scoping is working.