Skip to content

Ground the multi-turn smoke on the turn that survives a 270M model - #10025

Merged
danielhanchen merged 2 commits into
mainfrom
fix/multi-turn-smoke-grounding-and-ties
Aug 30, 2026
Merged

danielhanchen merged 2 commits into
mainfrom
fix/multi-turn-smoke-grounding-and-ties

Conversation

@danielhanchen

@danielhanchen danielhanchen commented Aug 30, 2026 •

Copy link
Copy Markdown
Member

What is red

GGUF inference smoke (API, tools, vision) and Chat UI, API, Update and GGUF inference are failing on main and on almost every open PR. They are two different failures that happen to land on the same turn.

macOS: the assertion is wrong, the server is fine

#10009 moved history grounding onto turn 2, requiring the reply to restate turn 1's answer. The latest main Mac run:

[openai turn 1] 'To find the sum of 58 and 27, we add the two numbers:\n58 + 27 = 95\n'
[openai turn 2] "You haven't provided the previous question. \n"
AssertionError: openai: turn 2 must carry turn 1's answer '95', so history reached the model.
[openai turn 4] 'The capital of France is Paris.'

Turn 4 is the tell. Its prompt is "Repeat the city name", which names no city, so Paris can only have come from turn 3. History reached the model in the very same run that turn 2 failed on. Whether a 270M model phrases a recalled number is a property of the model, not of the server's history wiring.

#10009's finding is real and is kept. Its point was that looking for paris in the joined transcript proves nothing, because turn 3 supplies it on its own, so a server that dropped every earlier turn still passed. Asserting the last turn, per turn closes exactly that, on the turn that works. Measured against llama-server b10360 with the same UD-Q4_K_XL file the workflow loads:

history last-turn reply contains paris
none "Okay, I'm ready." no
none "Okay, I'm ready." no
none "Okay, I'm ready." no
full 'The capital of France is Paris.' yes, 15/15 conversations

Windows: a near-tie between two correct answers

Two replays are not two identical requests. Each turn is built from the reply before it, and the second replay meets the server holding prompt-cache and slot state the first left behind, so a near-tied token can land differently without decoding being broken:

run1: 'The answer to your previous question was 95.'
run2: 'The previous question was about the sum of 58 and 27.'

The retry is in main(), deliberately not in check()

check()'s contract is unchanged: every divergence handed to it is still a hard failure. That is why test_a_divergent_second_run_is_a_failure_not_a_warning passes here untouched -- that test exists because #5669 turned this assertion into a printed warning on the Linux leg and it went unnoticed for three months, and softening check() would have walked straight back into it.

The divergence now raises Nondeterministic, a subclass of AssertionError, so main() can retry that one failure and nothing else, and existing pytest.raises(AssertionError) keeps matching. A server that is genuinely non-deterministic disagrees on every attempt and still fails.

Guards

Two guards from #10009 encode the turn-2 design, so they are updated with the change rather than worked around, and their replacements use the measured history-dropping reply rather than a hypothetical fixture. Five in total now pin this behaviour:

  • the macOS transcript passes, and a last turn that cannot name the city fails
  • a server that answers turn 3 and then loses history fails, so "joined is not enough" stays closed
  • turn 1 with no number fails
  • a server that disagrees on every attempt still fails, and the retry is bounded to ATTEMPTS (asserted by counting calls)
  • a non-divergence failure (empty reply, dropped history) is not retried

Verification

tests/studio: 6630 passed, 195 skipped. Live end-to-end against a real llama-server on the real GGUF passes. verify_import_hoist, lint_exec_literals, lint_no_parallel_clamp clean.

What I could not do

I could not reproduce the Windows tie on this machine, and I tried four ways before concluding the assertion was the problem:

  • prompt-cache state: cold, primed with the 2-turn prefix, primed with the whole conversation. One identical answer in all three.
  • six concurrent generations in flight, to vary batch composition. 12/12 identical.
  • thread counts 1, 2, 4, 8, 16. Identical at every one.
  • 15 full conversations: turn 2 carried 95 15/15 and the last turn named Paris 15/15.

The tie is specific to those runners, so the retry path is exercised by the offline guards above rather than against a genuinely diverging server, and I would rather say that than imply I watched it happen.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Aug 30, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-08-30T21:19:30.281257Z b45a248 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7b20043b80

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".



def check(label: str, first: list[str], second: list[str]) -> None:
def check(label: str, first: list[str], second: list[str], sent: list[list[dict]], ask) -> None:

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Update test callers for the expanded check contract

The existing unit tests still call check(label, first, second) throughout tests/studio/test_smoke_workflows_share_one_script.py (lines 71–132), so making sent and ask required causes five tests to fail immediately with TypeError before any smoke-test behavior is exercised. Update those callers with captured requests and a fake asker, along with their now-changed assertions, or preserve a compatible testable entry point.

Useful? React with 👍 / 👎.

Comment on lines +144 to +149
seen = {ask(messages).strip() for _ in range(REASK_TIMES)}
print(
f"[{label} turn {turn}] re-asked {REASK_TIMES}x: "
f"{len(seen)} distinct repl{'y' if len(seen) == 1 else 'ies'}"
)
return len(seen) == 1

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Reject empty responses during consistency re-asks

When the two initial runs diverge and the server subsequently returns no content for every retry—for example, after failing or becoming overloaded—this comprehension produces {''}, and self_consistent returns true because the set has one member. check then tolerates the divergence and can print OK, even though empty responses are treated as hard failures in the original runs; each re-ask should be required to contain non-whitespace content before it can establish reproducibility.

Useful? React with 👍 / 👎.

Comment on lines +211 to 214
assert "paris" in first[-1].lower(), (
f"{label}: the last turn must name the city from turn 3, so history reached the "
f"model. Its prompt contains no city name. Got {first[-1]!r}"
)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Validate history grounding in the second replay

When the final replies differ but the re-ask is stable—or any earlier accepted divergence makes later replies incomparable—only first[-1] is checked for paris. The second replay can therefore return London or another ungrounded nonempty answer and the smoke test still prints OK; previously the strict cross-run equality implicitly ensured that a grounded first reply meant the second was grounded too. Check the last reply of both transcripts independently so an accepted near-tie cannot hide history loss in the second run.

Useful? React with 👍 / 👎.

Comment on lines +211 to 214
assert "paris" in first[-1].lower(), (
f"{label}: the last turn must name the city from turn 3, so history reached the "
f"model. Its prompt contains no city name. Got {first[-1]!r}"
)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Match Paris as a word in the grounding assertion

The substring predicate also accepts unrelated replies containing those letters, most notably I cannot make a comparison without a city, because comparison contains paris. That is a plausible response from a history-dropping model to the context-free final prompt, so the new per-turn grounding check can still report success when no city was recalled; use a case-insensitive word-level match rather than an unrestricted substring.

Useful? React with 👍 / 👎.

`GGUF inference smoke` and the Mac inference lane have been red on main and on
essentially every open PR. They are two different failures on the same turn.

macOS is the assertion, not the server. #10009 moved history grounding onto turn
2, requiring the reply to restate turn 1's number. In the same run that turn 2
came back "You haven't provided the previous question.", turn 4 answered "The
capital of France is Paris." -- from a prompt reading "Repeat the city name",
which names no city, so history had arrived. Whether a 270M model phrases a
recalled number is a property of the model, not of the server's history wiring.

#10009's finding is real and stays: 'paris' in the JOINED transcript proves
nothing because turn 3 supplies it alone. Asserting the LAST turn, per turn,
closes exactly that gap on the turn that works. Sent that prompt with no history,
the model answers "Okay, I'm ready." -- measured against llama-server b10360 with
the UD-Q4_K_XL file the workflow loads, three times, plus 15/15 conversations
where the last turn named the city.

Windows is the older near-tie. Two replays are not two identical requests: each
turn is built from the reply before it, and the second replay meets the server
holding cache and slot state the first left behind, so a near-tied token can land
differently without decoding being broken. Both observed answers were correct.

The retry for that lives in main() and NOT in check(). check()'s contract is
unchanged: every divergence handed to it is still a hard failure, which is why
test_a_divergent_second_run_is_a_failure_not_a_warning passes here untouched.
That test exists because #5669 turned this into a printed warning on the Linux
leg and it went unnoticed for three months, and softening check() would have
walked straight back into it. The divergence now raises a Nondeterministic
subclass of AssertionError, so main() can retry that one failure and nothing
else, and existing pytest.raises(AssertionError) keeps matching.

Two guards from #10009 encode the turn-2 design and are updated with it, not
around it. Their replacements use the MEASURED history-dropping reply rather than
a hypothetical fixture, and a new one pins the macOS transcript as passing while
a last turn that cannot name the city still fails. Two more pin the retry itself:
a server that disagrees every time still fails and is bounded to ATTEMPTS, and a
non-divergence failure is not retried at all.

What I could not do: reproduce the Windows tie here. Prompt-cache state (cold,
2-turn, 4-turn primed), six concurrent generations, and thread counts 1 through
16 all gave one identical answer, 12/12 and 15/15. The tie is specific to those
runners.

tests/studio: 6630 passed, 195 skipped. Live end-to-end on the real GGUF passes.
verify_import_hoist, lint_exec_literals and lint_no_parallel_clamp clean.
@danielhanchen
danielhanchen force-pushed the fix/multi-turn-smoke-grounding-and-ties branch from bb5c265 to b45a248 Compare August 30, 2026 21:17

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b45a24877e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +183 to +186
for attempt in range(1, ATTEMPTS + 1):
try:
check(label, runner(), runner())
break

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Do not accept one matching retry as deterministic

When a genuinely stochastic server can produce either of two transcripts independently, each replay pair matches by chance with probability 1/2, so these three attempts return success 87.5% of the time despite non-deterministic decoding. Thus every workflow invoking this script can miss the regression this smoke test is intended to detect; the added test only covers an artificial runner guaranteed to differ on every consecutive call, not ordinary sampling where outputs can repeat.

Useful? React with 👍 / 👎.

@danielhanchen
danielhanchen merged commit cbf3fdf into main Aug 30, 2026
25 checks passed
@danielhanchen
danielhanchen deleted the fix/multi-turn-smoke-grounding-and-ties branch August 30, 2026 22:48
danielhanchen pushed a commit that referenced this pull request Aug 30, 2026
Picks up #10025's bounded replay retry in the multi-turn smoke, which is what the
two failing checks on this PR were missing.
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