Skip to content

test(agent): cover a multi-turn conversation in the Anthropic dialect - #598

Open
HappyDevs1 wants to merge 1 commit into
mainfrom
test/conversation-anthropic-dialect
Open

HappyDevs1 wants to merge 1 commit into
mainfrom
test/conversation-anthropic-dialect

Conversation

@HappyDevs1

Copy link
Copy Markdown
Collaborator

Part 3a of closing out #375. Independent of #596 and #597 (different files).

Why

#375 requires multi-turn record/replay for both the OpenAI-compatible and Anthropic dialects. plans/012-agent-multiturn-conversations.md shipped delivery gating with OpenAI-shaped fixtures only and logged the rest explicitly as a known gap:

The delivery-gating code added is dialect-agnostic by construction — it never inspects Turn.protocol … so there is no known reason Anthropic or streaming would behave differently, but that is confidence, not a fixture.

This is the fixture.

What it actually pins

Not just "it works". The trajectory is deliberately asymmetric: delivery 0 produces one turn (the agent asks for confirmation), delivery 1 produces two (a tool_use, then the text that follows its tool result).

That matters because a grouping bug — one turn stamped per delivery, or a delivery closed at first response rather than at settle — would still assemble the same replies and still satisfy every assert: reply contains in the spec. So the assertions are on:

  • deliveries[].turn_count == [1, 2]
  • the turn→delivery mapping == [0, 1, 1]
  • every turn carrying "protocol": "anthropic"

…which only correct grouping can produce.

Falsifiability checked: I asserted turn_count == 3 and confirmed the failure reads left: Number(2) from the real recorded trace — so the assertion reads recorded data, and delivery 1 genuinely owns both turns.

Also asserts the volatile real tool result (cancelled_at) never reaches disk in this dialect, and that the whole conversation replays with every upstream env handle unset.

Test plan

  • cargo test -p flowproof-cli --test agent_conversation_anthropic_e2e — passes (1.3s).
  • cargo fmt --check, cargo clippy -p flowproof-cli --all-targets -- -D warnings clean.

Plan 012 shipped delivery gating with OpenAI-shaped fixtures only and
recorded the rest as a known gap: the gating code never inspects
Turn.protocol, so there was "no known reason Anthropic would behave
differently - but that is confidence, not a fixture."

This is the fixture, and it pins more than "it works". Delivery 1 here
produces TWO turns - a tool_use and the text that follows its result -
while delivery 0 produces one. A grouping bug that stamped one turn per
delivery, or closed a delivery at the first response rather than at
settle, would still assemble the same replies and still satisfy every
reply assertion in the spec. So the assertions are on the per-delivery
turn counts and the turn->delivery mapping, which only correct grouping
produces.
Copilot AI lite review requested due to automatic review settings September 15, 2026 13:38

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

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.

2 participants