Skip to content

Match the widened _stream_completion return in four stale assertions - #8120

Closed
danielhanchen wants to merge 4 commits into
unslothai:mainfrom
danielhanchen:fix/research-stream-usage-tuple
Closed

danielhanchen wants to merge 4 commits into
unslothai:mainfrom
danielhanchen:fix/research-stream-usage-tuple

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

Four assertions in test_research_runs_hardening.py still expect the 3-tuple _stream_completion returned before #7985 widened it to carry usage:

E   AssertionError: assert ('report', '', 'stop', None) == ('report', '', 'stop')
E   ValueError: too many values to unpack (expected 3)

Two compare against a 3-tuple, two unpack into three names. Most call sites in the file were updated with that change; these were missed.

Why it matters beyond this file

Backend tests runs on every Python in the matrix, so this is red on 3.10, 3.11, 3.12 and 3.13 for every open PR regardless of what that PR touches. Confirmed on two branches that share no files with this one and no files with each other: #8110 (tests/security/) and #8115 (tests/python/, tests/studio/) fail identically.

The change

The four sites, updated to the current arity. usage is None in these fixtures, so the added element is None in the comparisons and _usage in the unpacks.

Plus a guard, because nothing tied the two together and that is why the drift was invisible until CI ran. test_every_stream_assertion_matches_the_return_arity reads the tuple width from _stream_completion's own return annotation and checks every _run_stream comparison and unpack in the file against it. It counts only top-level commas, so the nested dict[str, int] does not read as two extra members, and it asserts that both shapes are actually present so it cannot pass vacuously.

Verification

  • tests/test_research_runs_hardening.py: 122 passed.
  • The guard fails on the pre-fix file: restoring one stale assertion turns it red, so it catches exactly the drift it is for.

@danielhanchen

Copy link
Copy Markdown
Member Author

Worth stating what this PR is blocking, because the reds across the open PR set are circular and none of them can clear alone.

Three repo-wide reds are in play, each fixed by a different PR, and each PR is red only because of the other two:

This PR currently sits at 25 SUCCESS with exactly one red, pip scan-packages :: hf-stack, which is #8110's. #8110 in turn is red on the four Backend tests failures this PR fixes:

assert ('report', '', 'stop', None) == ('report', '', 'stop')
ValueError: too many values to unpack (expected 3)

Those come from #7985 widening _stream_completion to return usage, which missed four call sites in test_research_runs_hardening.py. Nothing tied the return arity to the assertions, so it took CI to find, which is why this PR also adds a test that reads the arity off the signature and checks every _run_stream compare and unpack against it.

I verified the three together rather than assuming they compose: a staging branch carrying all three passes the full matrix. So the ordering is just a merge-order question, and this one is the cheapest of the three to take first, since it is four assertions and a guard test with no source change.

Confirmed locally on this branch: 122 passed in tests/test_research_runs_hardening.py.

@danielhanchen

Copy link
Copy Markdown
Member Author

main is red in three independent places right now, and each of these three PRs fixes exactly one of them, so every one of them still shows the other two as failures. Merging all three in any order turns main green; merging any one alone will not.

None of the three touches the others' files, so there are no conflicts between them.

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Aug 8, 2026
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🎉

Reviewed commit: 7b6dc24bce

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

Copy link
Copy Markdown
Member Author

Superseded by #8132, closing.

#8132 rewrote studio/backend/tests/test_research_runs_hardening.py, which is the file this PR existed to repair. Verified on a fresh worktree at 4e193139d with nothing of mine applied: that file passes, and so do the two Studio contract files that #8115 covered. 156 passed, 11 skipped across the three.

The three-way CI deadlock between this, #8115 and #8110 is therefore gone. #8110 has been rebased onto main and narrowed to the part that is still a real defect: five duplicated openai entries in the scan-packages baseline that #8135 did not touch.

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