Skip to content

fix: align harness memory config with Smithy API model#1288

Merged
jesseturner21 merged 2 commits into
previewfrom
fix/harness-memory-configuration
May 18, 2026
Merged

fix: align harness memory config with Smithy API model#1288
jesseturner21 merged 2 commits into
previewfrom
fix/harness-memory-configuration

Conversation

@jesseturner21

@jesseturner21 jesseturner21 commented May 18, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Fixes harness memory not working when a memory ARN is configured in harness.json
  • The Harness API expects memory as a Smithy union type { agentCoreMemoryConfiguration: { arn: "..." } } but the CLI was sending { memoryArn: "..." }
  • The API silently accepted the wrong structure and stored "memory": {}, resulting in deployed harnesses having no memory capabilities

Closes #1291

Changes

  • src/cli/aws/agentcore-harness.ts: Updated HarnessMemoryConfiguration interface to match Smithy model with agentCoreMemoryConfiguration union wrapper
  • src/cli/operations/deploy/imperative/deployers/harness-mapper.ts: Updated mapMemory() to return correct nested structure
  • src/cli/operations/deploy/imperative/deployers/harness-deployer.ts: Updated ARN extraction from new structure

Test plan

  • npm test -- "harness-mapper" — 38 tests pass
  • npm test -- "harness-deployer" — 22 tests pass
  • npm test -- "agentcore-harness" — 16 tests pass
  • npx tsc --noEmit — no type errors
  • E2E: deployed harness with memory, verified GetHarness returns { agentCoreMemoryConfiguration: { arn: "..." } } instead of {}

The harness API expects memory as a union type:
  { agentCoreMemoryConfiguration: { arn: "..." } }

but the CLI was sending the wrong structure:
  { memoryArn: "..." }

This caused the API to silently accept the request but store an empty
memory config, resulting in deployed harnesses having no memory
capabilities at invocation time.
@jesseturner21 jesseturner21 requested a review from a team May 18, 2026 17:19
@github-actions github-actions Bot added the agentcore-harness-reviewing AgentCore Harness review in progress label May 18, 2026
@github-actions

github-actions Bot commented May 18, 2026

Copy link
Copy Markdown
Contributor

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 43.46% 10087 / 23205
🔵 Statements 42.73% 10719 / 25084
🔵 Functions 40.33% 1700 / 4215
🔵 Branches 40.18% 6566 / 16338
Generated in workflow #3067 for commit 329a4ad by the Vitest Coverage Report Action

@agentcore-cli-automation agentcore-cli-automation left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the PR — looks good to merge.

The fix correctly aligns the wire format with the Smithy union ({ agentCoreMemoryConfiguration: { arn } }). All call sites have been updated:

  • HarnessMemoryConfiguration interface in agentcore-harness.ts reflects the new shape.
  • harness-mapper.ts builds the nested structure and now also plumbs memory.actorId (previously ignored).
  • harness-deployer.ts correctly extracts the ARN from the new path for memoryArn in deployed state.
  • UpdateHarness semantics with { optionalValue: null } to clear memory continue to work.

Existing throw-on-unresolved behavior for memory.name is preserved, and the new gateway-tool tests around the mapTools cast removal are a nice coverage bump.

Minor (non-blocking) suggestion: consider adding a unit test for the actorId plumbing in mapMemory so a future refactor doesn't silently drop it again — currently no test covers that branch.

@github-actions github-actions Bot removed the agentcore-harness-reviewing AgentCore Harness review in progress label May 18, 2026
The Smithy model includes strategyId in the retrieval config structure
but it was missing from the TypeScript interface.
Comment thread src/cli/aws/agentcore-harness.ts

@notgitika notgitika left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM thank you for fixing this!

@jesseturner21 jesseturner21 merged commit aa8e049 into preview May 18, 2026
17 checks passed
@jesseturner21 jesseturner21 deleted the fix/harness-memory-configuration branch May 18, 2026 19:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants