Skip to content

Studio: pin which rejection site the confirm-stream tests assert - #10284

Merged
danielhanchen merged 2 commits into
mainfrom
fix-confirm-stream-monitor-order
Sep 4, 2026
Merged

danielhanchen merged 2 commits into
mainfrom
fix-confirm-stream-monitor-order

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

(Python 3.13) is red on main at a12162ab5, on one test out of 37,035:

FAILED tests/test_openai_tool_passthrough.py::TestGgufVisionToolRouting::test_confirm_tool_calls_requires_streaming_for_gguf_tools
  ValueError: not enough values to unpack (expected 1, got 0)

tests/test_openai_tool_passthrough.py:4239: [entry] = monitor.snapshot()

The status code and the message assertions pass. Only the API monitor row is missing.

Two rejection sites, and nothing said which one runs

produce_openai_chat_completions refuses a confirm_tool_calls plus stream=false request in two places:

  • early, inside if _should_validate_before_switch():, so an invalid request never evicts the resident model. This returns before the monitor row is opened, so there is no row.
  • later, in the GGUF branch, through _reject, which fails the row that is already open.

_should_validate_before_switch() is _automatic_model_load_may_run() or _preview_slot_is_owned(). Both read process-wide state. The test never pinned it, so it asserted whichever site the rest of the xdist worker happened to leave reachable.

Forcing that predicate true reproduces the CI failure exactly, same line and same error:

tests/test_openai_tool_passthrough.py:4239: ValueError: not enough values to unpack (expected 1, got 0)

#10221 is not at fault

Its change is confined to charset handling in _fetch_url_raw, and there is no path from that to whether a monitor row exists in the chat completions route. What it did was add 17 parametrized cases, which changes how xdist packs its four workers.

That fits every observation. The twelve main commits before it are green on this check, it is red exactly at that commit, and the test passes alone, passes with its file serially, passes with its file under -n 4, and did not fail in a full local -n 4 run of the suite. It is a latent ordering flake that #10221 happened to shake loose.

The change

Pin the predicate and parametrize over both values, so each site is asserted deliberately rather than by accident. Pinning it is what the rest of the suite already does: five times in test_active_generations.py, and again in test_openai_auto_switch.py.

This is not only a determinism fix. The early site was previously reached by luck, so half of this behaviour was never asserted on purpose. It is now.

A second test had the same fragility, test_confirm_tool_calls_requires_streaming_for_safetensors_tools. A regex scan of the file missed it and running the file with the predicate forced found it, so both are fixed the same way.

Verification

The file, under both ambient conditions:

result
predicate left as the environment has it 360 passed
predicate forced true, which is the CI condition 360 passed

360 rather than the previous 358, from the two added parametrizations. Before this change the second column was 1 failed.

I also ran the whole backend suite with the predicate forced against an unforced run of the same suite, to find any other test resting on it. These two are the only ones.

One thing left alone

The two sites disagree about whether a rejected request is recorded at all, so the same 400 appears in the API monitor or does not, depending on whether an automatic load could have run. That is unrelated to #10221 and predates it. Recording a row at the early site changes what the monitor shows, which wants its own PR rather than being folded into an unblock, so this one documents the split instead of closing it.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 4, 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-09-04T04:42:32.191313Z 53546c2 Manual request
ℹ️ 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.

@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Sep 4, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Sep 4, 2026
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for security reviews. Please try again later.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep it up!

Reviewed commit: 53546c2ccf

ℹ️ 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".

@danielhanchen
danielhanchen merged commit 0bb033e into main Sep 4, 2026
33 checks passed
@danielhanchen
danielhanchen deleted the fix-confirm-stream-monitor-order branch September 4, 2026 04:58
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