fix(memory): guard retrieve_customer_context against empty message content - #544
Merged
nborges-aws merged 1 commit intoJun 23, 2026
Conversation
dtaniwaki
had a problem deploying
to
manual-approval
June 23, 2026 02:57 — with
GitHub Actions
Failure
dtaniwaki
had a problem deploying
to
manual-approval
June 23, 2026 02:57 — with
GitHub Actions
Failure
dtaniwaki
had a problem deploying
to
manual-approval
June 23, 2026 02:57 — with
GitHub Actions
Failure
dtaniwaki
had a problem deploying
to
manual-approval
June 23, 2026 02:57 — with
GitHub Actions
Failure
dtaniwaki
had a problem deploying
to
manual-approval
June 23, 2026 02:57 — with
GitHub Actions
Failure
dtaniwaki
had a problem deploying
to
manual-approval
June 23, 2026 02:57 — with
GitHub Actions
Failure
dtaniwaki
had a problem deploying
to
manual-approval
June 23, 2026 02:57 — with
GitHub Actions
Failure
dtaniwaki
had a problem deploying
to
manual-approval
June 23, 2026 02:57 — with
GitHub Actions
Failure
dtaniwaki
had a problem deploying
to
manual-approval
June 23, 2026 02:57 — with
GitHub Actions
Failure
dtaniwaki
had a problem deploying
to
manual-approval
June 23, 2026 03:41 — with
GitHub Actions
Failure
dtaniwaki
had a problem deploying
to
manual-approval
June 23, 2026 03:41 — with
GitHub Actions
Failure
dtaniwaki
had a problem deploying
to
manual-approval
June 23, 2026 03:41 — with
GitHub Actions
Failure
dtaniwaki
had a problem deploying
to
manual-approval
June 23, 2026 03:41 — with
GitHub Actions
Failure
dtaniwaki
had a problem deploying
to
manual-approval
June 23, 2026 03:41 — with
GitHub Actions
Failure
dtaniwaki
had a problem deploying
to
manual-approval
June 23, 2026 03:41 — with
GitHub Actions
Failure
dtaniwaki
had a problem deploying
to
manual-approval
June 23, 2026 03:41 — with
GitHub Actions
Failure
dtaniwaki
had a problem deploying
to
manual-approval
June 23, 2026 03:41 — with
GitHub Actions
Failure
dtaniwaki
had a problem deploying
to
manual-approval
June 23, 2026 03:41 — with
GitHub Actions
Failure
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #544 +/- ##
=======================================
Coverage ? 89.39%
=======================================
Files ? 98
Lines ? 8575
Branches ? 1271
=======================================
Hits ? 7666
Misses ? 585
Partials ? 324
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
nborges-aws
force-pushed
the
fix/retrieve-customer-context-empty-content
branch
from
June 23, 2026 21:15
d79bf1f to
ebca33d
Compare
nborges-aws
had a problem deploying
to
manual-approval
June 23, 2026 21:15 — with
GitHub Actions
Failure
nborges-aws
had a problem deploying
to
manual-approval
June 23, 2026 21:15 — with
GitHub Actions
Failure
nborges-aws
had a problem deploying
to
manual-approval
June 23, 2026 21:15 — with
GitHub Actions
Failure
nborges-aws
had a problem deploying
to
manual-approval
June 23, 2026 21:15 — with
GitHub Actions
Failure
nborges-aws
had a problem deploying
to
manual-approval
June 23, 2026 21:15 — with
GitHub Actions
Failure
nborges-aws
had a problem deploying
to
manual-approval
June 23, 2026 21:15 — with
GitHub Actions
Failure
nborges-aws
had a problem deploying
to
manual-approval
June 23, 2026 21:15 — with
GitHub Actions
Failure
nborges-aws
had a problem deploying
to
manual-approval
June 23, 2026 21:15 — with
GitHub Actions
Failure
nborges-aws
had a problem deploying
to
manual-approval
June 23, 2026 21:15 — with
GitHub Actions
Failure
…ntent Signed-off-by: Daisuke Taniwaki <daisuketaniwaki@gmail.com>
nborges-aws
force-pushed
the
fix/retrieve-customer-context-empty-content
branch
from
June 23, 2026 21:20
ebca33d to
e36ff8c
Compare
nborges-aws
temporarily deployed
to
manual-approval
June 23, 2026 21:20 — with
GitHub Actions
Inactive
nborges-aws
temporarily deployed
to
manual-approval
June 23, 2026 21:20 — with
GitHub Actions
Inactive
nborges-aws
temporarily deployed
to
manual-approval
June 23, 2026 21:20 — with
GitHub Actions
Inactive
nborges-aws
temporarily deployed
to
manual-approval
June 23, 2026 21:20 — with
GitHub Actions
Inactive
nborges-aws
temporarily deployed
to
manual-approval
June 23, 2026 21:20 — with
GitHub Actions
Inactive
nborges-aws
temporarily deployed
to
manual-approval
June 23, 2026 21:20 — with
GitHub Actions
Inactive
nborges-aws
temporarily deployed
to
manual-approval
June 23, 2026 21:20 — with
GitHub Actions
Inactive
nborges-aws
temporarily deployed
to
manual-approval
June 23, 2026 21:20 — with
GitHub Actions
Inactive
nborges-aws
temporarily deployed
to
manual-approval
June 23, 2026 21:20 — with
GitHub Actions
Inactive
nborges-aws
approved these changes
Jun 23, 2026
Contributor
|
Breaking change bot failure is false alarm. Reported "No Breaking Changes Detected", but errored while attempting to post comment to PR, causing workflow to fail. PR looks good to me. Thanks for the fix! |
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.
Thanks for maintaining this project! Would appreciate a review when you get a chance.
Fixes #543
Problem
AgentCoreMemorySessionManager.retrieve_customer_context(registered as aMessageAddedEventcallback) indexes the first content block of the last message without checking that the content list is non-empty:When the last message has an empty
contentlist ([]),messages[-1].get("content")[0]raisesIndexError. Because this runs inside aMessageAddedEventhook, the exception propagates out of the event loop and aborts the whole agent invocation (surfacing as a500on AgentCore Runtime). The existing guard handlesnot messagesbut not an emptycontentlist. (See #543 for a runnable end-to-end reproduction.)Solution
Check that
contentis non-empty before indexing the first block, returning early otherwise. Added a regression test (test_retrieve_customer_context_empty_content) that fails without the guard and passes with it. All existing tests in the session manager suite still pass, andruff check/ruff formatare clean.