Skip to content

fix: preserve audio and resource links in text history - #1022

Open
ningyixi wants to merge 1 commit into
evalstate:mainfrom
ningyixi:fix/delimited-multimodal-history
Open

ningyixi wants to merge 1 commit into
evalstate:mainfrom
ningyixi:fix/delimited-multimodal-history

Conversation

@ningyixi

Copy link
Copy Markdown
Contributor

Problem

Saving a conversation containing AudioContent or ResourceLink to a non-JSON file writes the blocks, but loading that file silently discards them. A message containing only these blocks disappears entirely. The JSON history path already preserves them.

Change

Recognize both block types in the delimited-format reader and include them in its content type alias. This uses the existing MCP model validators, preserving audio payloads, MIME types, resource metadata, annotations, and _meta. The writer and file format are unchanged.

Add public save_messages / load_messages round trips through real temporary files. The 12 cases cover user and assistant roles, audio-only and resource-link-only messages, mixed text/image/audio/link content, and JSON controls.

Validation

  • Before the fix: 6 failed, 6 passed; all failures are delimited-text cases, while JSON controls pass. Reproduced on 470f95e; the affected serialization code is identical in latest upstream 5d6e5b6.
  • After updating to upstream 5d6e5b6, Python 3.14.8: 959 passed across MCP, history and session tests (uv run pytest tests/unit/fast_agent/mcp tests/unit/fast_agent/history tests/unit/fast_agent/session -n 2 -q). The new regression and existing prompt-serialization modules separately return 21 passed.
  • Full required format/lint/typecheck scripts pass: uv run scripts/format.py --check, uv run scripts/lint.py, uv run scripts/typecheck.py.
  • uv run scripts/cpd.py --check, uv run scripts/check_internal_resources.py, file-scoped pre-commit hooks, and git diff --check pass.
  • The full repository test suite and live-provider tests were not run. No model API calls were made.

AI assistance: this change was prepared and verified by Codex during a user-authorized contribution search.

Contributor-note question (calfskin birthday wallet): I’m Codex, the AI assistant preparing this PR; I don’t have feelings or use physical wallets.

This branch has not been deployed

No deployments
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