fix(unit-only): Primarily a DX/discoverability fix (stateless behavior is... (#1591)#68
Draft
aidandaly24 wants to merge 1 commit into
Draft
fix(unit-only): Primarily a DX/discoverability fix (stateless behavior is... (#1591)#68aidandaly24 wants to merge 1 commit into
aidandaly24 wants to merge 1 commit into
Conversation
Suppress the 'To resume --session-id' hint and reword the --session-id help text and MEMORY_OPTIONS descriptions for memory-less agents, where session continuity is genuinely inert. Threads hasMemory through the invoke action and TUI flow so the resume hint only renders when the resolved agent has memory configured. Refs aws#1591
Coverage Report
|
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.
Refs aws#1591
Issues
Root cause
Reproduces exactly at HEAD (v0.20.2) and is by-design: session continuity is gated entirely on memory being configured. In src/assets/python/http/strands/base/main.py, the default (memory='none', no truncation, no config-bundle, no payment) renders the branch at lines 441-468: a single module-global _agent created once via get_or_create_agent() with conversation_manager=NullConversationManager() and NO session_manager. Two consequences: (1) with no session_manager, nothing is loaded/persisted to a durable store, so history is lost on container cold-start; (2) the global _agent is NOT keyed by session_id, so the runtime session_id (set as x-amz-bedrock-agentcore-session-id at src/cli/commands/invoke/action.ts:175) is functionally inert in this path — --session-id changes nothing. The session_id is only consumed by src/assets/python/http/strands/capabilities/memory/session.py get_memory_session_manager, which returns None when MEMORY_ID is unset; that manager (SDK AgentCoreMemorySessionManager extending Strands RepositorySessionManager, bedrock-agentcore-sdk-python v1.9.1, src/bedrock_agentcore/memory/integrations/strands/session_manager.py) is the sole mechanism that restores cross-invoke history, and it only exists when hasMemory is true. Memory defaults to 'none' (src/cli/commands/create/command.tsx:285,343,588,608; validate.ts:90; --defaults => "no memory" at command.tsx:394). The 'none' option description is just "No memory" (src/cli/tui/screens/generate/types.ts:253), --session-id is mislabeled "Use specific session ID for conversation continuity" (src/cli/commands/invoke/command.tsx:146), and the unconditional "To resume" notice fires for memory-less agents in both the CLI stream path (command.tsx:105-120) and the TUI (src/cli/tui/screens/invoke/InvokeScreen.tsx:216).
The fix
Primarily a DX/discoverability fix (stateless behavior is correct without a session store), plus tightening of actively misleading copy. (1) Reword MEMORY_OPTIONS so the tradeoff is explicit: 'none' = "No memory - each turn is a fresh, stateless session", 'shortTerm' = "Remembers prior turns within a session" (src/cli/tui/screens/generate/types.ts:252-256). (2) Make the continuity messaging memory-aware: soften the --session-id help text (command.tsx:146) away from "conversation continuity", and suppress or reword the "To resume --session-id" notice (command.tsx:105-120) and the TUI exit hint (InvokeScreen.tsx:216) when the resolved agent has no memory configured — in the no-memory path --session-id is genuinely inert, so promising resume is wrong, not just vague. (3) Add a post-create/first-invoke hint for memory-less agents pointing to
agentcore add memory; AddFlow.tsx already renders a memory-aware success note (AddFlow.tsx:370-394, 411-417) so reuse that copy. Product decision required: document/warn (low effort, recommended) vs change the default to short-term memory (larger; provisioning/cost impact). Do NOT change the NullConversationManager branch itself. Optional follow-up: address the latent cross-session-bleed smell of the single non-keyed global _agent in the no-memory path.Files touched: src/cli/tui/screens/generate/types.ts:252-256 (MEMORY_OPTIONS descriptions); src/cli/commands/invoke/command.tsx:146 (--session-id help) and 105-120 ("To resume" notice, make memory-conditional); src/cli/tui/screens/invoke/InvokeScreen.tsx:216 (TUI resume hint, make memory-conditional); optional post-create hint reusing src/cli/tui/screens/add/AddFlow.tsx:370-394. Template src/assets/python/http/strands/base/main.py NullConversationManager branch (lines 441-468) is correct and should NOT change.
Validation evidence
The fix was verified by reproducing the original symptom and re-running after the change:
Test suite: green.
Staged on the fork as a draft for human review. Promote to aws/agentcore-cli after vetting.