Skip to content

fix(agent): replay legacy memories that resolve to JSON text - #10701

Open
kowshikdev wants to merge 1 commit into
simstudioai:stagingfrom
kowshikdev:fix/agent-legacy-memories
Open

kowshikdev wants to merge 1 commit into
simstudioai:stagingfrom
kowshikdev:fix/agent-legacy-memories

Conversation

@kowshikdev

Copy link
Copy Markdown

Summary

Agent blocks saved before the messages-array redesign can still carry a memories field, which the serializer keeps as a legacy field. Since the executor redesign (#1790), a reference such as <getmemory.memories> reaches the handler as a JSON string. processMemories only accepted arrays, so those agents silently ran without their memories.

  • Parse JSON text before reading the memories.
  • Turn structured message content into text, which addresses the provider 400 reported in the issue.
  • List a string memories input as a model-input path, so a secret resolved into it is projected out before the provider request. When the projected text no longer parses as JSON, the memories are dropped (fails closed).

Reviewer note: this restores behaviour on a field the editor no longer shows, so affected old workflows will start sending memories again. If you would rather remove the legacy field, I am happy to close this.

Fixes #1151

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation
  • Other: ___________

Testing

Two regression tests in executor/handlers/agent/handler.test.ts: the memories are replayed, and a secret resolved into them stays out of the model request.

Also checked, with this change stacked on staging (0f6b0d4) together with my other independent fixes, on Windows:

  • The new tests fail with the source change reverted and pass with it.
  • bun run type-check: 33/33 packages pass.
  • biome check on the changed files: no findings.
  • check-block-registry.ts origin/staging passes, and bun run generate leaves the tree clean (skills:sync cannot run on this checkout, which has no symlinks).
  • bun run check:audits: the 12 audits that fail also fail on a clean staging checkout on this machine (mostly Windows path handling). No additional audit fails.

Not run: the full bun run test suite, the integration suites (no Docker here), or a live run of the app.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

Screenshots/Videos

N/A

🤖 Generated with Claude Code

An Agent block saved before the messages-array redesign can still carry a
`memories` field, which the serializer keeps as a legacy field. The
executor redesign (simstudioai#1790) made every reference in a string input resolve
to text, so `<getmemory.memories>` now reaches the handler as a JSON
string. processMemories only accepted arrays, so it returned nothing and
the agent silently ran without the memories.

Parse JSON text before reading the memories, and turn structured message
content into text, which providers otherwise reject with a 400 (simstudioai#1151).
A string `memories` input is now listed as a model-input path, so a
secret resolved into it is projected out before the provider request.

Fixes simstudioai#1151

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Dec 3, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
docs Skipped Skipped Dec 3, 2026 2:33pm UTC

Request Review

This branch was previously deployed

1 inactive deployment
Preview — ef84e1d4 Deployed Dec 3, 2026 by vercel[bot]
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.

1 participant