Repository navigation
Give the Studio T4 leg a Kaggle client that can read its own credential - #9535
Merged
Merged
Conversation
The gate is handed exactly one credential, KAGGLE_API_TOKEN, and nothing writes a kaggle.json. On kaggle 1.7.4.5 authenticate() cannot read that variable: it appears only in kagglesdk/kaggle_http_client.py, whose header says that client is not currently usable by the CLI, so authenticate() falls through to read_config_file() and raises IOError, which is OSError on Python 3. gate.py turns any error into a skip unless --no-soft-fail is passed, and a skip exits 0, so the workflow went green with the GPU job skipped, indistinguishable from the 95 percent of invocations the sampler declines. The leg had therefore never authenticated once since it was added. Pin 2.2.4, the version the notebook leg already uses, whose authenticate() tries _authenticate_with_access_token() first and reaches kagglesdk.get_access_token_from_env(). The notebook leg has carried a guard on this pin since it was written; this leg had none, so add the matching one.
danielhanchen
added a commit
that referenced
this pull request
Sep 1, 2026
) * Kaggle CI: use both accounts, weighted by their own weekly quota The Kaggle GPU workflows authenticated with one repo secret, KAGGLE_ACCESS_TOKEN_GH. That secret has been deleted and replaced by KAGGLE_API_TOKEN and KAGGLE_API_TOKEN_2, one account each. Nothing went red. gate.py answers a missing credential with a skip that exits 0 ("expected on a fork pull request, where secrets are withheld"), so both workflows have been a silent no-op with every check passing. That is the same failure #9535 fixed once already, arriving this time through a deleted secret rather than an unreadable client, so the first guard added here is the one that would have caught it: the set of Kaggle secrets a workflow may name is closed, and a name outside it fails the suite. WHICH ACCOUNT A run is drawn onto one account in proportion to the accounts' weekly allowances, so the bigger one takes proportionally more traffic. The weights are READ from each account's own quota_view() rather than written down, which is worth the one extra API call: a plan changed on Kaggle's side changes the split with nothing here to update. Measured over 200k synthetic run ids against 60h and 30h, the split lands at 0.6660 / 0.3340. The draw is keyed on the run id ALONE, not the attempt. A re-run of a run whose kernels are still in flight has to return to the account that holds them, because the other account cannot delete them. An account that cannot take the run hands over to the other rather than standing the run down. Both conditions are known before anything is pushed: the gate already reads exact remaining hours and already surveys busy sessions. Outcomes are structured codes rather than prose, because the fallback branches on them. FOUR THINGS THAT WOULD HAVE MADE THIS QUIETLY WRONG * The owner was hardcoded as `--user danielhanchen` on both launch paths. A kernel id is <owner>/<slug>, so the second account could not push under it and -- worse -- could not DELETE under it, turning a leaked session into a log line indistinguishable from a kernel already gone. The owner now comes from the authenticated client, and the launcher refuses to push when the name it was given and the token disagree. * `${{ cond && secrets.A || secrets.B }}` is not used, deliberately. An empty first secret makes the && falsy and the || hands over the OTHER account's token while every output still names the first. The gate publishes a one element matrix carrying the secret NAME and the job indexes the secrets context with it, which cannot express that state at all. No token is ever a job output. * The concurrency groups were account-wide, so with two accounts every run would still have queued behind every other one and the second account would have bought no capacity. They are now keyed on the chosen account: one notebook and one Studio kernel each, four sessions over two accounts, still two per account. * The reserve is now a fraction of each plan rather than a flat number of hours. 20h held back from a 30h account is two thirds of it against one third of a 60h one, which would have made the smaller account the stricter one on top of it already taking less traffic by weight. Studio also gains the queue-time recheck the notebook leg has always had, and its push is gated on the answer -- a measurement that cannot stop the push is a log line, not a control. With a 293-deep repo queue a gate answer is easily a whole run stale. TESTS tests/kaggle: 575 passed. 14 new guards, 14 of 14 mutations caught, including the deleted secret, the ternary, the flat reserve, the hardcoded owner, a sweep reaching across accounts and a re-run rerolling its account. A new tests/kaggle/conftest.py clears every Kaggle credential before each test. Found the hard way: with KAGGLE_API_TOKEN_2 exported on a dev box, the "a fork gets no secret" test authenticated to a real account and read that week's actual hours over the network. It failed for a right-looking reason, and would have PASSED had the quota been low. One test claim is deliberately narrower than it looks. The account draw is salted apart from the sampling draw, but the statistical test for that does not work and was tried: removing the salt moves the measured share of account 1 among sampled-in runs from a 0.0039 gap to a 0.0059 one over 200k ids, both inside noise, because %100 and %1000000 of one digest are independent enough. The test asserts the derivation instead, and says so. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
danielhanchen
added a commit
that referenced
this pull request
Sep 6, 2026
…op the scheduled collector lying green Review round on the dispatch-and-collect design. Every change here is a verdict that could be wrong, lost, or posted for a kernel that does not exist: - The scheduled collector pinned kaggle==1.7.4.5, whose authenticate() cannot read KAGGLE_API_TOKEN (#9535), so every pass failed to authenticate; and an auth failure was a green no-op. It now installs the 2.2.4 the GPU workflows install and passes --require-auth, which makes an auth failure red with an error annotation. A fork job without the secret still skips. - The collector deleted a kernel before its status was posted, so a transient GitHub failure lost the verdict for good and left the commit pending forever. Collection now runs with --no-delete, post_statuses.py posts (a shared script: every field is its own gh argument, the slug's 8-character sha is expanded first, an unresolvable commit is reported and released), and collect.py --delete-collected releases only the kernels whose status was delivered. The three copies of the shell loop are gone. - fetch_evidence reports a spent budget or a lost notebook by flag, not by raising, and the flag was never read: the short set was judged and the kernel deleted. An incomplete download now judges nothing and keeps the kernel for the next pass. - Three workflows collect on one account and nothing serialises them. A kernel that vanishes under a collector (the other one deleted it) is now `gone` and posts nothing, so the loser of that race cannot post an infra success over the winner's real failure. - The scheduled pass judged every kernel against --expect 1, so a five-payload kernel that lost four passed. The driver now writes the count it was built for into the kernel log (KAGGLE_T4_CI_DRIVER_EXPECT) and the collector reads it off the evidence, the only record that survives dispatch; a kernel without the sentinel keeps the caller's number. - A malformed T4_SMOKE_REPORT line (a list, a bare string) raised out of extract_reports before the collector wrote a result, wedging every later pass on the same evidence. The extractor skips non-object lines and the collector records an unreadable report as infra and releases the kernel. - The pending status was posted whenever launch.py exited 0, which it does for every infrastructure stand-down, so a run that pushed nothing left a pending check no collector could ever replace. Gated on the launcher's own verdict output being `dispatched`. - The Studio workflow passed a raw workflow_dispatch ref as --commit-sha; slug_name silently fell back to the legacy unattributable form and the kernel ran, billed, and reported to nobody. The workflow now resolves the ref the way the notebook one does, and launch.py refuses a non-hex commit in dispatch mode. - The account walk stopped at twice the reap ceiling, so a pass delayed past that (an Actions outage, a deep queue) never saw the wedge it exists for. Recognised kernels are never aged out; the walk is bounded by pages. - Two kernels for one commit under one context (notebook slot 1 and slot 2) posted two statuses and the last one won. One status per (sha, context), a failure wins, and both kernels are released when it is delivered. Also drops out/launch_result.json, a local run's scratch that was committed by mistake, and ignores /out/. Merges main; the Report Studio gate keeps both conditions (evidence present and the kernel carried Studio).
danielhanchen
added a commit
that referenced
this pull request
Sep 7, 2026
…ng a runner (#10183) * Kaggle CI: dispatch the kernel and collect it later, instead of holding a runner The GPU jobs waited for their Kaggle kernel in a poll loop: 41.5 minutes for the notebook leg and 18.7 for Studio, measured on runs 33479481067 and 33486360729, almost all of it a runner doing nothing while Kaggle worked. Against a repository queue measured at 400-670 deep that is two machines per commit spent waiting on a third-party service. They now push and exit. `launch.py --dispatch` leaves the kernel running and returns in minutes; the result is collected afterwards by two independent routes: the next GPU run on the same account collects before it dispatches, and `kaggle-collect.yml` does it on a schedule, which is what covers a quiet repository. The account is the queue. There is no artifact, branch or database between the dispatching job and the collecting one; the SLUG carries the commit and the workflow, so a collector rediscovers everything from Kaggle's own listing: unsloth-t4-ci-n1a2b3c4d-9f8e kind, commit, uniqueness The prefix is unchanged, because that is what the gate's session survey matches to tell our kernels from a human's, and with the GitHub concurrency group no longer bounding anything it is the only thing left counting sessions against Kaggle's 2-per-account cap. Four consequences that had to be designed for rather than discovered: - The dispatching job succeeds by DISPATCHING, so it can no longer mean "the GPU tests passed". The verdict is a commit status, kaggle-t4-notebook or kaggle-studio-gpu, posted against the sha in the slug. Branch protection must require those contexts and not the jobs. A pending status goes up at dispatch so a required check that has not reported reads as waiting rather than as nothing. `dispatched` is deliberately not `pass`. - Orphans bill. The pushing job used to delete on every path out; the scheduled collector replaces that, with a 3h reap ceiling well under Kaggle's 12. - A commit already in flight is not dispatched again. - Results land on the sha in the slug, never on HEAD. collect.py touches only kernels `parse_slug` recognises. It enumerates a shared account and deletes what it collects, so anything unrecognised is invisible rather than skipped-with-a-warning. Evidence is downloaded before any delete, and a download that fails leaves the kernel alone for the next pass. infra and partial verdicts stay green: a red the author cannot act on is how a required check gets removed. tests/kaggle 951 passed. 22 mutations, 22 caught. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Kaggle CI: do not report on a dispatch that has not run yet Run 33628507954 dispatched correctly and its summary still said ### Kaggle T4 smoke: PARTIAL ### Unsloth GPU smoke: PARTIAL The reporters were gated on `hashFiles('kaggle_evidence/**')`, which is TRUE on a dispatching run: launch.py writes launch_result.json into that directory before it exits. The reporters then read a directory holding no executed notebooks and print "half a comparison" for a kernel that is still queued. PARTIAL is not red, so this was not going to block anything, but it is a verdict about a run that has not happened, on the one workflow whose whole failure mode is a result that reads as something it is not. The condition now names the thing a report is made of. A dispatching run cannot have an executed notebook; a collected one always does. The guard was rewritten with the measurement in its docstring, because the version that shipped accepted exactly the state that produced this: it asserted the presence of the evidence DIRECTORY, which a dispatch creates and does not fill. Mutation-tested by restoring the directory check. * Kaggle CI: expand the slug's abbreviated sha before posting a commit status Found by driving the real collector against a real finished kernel and then running the workflow's own posting loop over what it emitted. The slug carries 8 hex characters of the commit, because a full 40-character sha plus the `unsloth-t4-ci-` prefix and the uniqueness suffix does not fit in the 50 characters `_slugify` produces. The statuses API refuses that: POST /repos/{owner}/{repo}/statuses/2ecb19df 422 "Sha must be a valid hex object ID" Measured against a real repository, not inferred. So every collected verdict would have 422'd, the `|| echo` beside the call would have turned that into a warning nobody reads, and the commit would have kept a PENDING check forever while the collection quietly succeeded and deleted the kernel. Collection working and reporting nothing is the precise failure this design exists to prevent, and it was one call from shipping. The dispatching side was unaffected and hid it: "Mark the dispatch pending" posts `steps.ref.outputs.ref`, which is the full sha, so the pending status appeared correctly on hardware and looked like proof that posting worked. Each posting loop now resolves the abbreviation through `gh api repos/{repo}/commits/{sha} -q .sha` and posts the result. A commit that no longer resolves -- a force-push while the kernel ran -- is REPORTED as a warning naming the sha and skipped, rather than dropped silently, since a silent skip is indistinguishable from a collection that found nothing. Two guards, three mutations, all caught: posting to the abbreviation, removing the lookup, and removing the unresolvable-commit warning. tests/kaggle 953 passed. * Kaggle CI: post before deleting, judge only complete evidence, and stop the scheduled collector lying green Review round on the dispatch-and-collect design. Every change here is a verdict that could be wrong, lost, or posted for a kernel that does not exist: - The scheduled collector pinned kaggle==1.7.4.5, whose authenticate() cannot read KAGGLE_API_TOKEN (#9535), so every pass failed to authenticate; and an auth failure was a green no-op. It now installs the 2.2.4 the GPU workflows install and passes --require-auth, which makes an auth failure red with an error annotation. A fork job without the secret still skips. - The collector deleted a kernel before its status was posted, so a transient GitHub failure lost the verdict for good and left the commit pending forever. Collection now runs with --no-delete, post_statuses.py posts (a shared script: every field is its own gh argument, the slug's 8-character sha is expanded first, an unresolvable commit is reported and released), and collect.py --delete-collected releases only the kernels whose status was delivered. The three copies of the shell loop are gone. - fetch_evidence reports a spent budget or a lost notebook by flag, not by raising, and the flag was never read: the short set was judged and the kernel deleted. An incomplete download now judges nothing and keeps the kernel for the next pass. - Three workflows collect on one account and nothing serialises them. A kernel that vanishes under a collector (the other one deleted it) is now `gone` and posts nothing, so the loser of that race cannot post an infra success over the winner's real failure. - The scheduled pass judged every kernel against --expect 1, so a five-payload kernel that lost four passed. The driver now writes the count it was built for into the kernel log (KAGGLE_T4_CI_DRIVER_EXPECT) and the collector reads it off the evidence, the only record that survives dispatch; a kernel without the sentinel keeps the caller's number. - A malformed T4_SMOKE_REPORT line (a list, a bare string) raised out of extract_reports before the collector wrote a result, wedging every later pass on the same evidence. The extractor skips non-object lines and the collector records an unreadable report as infra and releases the kernel. - The pending status was posted whenever launch.py exited 0, which it does for every infrastructure stand-down, so a run that pushed nothing left a pending check no collector could ever replace. Gated on the launcher's own verdict output being `dispatched`. - The Studio workflow passed a raw workflow_dispatch ref as --commit-sha; slug_name silently fell back to the legacy unattributable form and the kernel ran, billed, and reported to nobody. The workflow now resolves the ref the way the notebook one does, and launch.py refuses a non-hex commit in dispatch mode. - The account walk stopped at twice the reap ceiling, so a pass delayed past that (an Actions outage, a deep queue) never saw the wedge it exists for. Recognised kernels are never aged out; the walk is bounded by pages. - Two kernels for one commit under one context (notebook slot 1 and slot 2) posted two statuses and the last one won. One status per (sha, context), a failure wins, and both kernels are released when it is delivered. Also drops out/launch_result.json, a local run's scratch that was committed by mistake, and ignores /out/. Merges main; the Report Studio gate keeps both conditions (evidence present and the kernel carried Studio). * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Keep a kernel whose evidence would not download, and only release on a definitive missing commit A download failure in collect_one was judged "infra", which post_statuses turns into a green status and --delete-collected then releases. One transient listing failure became the permanent loss of a real result. It is now "pending": no status, not deletable, retried next pass. resolve_sha collapsed every failed lookup into "the commit is gone". GitHub answers a genuinely missing commit with HTTP 422 "No commit found for SHA" (measured); a 5xx or a rate limit says nothing about the commit. The lookup is now tri-state and only the measured answer releases the kernel; anything else lands in the poster's failed set, which keeps the kernel for the next pass. Tests: the download-failure case asserts pending, not in DELETABLE and no status; a transient lookup keeps the kernel; resolve_sha separates ok, missing and error. Both mutations caught. * Collect before the recheck, judge only known terminal states, and unpack the evidence where it lands Four collector defects and two workflow ones, all on the dispatched path. collect.py: a kernel in a state this collector does not know (Kaggle's enum has NEW_SCRIPT and can grow) fell through to the terminal path, which would have posted a green infra for a run still to come and deleted it. Only TERMINAL_OK and TERMINAL_BAD enter that path now; everything else is pending. A downloaded file that is valid JSON but not a notebook raised out of the expected-count reader, outside the report guard, so the collector wrote no result and stalled on that kernel every pass. Each kernel's evidence download is clamped to what is left of the pass budget, so the last kernel of a busy pass cannot carry a fifteen-minute collector past the twenty-five minute job. post_statuses.py: a 404 or 422 on its own no longer releases a kernel. A 404 is what a repository the token cannot see answers and a 422 what an ambiguous abbreviation answers; only GitHub's "No commit found" does. Workflows: collection moved in front of the recheck in both GPU workflows. It can spend up to fifteen minutes, and sitting between the recheck and the push it reopened exactly the stale window the recheck exists to close. The Playwright unpack step now reads kaggle_collected as well as kaggle_evidence, one kernel per call, since dispatch mode never writes the first tree; the scheduled collector, which collects most Studio kernels, gains the same unpack and an evidence artifact. Ten guards, four mutations caught. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Tighten comments Compress the prose added by this branch without losing any of the facts it records. The module docstrings in collect.py and post_statuses.py, the workflow headers in kaggle-collect.yml, and the dispatch-mode blocks in launch.py and the two GPU workflows are cut to the decision and its reason, dropping the restated background and the repeated explanations of post-then-delete ordering that appear in three files. Measured numbers stay: the 41.5 and 18.7 minute runner costs and their run ids, the 400-670 deep queue, the 2101.8s kernel, the 422 responses from the statuses and commits APIs, the 12 hour Kaggle kill and the two hour overrun behind the reap ceiling. Test docstrings in test_fire_and_forget.py and the two edited assertions in test_t4_smoke_harness.py are shortened the same way. No code, no argparse help text and no string literal is touched. * Write twelve hex characters of the commit into the slug, and fetch a full SHA before Studio dispatches it Eight characters is what two reachable commits can share. A shared prefix answers the commits API with a 422 on every pass, which the poster rightly treats as a retryable lookup, so the kernel is kept and the status stays pending forever. Slugs now carry twelve; eight is still read, since kernels pushed with the old form can outlive the change, and the in-flight check matches either length by prefix. --commit-sha requires at least twelve. The Studio workflow accepted a 40-character ref on shape alone. A mistyped or force-pushed-away SHA would spend a session, fail its pending status and be released by the collector as missing with no verdict ever posted. It now fetches the object before dispatching, as the notebook workflow already did. Three guards, three mutations caught. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Mark evidence incomplete when a listed notebook has no URL, merge old and new slug forms per commit, and stop the collector checkout persisting the job token A listed executed notebook that Kaggle offered no download URL for was skipped with truncated still false, so the short evidence set was judged, posted and its kernel deleted. It now marks the evidence incomplete, which keeps the kernel for the next pass like any other lost notebook. Statuses are aggregated on the eight characters every slug form shares. A kernel pushed with the old eight-character slug and one with the twelve can name the same commit in one pass, and keyed on the full prefix they posted as two commits with the last one landing deciding the required context. The merged status carries the longest prefix. The scheduled collector's checkout now sets persist-credentials false, as the GPU workflows already do: it holds the Kaggle token, and only the posting step is meant to have GH_TOKEN. Three guards, three mutations caught. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Merge statuses only for one commit, bound the release phase, and stop telling the reader to require a sampled context Aggregating on a fixed eight-character key merged two commits that merely share those characters, which is the collision the twelve-character slug was extended to avoid: one commit lost its verdict and its kernel was deleted as delivered. Statuses now merge only when one sha is a prefix of the other, which is what an old and a new slug for one commit look like. delete_kernel allows three 180-second attempts per kernel, so a release after a full collection could outlive the job and be killed mid-delete. The release phase now stops at RELEASE_BUDGET_SEC and leaves the rest for the next pass, and the collector's timeout covers collection plus release. The comments that said branch protection must require the kaggle contexts were wrong: the gate samples and the workflows path-filter, so a skipped commit never gets a status, and a required context that never arrives blocks the merge. They now say so. Four guards, three mutations caught. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Clamp every delete to the release deadline, key the account draw on the commit, and upload the collector's evidence once delete_kernel takes the deadline it is run under: each attempt is clamped to what is left and none starts past it, so the release phase ends when it says it will rather than up to three attempts later. The release step and both in-pass deletes hand it the pass deadline. The account draw is keyed on the commit under test rather than the run id. A second Actions run on one commit (a label added while a sampled run is out, a forced dispatch) could land on the other account, whose collector cannot see the first account's kernel, and dispatch a duplicate session. Both gate jobs pass --head-sha; without one the draw falls back to the run id as before. kaggle-collect.yml carried two artifact uploads, the second without continue-on-error, so an artifact outage failed a pass whose statuses were already delivered. One upload remains, best-effort, covering everything collected. The summary now reads delete_result.json, since the collect step runs --no-delete and its own deleted flag is always false. Four guards, four mutations caught. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Stand the gate down when any account already runs this commit, keep kernels whose status record was rejected, and start the collection budget before the listing The account draw is keyed on the commit, but a handover (the preferred account full or unreadable) lands a retry on the other account, whose GPU job collects with only its own token and sees nothing in flight. The gate surveys every account it considers, so it now asks each one whether a kernel of this workflow's kind is already running this commit and stands the run down if so; both gate jobs pass --kind. The release step kept only the slugs whose post was refused. A record the poster rejected as malformed was never posted either, and its kernel was deleted with the only evidence. Rejected slugs are kept too. The pass budget started after the kernel listing, which can take minutes of slow pages on its own; it now covers the listing as the job timeout was sized to. Three guards, three mutations caught. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Kaggle CI: survey every account before choosing, merge statuses by resolved sha, unknown plan is never a pass gate.py: every candidate account with a readable quota is surveyed for a kernel of this commit and kind BEFORE the selection loop picks one. The selection loop used to check only the account it was about to choose and returned on the first clear one, so a retry that found the preferred account free again dispatched a duplicate while the other account was still running the commit. Surveys are taken once per account and reused by the selection loop. collect.py / post_statuses.py: the collector no longer merges statuses whose shas are merely prefix-compatible. Whether an eight-character slug and a twelve-character one name one commit is a question only the commits API can answer, so post_statuses resolves every sha to its full form first and merges per (full sha, context) there, failure winning, slug lists unioned. collect.py: a notebook kernel with no KAGGLE_T4_CI_DRIVER_EXPECT line has an unknown plan rather than the caller's default. A failing report still fails; a clean set is reported as infra with the reason, so a kernel that lost legs cannot read as a pass. Studio kernels carry one report and keep the default. Guards: a gate driven end to end with stub surveys that reproduces the duplicate dispatch, both slug forms for one commit posting once, two commits sharing eight characters posting twice, and the unknown-plan verdicts. Each mutation-tested. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Kaggle CI: key the gate on the tested commit, honour slot 2, sweep every client, cover the reaper window gate.py: `--slot`. Slot 2 is the documented opt-in for a second session on the same ref beside slot 1, so a kernel already running the commit is the point rather than a duplicate and no longer stands the run down; the notebook GPU job likewise withholds the sha from the collector's in-flight check on slot 2. The cross-account sweep asks every account with a usable client, whatever its launch eligibility: the account that just dispatched the commit is exactly the one likely to be short of quota, and skipping it handed the retry to the other account. All the surveys share ONE budget, so two slow accounts cannot outlive the job. Both workflows: the gate job names the commit the GPU job will test, resolving `unsloth_ref` the same way the GPU job does, instead of keying on github.sha; the gate job timeout is 15 minutes for the two-account worst case, asserted from the constants. Studio: `--budget-hours 4`. The kernel ceiling stopped being the worst case when the job stopped deleting its own kernel; a kernel that ignores its timeout is left to the collector's 3h age ceiling plus its schedule and job timeout, derived in the test for both legs. The evidence unpack is best effort like its siblings, and collect_evidence.py no longer raises on JSON that is not a notebook. Every guard mutation-tested. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Kaggle CI: the slot is part of a kernel's identity, the listing walks to a horizon, a reaped kernel is released not deleted launch.py / gate.py / collect.py: a slot-2 kernel carries its slot in the slug (`-2<uid>`; absent means slot 1, so every earlier slug still reads), and the in-flight check in the gate and in the collector matches on commit, kind AND slot. Slot 2 is a deliberate second session beside slot 1, so a slot-1 kernel no longer counts against it, while a retry of the slot-2 run itself, after its dispatcher exited with the kernel still up, is recognised as the duplicate it is. The unconditional slot-2 bypass is gone; the notebook workflow passes the slot to the gate, the collector and the launcher. collect.py: the account walk is no longer capped at five pages from page 1 every pass. The account is shared and human kernels are never deleted, so enough newer records above an uncollected kernel of ours made it unreachable forever. The walk now ends at the first page that is entirely older than a seven-day horizon with none of ours on it, at the pass deadline, or at a fifty-page backstop. collect.py: a reaped kernel's status says it is released for deletion, and says it was deleted only after a confirmed delete; the workflows collect with --no-delete and delete in a later step that can fail. Eight mutations caught. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Kaggle CI: the GPU job tests the commit the gate resolved, a malformed notebook cannot hide a failing report, an absent second account is not a broken one Both workflows: the gate job resolves `unsloth_ref` once and exports the commit; the GPU job's "Resolve the ref under test" takes that answer and keeps only the reachability fetch. Resolving a moving branch a second time after the job queued could name a commit the gate never keyed the account draw or the in-flight check on, and that commit's own run may already be out on the other account. The executable resolve tests now drive the gate's step for every shape of ref and the GPU step for the handoff, the empty answer and an unreachable commit. launch.py: extract_reports skips a notebook that is not an object and any cell or output that is not one. One malformed file used to raise out of the reader after a failing report had been parsed from its neighbour; the collector then replaced every report with none, judged the kernel infra, posted success and released it. collect.py: under --require-auth an EMPTY token is an unconfigured account, warned about and green, because the scheduled collector's matrix is static and a repository with one Kaggle account leaves the second secret unset. A token that is present and refused is still red. Every guard mutation-tested. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Kaggle CI: tighten comments Shorten the comments and docstrings the dispatch and collect work added across the launcher, the gate, the collector, the poster, the three workflows and the Kaggle tests. Wording only: no code, no assertions and no argparse help text changed, and the whole tests/kaggle suite still passes. --------- Co-authored-by: danielhanchen <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The Kaggle Studio GPU leg has never run on a T4. Not sampling, not quota: it cannot authenticate, and the failure reports green.
What happens
The gate is handed exactly one credential,
KAGGLE_API_TOKEN, and nothing in the workflow or under.github/scripts/kaggle_t4_ciwrites akaggle.json.On
kaggle==1.7.4.5,authenticate()cannot read that variable.KAGGLE_API_TOKENappears only inkagglesdk/kaggle_http_client.py, whose own header says:So
authenticate()falls through toread_config_file()and raisesIOError('Could not find ...'), which isOSErroron Python 3.That error is then swallowed.
gate.pyturns any error into a skip unless--no-soft-failis passed, and a skip exits 0:Neither Kaggle workflow passes
--no-soft-fail, so the run is green with the GPU job skipped, which looks exactly like the roughly 95 percent of invocations the 5 percent sampler declines.Evidence
Dispatched with
force=trueto bypass the sampler, run32605377065:Scanning back 500 runs of this workflow, no
Studio GPU smokejob has ever completed. The few that leftskippedwere cancelled at 0m. The notebook leg, which pins2.2.4, ran a real T4 to completion on 2026-08-16 in 11 minutes.The fix
Pin
2.2.4, the version the notebook leg already uses. Itsauthenticate()tries_authenticate_with_access_token()first, which reacheskagglesdk.get_access_token_from_env():Verified by downloading both wheels rather than from memory.
tests/kaggle/test_t4_smoke_harness.pyhas guarded this pin for the notebook leg since it was written, and its docstring already names this exact failure: "authenticate() on 1.7.4.5 refuses KAGGLE_API_TOKEN, the only credential this workflow has, and demands a kaggle.json nothing writes." That guard readskaggle-t4-notebook-ci.ymlonly. This leg had no equivalent, which is how it sat on 1.7.4.5. This adds the matching guard totests/kaggle/test_studio_gpu_harness.py.Verification
tests/kaggle/test_studio_gpu_harness.py: 140 passed.Mutation, reverting the pin to
1.7.4.5:kaggle==1.7.4.5kaggle==2.2.4Not addressed here
An error-class gate skip still reports green. That is deliberate for pull requests, since an error in the gate says nothing about the code under test, but it does mean a dead credential is invisible until someone dispatches a forced run and reads the gate log. Worth a follow up, and it is a behaviour change to
gate.pyshared by both legs rather than a pin bump, so it does not belong in this one.