session_start_payload serializer drops recent_thread
Summary
In iai-pme 3.0.8, SessionStartPayload.recent_thread is populated by session assembly but is dropped when session_start_payload is serialized through the core dispatch path.
This breaks ambient first-turn recall integrations that consume the JSON-RPC/dispatch result rather than calling assemble_session_start() directly.
Environment
iai-pme:3.0.8- Hermes Agent integration tested against Hermes
v0.20.4 (2026.8.18) - iai runtime: Python 3.12
- Reproduced in a disposable Docker integration environment
The omission also appears to still exist on the current main branch: src/iai_mcp/core/_serializers.py::_payload_to_json() serializes l0, l1, l2, rich_club, token counts, breakpoint/identity/brain/topic/compact/wake fields, but not recent_thread.
Reproduction
Using a store with a known recent conversation marker:
- Read/assemble the session start payload directly.
- Confirm
payload.recent_threadis populated. - Request the same payload through
core.dispatch("session_start_payload", ...). - Inspect the returned JSON object.
Observed in the affected build:
BASE_SERIALIZER_RECENT_THREAD_KEY=NO
BASE_SERIALIZER_SOURCE_HAS_RECENT_THREAD=NO
The direct assembly path contained 271 characters of recent-thread content, including the expected marker, while the dispatched JSON result contained no recent_thread field.
Expected behavior
session_start_payload JSON should preserve recent_thread when present on SessionStartPayload.
Actual behavior
recent_thread is silently omitted by _payload_to_json().
Minimal fix
Adding the field to _payload_to_json() resolves the issue:
"recent_thread": getattr(payload, "recent_thread", ""),
With that one-field serializer change, the integration test reported:
FIXED_SERIALIZER_KEY_PRESENT=YES
FIXED_SERIALIZER_VALUE=<expected marker>
FIXED_SERIALIZER_SOURCE_HAS_RECENT_THREAD=YES
FIXED_SERIALIZER_CONTRACT=PASS
A live fresh-session integration test then successfully recalled the persisted marker after container destruction/recreation.
Why this matters
The direct Python assembly path can look healthy while the public dispatch/JSON-RPC path silently loses the recent-thread memory. Integrations can therefore pass local assembly tests yet fail real first-turn recall.
If useful, I can provide a focused regression test shape for _payload_to_json() / session_start_payload.
Fixed: session_start_payload now serializes recent_thread through the dispatch path (present in _payload_to_json). Live in the current release (iai-pme on PyPI).