`DynamicWorkflow` reveal announcements don't survive compaction or history loss

Author: DouweMCreated Aug 6, 2026Updated Oct 1, 2026
Labelsharness

Transferred from pydantic/pydantic-ai-harness#563 after harness moved into this repo. Harness paths map to src/pydantic_ai_harness/pydantic_ai_harness/, tests/harness/ and docs/harness/.

Same pattern as pydantic/pydantic-ai-harness#562 found in CodeMode: DynamicWorkflowToolset._fold_reveals (_toolset.py:539-570) enqueues a sub-agent's reveal announcement exactly once, deduped by the in-memory _by_name index. If a CompactionPart (or a history processor) later removes that announcement SystemPromptPart, the model permanently loses awareness of a sub-agent that remains callable — the run-lifetime state and the model-visible history disagree.

Fix the same way as pydantic/pydantic-ai-harness#562: derive announced-state from visible history. Once the harness pin includes pydantic-ai's pydantic_ai.messages.post_compaction_window (added in pydantic/pydantic-ai#7225), use it as the boundary rule instead of a local scan.

Worth a quick sweep of the other announcement/disclosure surfaces at the same time — anything the model needs to have seen that's tracked in instance attributes rather than derived from the window.