Skip to content

CI: pass workflow_dispatch inputs to shell through env - #18969

Merged
danielhanchen merged 2 commits into
mainfrom
s1122c/U1/dispatch-inputs-env
Nov 23, 2026
Merged

danielhanchen merged 2 commits into
mainfrom
s1122c/U1/dispatch-inputs-env

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

kaggle-collect.yml pasted the free-text max_age_hours dispatch input straight into its run: script inside single quotes, in the same step that has KAGGLE_API_TOKEN in its environment, so a value like '; cmd; ' would run as shell. Only people with write access can dispatch the workflow, but it is cheap to close.

The input now goes through env:, is checked against ^[0-9]+([.][0-9]+)?$, and is passed as "$MAX_AGE_HOURS". Scheduled runs use the default (3) as before, and valid dispatches behave the same; a non-number already failed the script's float argument.

The same pattern is moved to env: in docker-publish.yml (unsloth_zoo_ref) and startup-profile-ci.yml (repeats). Neither has secrets in that step.

Test: tests/security/test_workflow_free_text_inputs_not_in_shell.py parses every workflow and fails on a string-typed input or a free-text event field (PR title / body, head_ref, label name, comment, client_payload) inside ${{ }} in a run: block.

kaggle-collect max_age_hours sat inside a shell script beside the Kaggle
token; docker-publish unsloth_zoo_ref and startup-profile repeats had the
same shape. Route them through env and validate max_age_hours as a number.
Add a test that fails on any string input or free-text event field
interpolated into a run: block.
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-23T01:27:54.215849Z ae0fc1e 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.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Already looking forward to the next diff.

Reviewed commit: ae0fc1ee22

ℹ️ 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 8af922e into main Nov 23, 2026
@danielhanchen
danielhanchen deleted the s1122c/U1/dispatch-inputs-env branch November 23, 2026 02:51
danielhanchen added a commit that referenced this pull request Nov 23, 2026
…VFP4 nested kernel, Kaggle input via env) (#19027)

## Summary

Four tests are red on `main` and fail on every PR whose staging run
includes them (seen on #18918, #18925 and #19000). Each was reproduced
on `main` before fixing. In all four the code under test is right and
the test is not.

| Failing test (shard) | Introduced by | Cause | Fix |
|---|---|---|---|
|
`test_diffusion_ddp_effective_precision.py::test_real_gloo_two_ranks[fp8,*]`
(`(Python 3.13, diffusion)`) | #18967 | The verdicts are right (`SAME`,
`REFUSED ...`), but gloo prints `[Gloo] Rank N is connected to 1 peer
ranks ...` on the child's stdout first, and the test required the output
to start with the verdict. | Read the verdict from the child's last
line. |
|
`test_diffusion_base_precision.py::test_resolve_auto_uses_klein_variant_size`
and `test_auto_sizes_flux2_klein_9b_off_its_own_weights[*]` (`(Python
3.13, diffusion)`): `'nf4' == 'fp8'` | #18967 | Near the 8-bit band (20
GB free against the 18.2 GB dense 9B), Auto's fp8 pick also checks host
RAM through `_auto_swap_host_ram_ok`, because that load holds the bf16
base on the host. The tests fake the GPU but read the runner's real RAM,
so a 16 GB CI runner gets `nf4` (correctly) and a large dev box gets
`fp8`. | An autouse fixture pins host RAM high, like the file's existing
`_not_rocm` pin, since these cases simulate GPU tiers. New
`test_klein_9b_near_the_8bit_band_falls_back_to_nf4_on_a_small_host`
pins the small-host fallback explicitly. |
|
`tests/test_nvfp4_qat_backward_skip.py::test_cpu_forward_kernel_is_restored_on_exit`
(`Repo tests (CPU, rest)`): `there's already a kernel registered from
python overriding nvfp4_qat_linear_v2's behavior for CPU` | #18864 | The
test enters `_cpu_forward_kernel(op)` inside the module-scoped `op`
fixture, which has already registered that kernel. torch 2.10 refuses a
second Python registration for the same op, key and namespace, so the
test fails on every run. | The `op` fixture is per test, and the restore
test takes the bare op (new `raw_op` fixture), so it checks a real
register-then-restore from a clean state. |
|
`tests/kaggle/test_fire_and_forget.py::test_every_gate_budget_covers_the_reaper_window`
(`Repo tests (CPU, rest-2)`): `the collector's default age ceiling is
not readable from the workflow` | #18969 | #18969 correctly moved the
dispatch input out of the script into `MAX_AGE_HOURS: ${{
inputs.max_age_hours \|\| '3' }}`, and the test's regex only knew the
inline form. | Read the default from either form, and when it is an env
var, assert that variable is what reaches `--max-age-hours`. |

Only tests change.

## Testing

- The four files: all red on `main`. With this change, 98 passed / 6
skipped (the two diffusion files) and 125 passed (the NVFP4 and Kaggle
files); `tests/kaggle/` as a whole: 1081 passed.
- Sabotage, each guard still catches what it is for:
- **gloo:** making `check_effective_precision` a no-op fails the
`REFUSED` case.
- **klein:** removing the host RAM gate from `_resolve_base_precision`
fails the new small-host test. Forcing a 16 GB runner over the whole
file fails the same 5 cases CI did, plus the new one.
- **NVFP4:** keeping the test library alive instead of destroying it
fails the restore test.
- **Kaggle:** a workflow default of `9` fails (it no longer matches
`collect.DEFAULT_MAX_AGE_HOURS`), and so does not passing
`$MAX_AGE_HOURS` to `--max-age-hours` (`MAX_AGE_HOURS never reaches
--max-age-hours`).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant