Repository navigation
unsloth start: fix Studio discovery, proxy, Hermes context, Claude hooks and Codex login - #14591
Conversation
…gin issues - Discovery prefers this install's recorded Studio when the default port's server is not provably ours, and loopback requests skip any exported http_proxy. - No-model attach skips speech/separation models; relative --model paths are sent absolute; a conflicting inline variant warns. - Hermes: register the provider as unsloth-studio so unsloth/* ids keep their context pin, cap compaction at 90% of a small window, clear stale --persist pins. - Claude: exec-form hooks (no PowerShell parse failure on Windows without Git Bash), blank apiKeyHelper, merge a forwarded --settings. - Codex --as-subagent: hard-link auth.json when symlinks are denied, keep a first login. - dsh profile shorthand, comment-preserving JSONC --app edits, Pi Node warning, help/README lists.
|
@codex security review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b6e3169538
ℹ️ 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".
| and legacy.get("base_url") == provider["base_url"] | ||
| and set(legacy) <= {"base_url", "api_mode", "api_key", "models", "extra_body"} | ||
| ): | ||
| changes.append((("providers", _HERMES_LEGACY_PROVIDER), _APP_DELETE)) |
There was a problem hiding this comment.
Migrate the selected Hermes provider before deleting its entry
If the existing Hermes profile selects model.provider: custom:unsloth, this migration deletes providers.unsloth but leaves the selected provider unchanged: _hermes_app_target() only returns provider updates, unlike _set_hermes_provider(), which also updates model.provider. Consequently, running unsloth start hermes --app against a previously configured profile leaves its default model referencing a provider that no longer exists. Migrate the active provider reference along with the entry, or retain the legacy entry while it is referenced.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in fa5eee7: when the legacy entry is removed, a model.provider of custom:unsloth now moves to custom:unsloth-studio.
| if model and server is None and is_loopback_url(base) and _is_model_path(model): | ||
| if os.path.exists(os.path.expanduser(model)): | ||
| model = os.path.abspath(os.path.expanduser(model)) |
There was a problem hiding this comment.
Verify a shared filesystem before absolutizing model paths
When Studio is reached through an SSH tunnel or container port forward on loopback, a relative model path belongs to the server's filesystem, not necessarily this process's filesystem. If ./foo.gguf also exists locally, this code replaces it with the client's absolute path and sends that to the remote server, breaking a previously valid server-relative request. _attach_gguf_check() already distinguishes these cases using verify_studio_identity() before trusting local filesystem checks; apply the same safeguard here so forwarded servers retain their original paths.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in fa5eee7: the path is only made absolute after verify_studio_identity confirms the loopback server is this machine's Studio.
🛡️ Codex Security ReviewSecurity review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
… default off the old provider
|
@codex review |
1 similar comment
|
@codex review |
|
Codex Review: Didn't find any major issues. 🚀 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
… (follow-up to #14591) (#14635) Follow-up to #14591. ## What broke #14591 fixed a real Codex login problem under `unsloth start codex --as-subagent` on Windows: where symlinks are denied (no Developer Mode, no admin), the overlay copied `auth.json`, so a token refresh in the overlay left the user's real `~/.codex/auth.json` with a refresh token that had already been used. The fix replaced the copy with a hard link. The hard link was applied to every file in the user's Codex home, not only `auth.json`. Codex keeps its WAL-mode SQLite databases in `CODEX_HOME` (`state_5.sqlite`, `queue_1.sqlite`, `thread_history_1.sqlite`, the logs db, plus any `-wal` / `-shm` sidecars; `sqlite_home` defaults to `codex_home` in `codex-rs/core/src/config/mod.rs`). Hard-linking those gives the live database a second name. SQLite derives the `-wal` and `-shm` paths from the name it was opened under, so the overlay Codex and a plain `codex` (or the Codex app) running at the same time use different WAL and shared-memory files for one database. SQLite documents this as a corruption path: [How To Corrupt An SQLite Database File, 2.6 Multiple links to the same file](https://www.sqlite.org/howtocorrupt.html). Before #14591 those files were copied into the overlay, so the user's real databases were never touched. ## What changed - `write_codex_parent_overlay` hard-links only `auth.json` when symlinks are denied. Every other file is copied, as before #14591. Symlinks, junctions and the first-login dangling `auth.json` link are unchanged. - Regression test: with symlinks denied, `state_5.sqlite`, its `-wal` and `history.jsonl` land in the overlay as copies (not the same inode), while the existing test still shows a rotated `auth.json` refresh token reaching the user's home. The new test fails on current `main` and passes with this change. The rest of #14591 was audited and left as is: discovery, loopback proxy bypass, task-tagged model filtering, Hermes provider rename and `threshold_tokens`, Claude exec-form hooks (`args` landed in Claude Code 2.1.139), `apiKeyHelper` blanking, merged `--settings`, the dsh profile shorthand, JSONC splicing and the Pi Node warning (`legacy-node20` tag confirmed on npm). ## Verification - `unsloth_cli` suites for start, start_app, the Claude plan gate, inference_chat, mcp, and the Codex and Claude subagent bridges: 1206 passed, 2 skipped. - `ruff check` and the repo's ruff format on the changed files. ## Not tested here - Windows itself (NTFS hard links, symlink privilege denied). The test simulates the denied symlink the same way the #14591 tests do.
What changed
A sweep of
unsloth startfor bugs a normal user hits. Each fix has a regression test. Several were reproduced against the real agents: Hermes 0.21.0, Claude Code 2.1.307, dsh 0.2.1-rc.2 and PowerShell 7.6.Server discovery and HTTP
unsloth studiomoves to the next free port.unsloth startthen failed with "Couldn't verify that http://127.0.0.1:8888 is your Unsloth". Discovery now uses the server this install recorded whenever the default port's server can't prove it belongs to this install.unsloth chatandunsloth mcpshare this code, so they get the fix too.http_proxy. urllib proxies 127.0.0.1 unlessno_proxylists it. With a proxy exported, discovery failed, the health poll ran to the 900 s timeout, and the mintedsk-unsloth-key went to the proxy in plain text. Loopback requests now skip the proxy, whichunsloth studioalready does. Remote URLs still use it.Model selection
tasktag in the loaded-models listing. Before, Claude or Codex could be pointed at an Orpheus TTS model. If only such a model is loaded, the error now says so.--model ./foo.ggufis now sent as an absolute path, because a running server resolves paths against its own working directory.--model repo:Q8_0 --gguf-variant Q4_K_Mused to drop the inline variant silently. It still prefers the flag, and now prints a warning.--no-launcherror. With no server running,--no-launch --model Xnow says that--no-launchnever starts one.Hermes
unsloth-studioinstead ofunsloth. Hermes strips a<provider>/prefix from model ids, which turnedunsloth/Qwen3-0.6B-GGUFintoQwen3-0.6B-GGUF. The id then no longer matchedmodel.default, so Hermes ignored the pinnedcontext_length. Models under 64K were refused outright ("below the minimum 64,000"), and larger ones lost the pin. An earlierproviders.unslothentry written by Unsloth is removed, both in the session home and with--app. A user's own entry is left alone.compression.threshold_tokensnow caps compaction at 90% of the real window (36,864 for 40,960).--persist. A home kept with--persistno longer carries small-window settings into a later run with a larger window.Claude Code
command+args, Claude Code 2.1.139+), so no shell parses them. Without Git Bash, Claude Code runs shell-form hooks in PowerShell, which can't parse"python.exe" -c .... Since 2.1.299 a failing guard blocks the call, so--as-subagentcould never callunsloth_agent. Older builds keep the shell string.apiKeyHelperno longer runs. The session overlay now blanksapiKeyHelper. Before, the user's helper ran on every launch and its cloud key was sent to Unsloth asx-api-key.--settingsis kept. Claude keeps only the last--settings, so a user's forwarded one used to be dropped. It is now merged into the overlay, and Unsloth's pins win where the two conflict.Codex
--as-subagentno longer breaks Codex login on Windows. Where symlinks are denied,auth.jsonis now hard-linked rather than copied. Before, a token refresh in the overlay left the real~/.codex/auth.jsonwith a refresh token that had already been used, so the next plaincodexrun couldn't refresh it.--as-subagentnow goes to the user's Codex home instead of the overlay, which is deleted on exit.--app. The--appmessage now says how the app is switched back if the command is killed.Other agents
unsloth start dsh headless "task"now reaches dsh as its own profile shorthand, instead of becomingdsh web ... headless "task", which dsh rejects.--appkeeps comments in JSON configs. OpenCode and OpenClaw configs keep their//and/* */comments: only the touched member is rewritten. The parsed result is checked, and the old full rewrite is the fallback.legacy-node20package whennodeis older.Verification
unsloth_clisuites for start, start_app, plan gate, the subagent bridges, inference_chat and mcp: all pass. In the fullunsloth_cli/testsrun, the only failures are in studio update and training tests that touch none of the changed code; they fail locally because torch and GPU are absent.unsloth start hermes unsloth/Qwen3-0.6B-GGUF:Q4_K_M --no-launchdownloaded and loaded the model and found the right server.hermes chatinitialized against the 40,960-token model and compacted at 36,864. Before this change it refused the model.unsloth start claude -p ...with Claude Code 2.1.307 sent its requests to the local model.ParserError: Unexpected token '-c', and the exec form returns the deny decision.Not tested here
.codex/config.tomlcan override the Codex model, and TOML table splitting doesn't account for[lines inside multi-line strings (--apprefuses those files instead of corrupting them).