Repository navigation
studio: trust local checkpoints during export - #10950
TaskPuppyNatani wants to merge 3 commits into
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e5cbe15b52
ℹ️ 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".
| // Checkpoint mode always resolves to a local Studio checkpoint. | ||
| // It may inherit custom model code from its base model, so allow | ||
| // that local code during export just like other local sources. | ||
| trust_remote_code: true, |
There was a problem hiding this comment.
Forward approval for trusted checkpoint code
When a checkpoint or its adapter base contains auto_map code that the scanner rates MEDIUM or HIGH, setting trust_remote_code now activates the backend consent gate, which rejects the load unless it receives the matching approved_remote_code_fingerprint. This branch omits that field, and the export page deliberately skips confirmRemoteCodeIfNeeded for checkpoint mode, so affected checkpoint exports terminate with remote_code_blocked without giving the user a way to approve and retry. Checkpoint mode needs to obtain and forward the fingerprint rather than sending only the trust flag.
Useful? React with 👍 / 👎.
|
Confirmed the checkpoint branch in studio/frontend/src/features/export/stores/export-runtime-store.ts omits trust_remote_code while the local model-source branch already sends true, so the backend default of False applies. Will get this reviewed. |
* Time the stall window test instead of counting polls 'a healthy read resets the stall window' fails on windows-latest on PRs that touch nothing near it. Seen on #10950 at 65/55, 64/43 and 62/50 reads, ratios of 1.18, 1.49 and 1.24 against a 1.25 bar, so the same healthy code both passed and failed inside one run. The measurement is the problem. The window is defined in time: the source keeps a lastHealthy stamp and gives up at Date.now() - lastHealthy >= stallMs. The test counted READS, which is that quantity divided by the cost of one poll, and poll cost is the noisiest thing in reach on a shared runner, about 1ms on Linux against about 15ms on Windows. The reset point was derived from a previous run's read count too, so any drift between the two runs moved the thing being measured as well as the measurement. Best-of-three and then majority-of-three were both attempts to average that away. Neither shrank the spread, because the spread is the measurement. So time the loop, and fire the healthy read on a clock rather than at a read index. The reset lands halfway through the window whatever a poll costs, and the signal becomes a difference rather than a ratio: the loop should outlast the plain one by about half a window. Jitter is bounded by one poll interval, ~15ms at worst against a 200ms signal. One sample of each now does what six could not, so the test is also 2.5x faster: 3285ms to 1282ms. Not vacuous, which the version it replaces admitted it was on Linux. Dropping the lastHealthy refresh from the source makes it fail here with 'it bought -1ms (400ms with a reset against 401ms without)'. * Tighten the comments added by this PR * Assert the stall window against the mechanism, not a second run Subtracting two separately scheduled runs re-imports the noise the previous commit set out to escape. An unrelated stall of 100ms or more is well within what a shared runner does, and it breaks the comparison in both directions: a stall during the baseline fails healthy code, and a stall during the other run passes code that never refreshes lastHealthy. The claim that jitter is bounded by one poll interval covered poll scheduling, not OS or event-loop stalls. So use one run and assert what the source actually promises: the window restarts at the healthy read, so the loop must survive a further full window from THAT moment. Both sides of the bound come from the same run, and a stall can only make the total larger, so the bound is one-sided and delay cannot fail healthy code. A stall can still hide a missing reset by inflating the total, so the run records the longest gap between two reads and skips when that gap gets close to the signal. A run that cannot tell the two apart reports no evidence rather than a verdict. One run rather than two also makes it 600ms, against 1282ms for the previous version and 3285ms for the one before that. Failure output is now exact rather than statistical: 'the loop ended 400ms in, having reported progress at 200ms, so it should have run to at least 600ms'. Verified by dropping the lastHealthy refresh, and passing 5 of 5 under 240 busy processes on a 192-core box. * Tighten the comments this PR added
|
General validation note for my open PRs: I’m no longer able to keep my primary machine pinned several versions behind, or repeatedly rebuild historical ROCm/Unsloth environments solely for PR testing. My current priority is restoring and maintaining a stable training setup, because training attempts are currently crashing my system and blocking normal work. Going forward, I can validate changes on my current working/supported local stack and provide logs or reproductions there. If a PR requires hardware validation on an older ROCm/Unsloth stack, that will need CI or another tester who already has an appropriate environment. If I later have dedicated isolated lab hardware available, I may be able to test older stacks there, but I will not hold back or destabilize my primary environment for PR validation. This does not withdraw the PR; it is a boundary on what version-specific hardware validation I can personally provide. |
* Time the stall window test instead of counting polls 'a healthy read resets the stall window' fails on windows-latest on PRs that touch nothing near it. Seen on unslothai#10950 at 65/55, 64/43 and 62/50 reads, ratios of 1.18, 1.49 and 1.24 against a 1.25 bar, so the same healthy code both passed and failed inside one run. The measurement is the problem. The window is defined in time: the source keeps a lastHealthy stamp and gives up at Date.now() - lastHealthy >= stallMs. The test counted READS, which is that quantity divided by the cost of one poll, and poll cost is the noisiest thing in reach on a shared runner, about 1ms on Linux against about 15ms on Windows. The reset point was derived from a previous run's read count too, so any drift between the two runs moved the thing being measured as well as the measurement. Best-of-three and then majority-of-three were both attempts to average that away. Neither shrank the spread, because the spread is the measurement. So time the loop, and fire the healthy read on a clock rather than at a read index. The reset lands halfway through the window whatever a poll costs, and the signal becomes a difference rather than a ratio: the loop should outlast the plain one by about half a window. Jitter is bounded by one poll interval, ~15ms at worst against a 200ms signal. One sample of each now does what six could not, so the test is also 2.5x faster: 3285ms to 1282ms. Not vacuous, which the version it replaces admitted it was on Linux. Dropping the lastHealthy refresh from the source makes it fail here with 'it bought -1ms (400ms with a reset against 401ms without)'. * Tighten the comments added by this PR * Assert the stall window against the mechanism, not a second run Subtracting two separately scheduled runs re-imports the noise the previous commit set out to escape. An unrelated stall of 100ms or more is well within what a shared runner does, and it breaks the comparison in both directions: a stall during the baseline fails healthy code, and a stall during the other run passes code that never refreshes lastHealthy. The claim that jitter is bounded by one poll interval covered poll scheduling, not OS or event-loop stalls. So use one run and assert what the source actually promises: the window restarts at the healthy read, so the loop must survive a further full window from THAT moment. Both sides of the bound come from the same run, and a stall can only make the total larger, so the bound is one-sided and delay cannot fail healthy code. A stall can still hide a missing reset by inflating the total, so the run records the longest gap between two reads and skips when that gap gets close to the signal. A run that cannot tell the two apart reports no evidence rather than a verdict. One run rather than two also makes it 600ms, against 1282ms for the previous version and 3285ms for the one before that. Failure output is now exact rather than statistical: 'the loop ended 400ms in, having reported progress at 200ms, so it should have run to at least 600ms'. Verified by dropping the lastHealthy refresh, and passing 5 of 5 under 240 busy processes on a 192-core box. * Tighten the comments this PR added
|
Hardware testing update: I’m planning to put Ubuntu on an NVMe so I can help with any additional validation you still need on these PRs. It’s going to take me a couple of days to get that environment set up, but once it’s ready I should be available for hardware-specific testing. |
|
Thanks for identifying the missing trust flag in checkpoint exports. This is now covered by #14722, which also handles the consent dialog and forwards the approval fingerprint. Closing as superseded. |
Summary
Fixes export of Studio-local checkpoints whose base model requires custom remote code.
In checkpoint mode, the export runtime already resolves the selected source to a local Studio checkpoint path, but the checkpoint
loadCheckpoint()request did not sendtrust_remote_code. As a result, a locally trained checkpoint could fail to reload for export when its base model depends on custom code.This PR makes the checkpoint branch explicitly send
trust_remote_code: true.The change is intentionally narrow:
sourceMode === "checkpoint"is affectedValidation
studio/frontend/tests/export-gguf-token-fallback.test.ts: 6/6 passedgit diff --check: cleanThe new regression deliberately supplies
modelSource: "hf"andtrustRemoteCode: falsewhile using checkpoint mode, then asserts that the emitted checkpoint load request still setstrust_remote_code: true. This pins the checkpoint invariant rather than relying on local-model defaults.Context
This was found while validating IFM/K2-Horizon Studio export end to end. The related IFM protocol support and generic Transformers tier-routing fixes are intentionally kept in separate PRs #10948 and #10949.