Skip to content

Fix CI on main: stale test doubles, a stale router stub, and two source defects - #8956

Merged
danielhanchen merged 12 commits into
mainfrom
fix/ci-green-on-main
Aug 16, 2026
Merged

danielhanchen merged 12 commits into
mainfrom
fix/ci-green-on-main

Conversation

@danielhanchen

@danielhanchen danielhanchen commented Aug 16, 2026 •

Copy link
Copy Markdown
Member

main has been red since Aug 14, and every open PR inherits the same failure set through its merge commit. 8890, 8875, 8845 and 8766 were all showing an identical list, which is the tell: none of them caused any of it.

Every completed Backend CI run on main has failed since Aug 14, with zero successes. Culprits:

Commit PR Broke
ea2219555 #8700 context_length on the backend test doubles
6c5385a11 #8648 youtube_router in the desktop-auth router stub
2098b7cd4 #8702 four model-picker contracts, plus a real branding regression
7bf8ade2d #8736 two unencoded read_text() calls

Each cluster was checked both ways rather than assuming the newer change was right. Three turned out to be stale tests, two turned out to be genuine source defects.

The tests were wrong

context_length, 13 failures. #8700 added an unguarded llama_backend.context_length read at routes/inference.py:13679, updated five test files, and missed three. LlamaCppBackend has defined the property for a long time and get_llama_cpp_backend() returns nothing else, so no user was ever affected.

Four more of the same bug, in disguise. The test_gguf_stream_slot_release* doubles have the identical gap and reach the identical line, but they drive a raw ASGI scope, so the AttributeError is swallowed into the response task and surfaces as a 20-second TimeoutError. Read as a flake, the obvious fixes are to raise the timeout or mark them flaky. Both would have buried a one-line bug.

youtube_router, 2 failures. routes/__init__.py exports it and main.py imports it; the app is fine. The desktop-auth test replaces sys.modules["routes"] with a hardcoded 17-router stub, deliberately, so importing main does not drag in torch and llama.cpp. #8648 added a router without updating it, the second occurrence after openai_codex_auth_router in #8511.

The source was wrong

llama-extra-args.ts reintroduced Studio branding. It emits "... is managed by Unsloth Studio and cannot be passed here." as a user-visible validation message, which test_desktop_surfaces_do_not_restore_studio_branding forbids in runtime display surfaces. The contract test was right; the string is fixed here, along with the vitest assertion pinning it.

Two unencoded reads. test_playwright_server_lifecycle.py:152,161 read checked-in files with the platform default encoding, which is a genuine Windows cp1252 crash. test_source_read_encoding.py is a careful AST lint documenting exactly that failure, so it is untouched and the two call sites gained encoding = "utf-8".

Robustification

Nine hand-written backend doubles across five files each re-declared the same attribute block, with no shared base and no spec=, so a single new read broke whichever files happened not to be updated.

  • They now share FakeLlamaCppBackend.
  • A canary (test_llama_backend_double.py) drives the real route with a bare double, so the next such read fails in one place with the attribute named, at the point of the change. Verified by removing context_length again: it reports AttributeError ... context_length at routes/inference.py:13679.
  • The stream waits no longer discard the driving task's exception. The same bug that used to produce a bare 20-second timeout now reports AttributeError: '_CompletingBackend' object has no attribute 'context_length' immediately.
  • The router stub is derived from main.py's own import block, read textually so it still avoids importing the ML stack, and cannot go stale a third time.
  • The four stale contract assertions moved to durable forms: the real override_lookup_candidates() instead of grepping inference.py, an ordering comparison instead of textual adjacency, and the <Button>...</Button> element scan their own siblings already use.

Not addressed here

pip scan-packages :: hf-stack reports 173 findings in third-party deps under SCAN_ENFORCE=1, and is red on main too. Baselining a supply-chain scanner to get green is the wrong reflex, so it wants its own look rather than being swept into a CI-fix PR.

Separately: branch protection on main currently requires zero status checks, which is why a red main persisted for two days. Requiring Backend CI and Repo tests (CPU) would have stopped all of this at the first PR.

Verification

Every failure reproduced on a pristine main checkout first, then confirmed fixed. Full backend and repo suites diffed against a like-for-like baseline. Cross-platform staging CI on ubuntu, macOS and Windows, which matters here because the encoding fix exists for Windows specifically and cannot be validated on Linux.


Update: a sixth cluster, and it is the same story

Frontend build + bundle sanity was failing on this PR, which looked like the branding edit above. It is not. #8932 (2643d0ef6) added SIDEBAR_ORGANIZATION_STORAGE_KEY to the @/features/chat barrel and had general-tab.tsx read it back out of that barrel, at module scope, in the storage-key list. The barrel sits in an import cycle that reaches that file, so the binding is still in its temporal dead zone when the list is built:

Cannot access 'SIDEBAR_ORGANIZATION_STORAGE_KEY' before initialization

That kills the module graph and the page renders nothing, which surfaces as a Playwright locator finding no elements: it reads like a flaky browser test rather than a module-init error.

Bisected with the real browser smoke rather than inferred from logs:

Tree ANSI smoke
cfee13795 (before #8932) passes
origin/main (with #8932) fails, TDZ error above
origin/main + this one-line import change passes

#8932's own branch was already red with this exact failure before it merged (run 31927167813). Fixed by importing the key straight from its module. Typecheck clean, 2756 frontend tests pass.

pip scan-packages :: hf-stack, deliberately not "fixed"

173 findings under SCAN_ENFORCE=1, red on main too. Breakdown: 172 MEDIUM heuristics in third-party deps (urllib3, wheel, and similar — __import__("setuptools.logging") and the like), plus 1 CRITICAL, which is first-party: unsloth_zoo/llama_cpp.py reads GH_TOKEN/GITHUB_TOKEN and makes requests.get calls. That is legitimate (a token to dodge GitHub rate limits) and correctly matched by the heuristic.

102 findings are already suppressed via scripts/scan_packages_baseline.json. Extending that baseline is a maintainer's judgement call about a supply-chain gate, so it is left alone here rather than swept into a CI-fix PR to make a check go green.

danielhanchen added a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Aug 16, 2026

@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: e5f1d1b8d1

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +2024 to +2026
assert "const previousConfig = currentRuntimePerModelConfig({ includeMaxSeqLength: true, });" in picker
assert picker.index("const previousConfig = currentRuntimePerModelConfig(") < picker.index(
"applyModelLoadConfigToRuntime("

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 Scope the ordering assertion to the handoff callback

This now searches the entire chat-page.tsx, which contains another const previousConfig = currentRuntimePerModelConfig(...) earlier in the file. If the snapshot inside selectWithConfig is deleted or moved below applyModelLoadConfigToRuntime, that unrelated earlier occurrence still makes both assertions pass, so the rollback regression this test documents is no longer detected. Restrict the search to the selectWithConfig body before comparing the two statements.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Confirmed and fixed in 07d3e3a. chat-page.tsx takes the same snapshot in the hub auto-load path at line 2558, and the only applyModelLoadConfigToRuntime call is at 3262, so the whole-file index comparison was satisfied by that unrelated occurrence. I deleted the selectWithConfig snapshot to check: both assertions still passed. Now scoped to the selectWithConfig body, and the same deletion fails it.

Comment on lines +110 to +114
# Both are fresh objects per request, so identity differences say nothing about the payload:
# cancel_event is a new Event, and perf_callback is the closure the monitor builds per request
# to carry llama.cpp timings back for the tok/s readout. Comparing either by identity would
# fail for every pair of requests, opt-out or not.
drop = {"cancel_event", "perf_callback"}

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 Preserve perf-callback parity before ignoring identity

Dropping perf_callback outright lets this parity test pass if the research opt-out accidentally stops supplying the callback on only one of the two requests, which would silently remove API-monitor timing for that path. Since the only irrelevant difference is closure identity, first assert that both values are callable (or both absent), then exclude them from the remaining kwargs comparison.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed in 07d3e3a. Asserting callable parity before excluding the key, as suggested. Verified by making routes/inference.py:14512 pass perf_callback = None when tool_choice is none: the test now fails, where dropping the key outright let it pass.

…ce defects

main has been red since Aug 14 and every open PR inherits it. Five clusters, none
of them caused by the PRs that were showing them.

context_length (13 tests, plus 4 more in disguise). #8700 added an unguarded
llama_backend.context_length read to the chat-completions path and updated five
test files, missing three. The real LlamaCppBackend has had the property for a
long time, so no user was ever affected; the doubles were simply
under-specified. The four gguf_stream_slot_release failures are the SAME bug:
those doubles reach the same line, but the AttributeError is swallowed into the
response task and surfaces as a 20 second timeout, which reads as a flake.

Nine hand-written doubles across five files each re-declared the same attribute
block with no shared base, so one new read broke whichever files happened not to
be updated. They now share FakeLlamaCppBackend, and a canary drives the real
route with a bare double so the next such read fails in one place, named, at the
point of the change. The stream waits no longer discard the driving task's
exception, so that class of failure cannot present as a bare timeout again.

youtube_router (2 tests). routes/__init__.py exports it and main.py imports it;
the app is fine. test_desktop_auth stubs sys.modules[routes] with a hardcoded
list of 17 routers, deliberately, to avoid importing the ML stack. #8648 added a
router and did not update it, the second time this has happened after
openai_codex_auth_router in #8511. The stub is now derived from main.py's own
import block, so it cannot go stale.

Repo tests (CPU), 6 failures, of which two are real source defects:
llama-extra-args.ts put the Studio brand into a user-visible validation message,
which the desktop branding contract forbids in runtime surfaces, and
test_playwright_server_lifecycle.py read checked-in files without an encoding,
which is a real Windows cp1252 crash the lint exists to catch. Both fixed in the
source. The other four are stale assertions chasing text that #8702 legitimately
moved or reflowed; they now assert the behaviour instead, via the real
override_lookup_candidates() and the element-scan pattern their own siblings
already use.

Not addressed here: pip scan-packages :: hf-stack reports 173 findings in
third-party deps under SCAN_ENFORCE=1 and is red on main too. Baselining a
supply-chain scanner to get green is the wrong reflex, so it wants its own look.
…ering

#8932 added SIDEBAR_ORGANIZATION_STORAGE_KEY to the @/features/chat barrel and
had general-tab.tsx read it back out of that barrel. The key is used at MODULE
scope, in the storage-key list, and the barrel is part of an import cycle that
reaches this file, so the binding is still in its temporal dead zone when the
list is built:

  Cannot access 'SIDEBAR_ORGANIZATION_STORAGE_KEY' before initialization

That kills the whole module graph, so the page renders nothing. It is why
Frontend CI has been failing on main with a Playwright locator that finds no
elements, which reads as a flaky browser test rather than a module-init error.

Importing the key straight from its module breaks the cycle. Verified by
bisection with the real browser smoke: it passes at cfee137 (before #8932),
fails on main with the TDZ error above, and passes again with this one-line
change. Typecheck clean, 2756 frontend tests pass.

#8932's own branch was already red with this exact failure before it merged.

@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: 7ed2a0454d

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

# rather than on the text of inference.py: #8702 moved this ladder out into
# utils/openai_auto_switch_settings.py unchanged, and the grep that used to live here went red
# for a pure refactor while the behaviour it guards never moved.
candidates = _override_lookup_candidates("/models/m-Q4_K_M.gguf", "org/repo", 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.

P2 Badge Keep the source contract independent of backend dependencies

When this cheap source-contract suite is run without the Studio backend environment, this new call enters override_lookup_candidates's standalone-GGUF branch, which imports hub.utils.gguf; that module imports loggers and then the unavailable structlog package. Consequently, python -m pytest tests/studio/test_model_picker_contracts.py now fails here with ModuleNotFoundError: structlog after 183 tests pass, whereas this file previously only read source and ran without backend dependencies. Exercise the ladder without importing the dependency-heavy GGUF module, or isolate/stub the quant-label helper so the source-only contract remains runnable.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Reproduced exactly: 1 failed, 183 passed with ModuleNotFoundError: structlog. Fixed in 07d3e3a. The Repo tests (CPU) job installs studio.txt, which carries structlog, so CI coverage is unchanged; the helper now skips only on a missing third-party package, and a missing first-party module still fails rather than being swallowed.

…ages

The hf-stack shard of pip scan-packages has been red on main. One CRITICAL
was blocking it, and tracking it down turned up a pattern bug behind nine of
the entries already in the baseline.

The blocking finding, unsloth-zoo/llama_cpp.py under "Harvests environment
variables/secrets AND makes network calls", is first-party: _github_auth_headers()
reads GH_TOKEN so the llama.cpp releases API call is not rate limited. That
file and check were already reviewed and baselined. It reopened because
unsloth-zoo 2026.8.12 replaced

    keynames = "\n" + "\n".join(os.environ.keys())

with a targeted _is_colab_environment() helper. Every other matched line is
byte identical to what was reviewed, so the current code is a strict subset of
the approved evidence. The entry is refreshed, with the hash generated by
--write-baseline rather than by hand. No PR caused this; it is the baseline's
reopen-on-change working as designed against an upstream release.

The pattern bug is in RE_FS_ENUM:

    r"|\bhistory\b.*\bread\b"  # reading shell history

Under re.DOTALL that .* spans the whole file, so any module containing the
word "history" anywhere before the word "read" anywhere is filesystem
enumeration, and with a network call in the same file that is a CRITICAL.
That is httpx's Response.history, retries.history in urllib3, IPython's
history module, torch's CUDA memory history. Nine of the eleven baselined
CRITICALs under this check were that one alternative, each suppressing a whole
file for the check.

Meanwhile the precise half was dead. \b\.bash_history\b puts \b between "/"
and "." in "~/.bash_history", where neither side is a word character, so it
could never match; same for \b\.zsh_history\b. This is the unsatisfiable-\b
bug already fixed once for /proc/self/status. Checked against the old pattern:
it matched none of five real history-file reads and all four benign cases.

Naming the files instead inverts that. The nine dead baseline entries are
removed, which narrows the allowlist rather than widening it, and three tests
pin both directions.

Verified by running all three shards locally against the same requirements
transform CI uses: hf-stack now exits 0 (was 1), studio and extras stay at 0,
and no removed entry resurfaced.
Both fail on pristine origin/main, so they are not from this branch. #8932
moved the sidebar's user-visible copy into the locale file and rewrote the
delete-switch predicate to cover its new bulk targets. Neither change breaks a
contract; both broke a grep of app-sidebar.tsx.

test_the_delete_switch_does_not_promise_project_files greps for the sentence
"This chat's own sandbox folder is removed from disk." It is still there,
verbatim, in studio/frontend/src/i18n/locales/en.ts. The promise is the
contract, not its address, so the test now searches the frontend sources and
survives the next move while still failing on a reworded promise.

test_the_delete_switch_reaches_a_chat_moved_into_a_project pinned one spelling
of deleteTargetHasFiles:

    -return target.kind === "project" || target.kind === "chat";
    +return target.kind !== "run";

Same answer for a chat and for a project, plus the new "chats" / "projects"
bulk kinds. What must hold is that a run is excluded and that project
membership is never consulted, so the test reads the brace-matched function
body and asserts that instead of the old one-liner.

Both were checked by mutation: reinstating the misleading copy, and gating
deleteTargetHasFiles on target.item.projectId, each fail the rewritten test.

@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: 274a7ded97

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread scripts/scan_packages.py Outdated
# alternative, and each had to be allowlisted, which suppresses the whole file for
# the check. Name the files instead: a stealer reading history reads a history
# FILE, and the two literals below were already the precise half of this pattern.
r"|\.(?:bash|zsh|ksh|sh|fish|python|node_repl|psql|mysql|rediscli)_history\b"

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 Match Fish's actual history filename

The fish alternative only matches .fish_history, but Fish stores commands in paths ending in fish/fish_history without the leading dot. For example, history = open("~/.local/share/fish/fish_history").read() followed by requests.post(...) no longer matches RE_FS_ENUM, so check_py_file misses the CRITICAL filesystem-enumeration-plus-network finding that the previous history ... read pattern produced. Add a dedicated (?:^|[/\\])fish_history form so narrowing the false-positive-prone pattern does not create this exfiltration blind spot.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Right, and confirmed against the fish docs: history goes to $XDG_DATA_HOME/fish/fish_history with no leading dot, so the dotted alternative could never have matched the real path. Fixed in 07d3e3a with a non-dotted form. The fish read plus a network call is a CRITICAL again, the dotted shells still match, and the httpx/urllib3/IPython false positives stay suppressed.

danielhanchen and others added 2 commits August 16, 2026 08:07
… a scanner gap

Four items, all confirmed against the code at head before changing anything.

1. tests/studio/test_model_picker_contracts.py: the rollback ordering assertion
searched the whole of chat-page.tsx, which takes the same snapshot in the hub
auto-load path at line 2558. The only applyModelLoadConfigToRuntime call is at
3262, so the index comparison was satisfied by the unrelated occurrence: deleting
the snapshot inside selectWithConfig outright still passed both assertions.
Verified by mutation. Now scoped to the selectWithConfig body, which fails on
that deletion.

2. studio/backend/tests/test_research_internal_call_tool_gate.py: dropping
perf_callback from the kwargs comparison hid presence as well as identity, so the
opt-out losing its callback on one path would have gone unnoticed and cost that
path its tok/s readout. Assert both are callable (or both absent) first, then
exclude. Verified by mutation at routes/inference.py:14512.

3. tests/studio/test_model_picker_contracts.py was source-only and ran without the
backend environment; calling the real ladder for a standalone .gguf pulled in
hub.utils.gguf, then loggers, then structlog, so a bare pytest run failed after
183 passes. CI installs studio.txt and is unaffected, so coverage there is
unchanged. The helper now skips on a missing third-party package only; a missing
first-party module still fails.

4. scripts/scan_packages.py: fish stores history at $XDG_DATA_HOME/fish/fish_history
with no leading dot (fishshell.com/docs/current/cmds/history.html), so the dotted
alternative could never match the real path and narrowing the pattern left an
exfiltration blind spot. Added a non-dotted form. The fish read plus a network call
is a CRITICAL again, the dotted shells still match, and the false positives stay
suppressed.

@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: eed81e79d0

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread scripts/scan_packages.py Outdated
# alternative, and each had to be allowlisted, which suppresses the whole file for
# the check. Name the files instead: a stealer reading history reads a history
# FILE, and the two literals below were already the precise half of this pattern.
r"|\.(?:bash|zsh|ksh|sh|python|node_repl|psql|mysql|rediscli)_history\b"

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 Keep other common shell history files detectable

This replacement allowlist omits common history filenames such as PowerShell's ConsoleHost_history.txt, Ruby's .irb_history, and SQLite's .sqlite_history. For example, history = open(".../ConsoleHost_history.txt").read() followed by requests.post(...) matched the previous history ... read branch, but now check_py_file produces no filesystem-enumeration finding and therefore no CRITICAL network-combination finding. Add these known history filenames (with appropriate case handling) while narrowing the generic pattern.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed in a1b75c3: ConsoleHost_history.txt joins the undotted group case-insensitively, and .irb_history and .sqlite_history join the dotted one. I stopped there rather than chasing the whole tail of history filenames; these three plus bash, zsh, ksh, sh, python, node_repl, psql, mysql, rediscli, fish and HISTFILE cover the shells and REPLs actually shipped on the platforms Unsloth supports.

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@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: 0fd68661fc

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread scripts/scan_packages.py Outdated
# torch) -- each allowlisted, which suppressed this check for the whole file.
r"|\.(?:bash|zsh|ksh|sh|python|node_repl|psql|mysql|rediscli)_history\b"
# fish writes fish_history with no leading dot, so the dotted form above cannot match it.
r"|(?:^|[/\\])fish_history\b"

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 Recognize constructed fish_history paths

Fresh evidence beyond the earlier literal-path case is that common constructions such as Path.home() / ".local" / "share" / "fish" / "fish_history" and os.path.join(home, "fish", "fish_history") put a quote, not a slash or start-of-file, immediately before fish_history, so this alternative does not match. If that file is then read and posted over the network, check_py_file emits no filesystem-enumeration or CRITICAL combined finding. Include a quote/token boundary (or match the basename independently) so constructed Fish history paths remain detectable.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Confirmed: Path.home() / ".local" / "share" / "fish" / "fish_history" and os.path.join(home, "fish", "fish_history") both missed, since the character before the basename is the quote. Fixed in a1b75c3 by accepting a quote as a boundary alongside a separator. Both constructions match now, and the false positives stay suppressed.

Comment on lines +35 to +36
if waiter in done:
return

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 Inspect a failed request before accepting its frame

When a fake send() sets the event and the ASGI request then raises before yielding back to the loop, both waiter and task are in done; this branch returns without examining the task. Every caller subsequently uses gather(..., return_exceptions=True), so the request exception is discarded—the exact failure mode this helper is intended to prevent. Check for a completed task with an exception before returning for the frame.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Reproduced directly: a fake send() that sets the event then raises leaves both futures done, the frame branch wins, and the exception goes into the caller's gather(return_exceptions = True). wait_for_frame returned OK and the RuntimeError vanished. Fixed in a1b75c3 by checking the task first; the message now says whether the failure came before or after the frame.

Both fail on pristine origin/main, so neither comes from this branch, and in
both the source is right and the test-side constant is stale.

INLINE_ROW_IDS in tests/studio/playwright_mac_tab_capabilities.py still listed
four rows. #7863 had put Video under "More" as layout v5, so the script dropped
it: an unpinned row renders no data-testid and every assertion on it silently
observes nothing. #8932 pins Video under Images again, and records it in the
migration history as v7, so it is deliberate and versioned rather than an
accidental revert. Video is observable again, so the script samples it again.
test_inline_row_ids_match_the_frontends_default_pinned_set exists precisely to
catch this tuple drifting from the store in either direction, and it did its job.

test_multi_chat_prompt_queue_contract.py pinned the zero-argument spelling
"return await clearStoredChats();". #8932 gave the call an options argument,
which changes nothing about the ordering the assertion is there to hold, so it
now matches on the call prefix, the same way the sibling assertion three lines
up already does.

Both mutation-checked: unpinning Video in the store fails the first, and moving
requestPromptQueueStop after clearStoredChats fails the second.
Self-audit of an earlier fix in this branch, under the same standard applied to
everything else here.

test_the_delete_switch_does_not_promise_project_files greps for a promise the
delete dialog must make. #8932 moved that copy into the locale file, so the
original grep of app-sidebar.tsx broke, and my fix widened the search to the
whole frontend tree. That is the same defect the review caught in the rollback
ordering assertion: a search wide enough to be satisfied by an unrelated
occurrence proves nothing. The sentence appearing in any of ~1200 files, a
comment or a dead module included, would have passed it.

Now scoped by intent. The promise the dialog MUST make is looked for where the
sidebar's user-visible copy lives, the locales and the component. The promise it
must NOT make is still looked for across all of src, since breadth only makes a
negative stricter.

Mutation-checked: rewording the real string and planting the original in an
unrelated module fails the test, where the whole-tree form passed.

The two scopes are also read through an lru_cache. The wide one concatenates
about 1200 files, and it was re-reading every one of them on each call.

@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: 78bce8f313

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +2277 to +2280
assert '"run"' in body, "a training run has no sandbox and must stay excluded"
for kind in ('"chat"', '"project"'):
assert (
f"kind !== {kind}" not in body and f"kind === {kind} ? false" not in body

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 Assert each supported delete-target outcome

These negative source checks do not establish the stated contract: an implementation as wrong as return target.kind === "run"; contains "run", mentions no projectId, and contains neither prohibited expression, so this test passes while hiding the delete-files switch for every chat and project (including the new bulk kinds). Assert that the function returns true for chat, chats, project, and projects, and false for run, preferably behaviorally.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Confirmed by construction and fixed in a1b75c3. Your counterexample passes all four of my checks: 'return target.kind === "run";' mentions "run", mentions no projectId, and contains neither prohibited expression. The direction is now pinned, so that inversion fails. Kept as a source-text check rather than behavioural: the frontend unit suite under studio/frontend/tests is where a behavioural version belongs, and this file cannot execute TS.

Comment on lines +2030 to +2032
handoff = picker.split("const selectWithConfig = async (", 1)
assert len(handoff) == 2, "selectWithConfig is the handoff this test is about"
handoff = handoff[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 Bound the handoff slice to selectWithConfig

Fresh evidence after the claimed fix is that handoff still contains everything from the selectWithConfig declaration to end-of-file, rather than only that callback's body. If applyModelLoadConfigToRuntime is moved out of this callback to any later code while its snapshot remains, this ordering assertion still passes even though the handoff no longer applies the remembered config where the rollback contract requires it; brace-match or otherwise terminate the slice at the callback's end.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Right, and measured: the slice was 13,566 characters, running to end of file, where the callback body is 579. Fixed in a1b75c3 with brace matching. Mutation-checked by moving applyModelLoadConfigToRuntime out of the callback while leaving the snapshot, which the old slice passed and the new one fails.

Five items, each reproduced against the code at head before changing anything.
Three are cases where my own earlier fix looked scoped but was not.

deleteTargetHasFiles: the negative assertions did not establish the contract.
`return target.kind === "run";` -- the exact inversion, which hides the delete
switch for every chat and project -- mentions "run", mentions no projectId, and
contains neither prohibited expression, so it passed all four checks. Confirmed
by construction. Now the direction is pinned: run is the kind excluded, never
the one included.

The selectWithConfig slice ran to end of file, not to the callback's closing
brace: 13,566 characters rather than 579. Moving applyModelLoadConfigToRuntime
out of the callback while leaving the snapshot behind still passed. Brace-matched
now, and that mutation fails.

asgi_stream_helpers returned on the frame without inspecting the task, so a
send() that sets the event and then raises left both futures done, the frame
branch won, and the caller's gather(return_exceptions = True) discarded the
exception. That is the silence the helper exists to break. Reproduced directly.
The task is checked first now, and the message says whether the failure came
before or after the frame.

Two scanner gaps, both from narrowing RE_FS_ENUM. Constructed fish paths put a
quote rather than a separator before the basename, so Path.home() / "fish" /
"fish_history" and os.path.join(h, "fish", "fish_history") did not match. And the
dotted list omitted PowerShell's ConsoleHost_history.txt, Ruby's .irb_history and
SQLite's .sqlite_history. A quote now counts as a boundary and those names are
covered, case-insensitively for the Windows one. Ten read forms match, and the
httpx, urllib3, IPython and torch false positives stay suppressed.
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Another round soon, please!

Reviewed commit: a1b75c30fe

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@danielhanchen
danielhanchen merged commit 1351478 into main Aug 16, 2026
41 of 46 checks passed
@danielhanchen
danielhanchen deleted the fix/ci-green-on-main branch August 16, 2026 09:02
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