Repository navigation
Studio: put a just-created API token in the Agents command and API examples - #15890
Conversation
|
@codex 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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 203450155b
ℹ️ 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".
| commandOs, | ||
| selectedAgent, | ||
| modelArgs, | ||
| freshApiKey, |
There was a problem hiding this comment.
Redact token-bearing Agents commands from reload snapshots
When a token has been created and Studio is accessed through a non-loopback address, this now puts the raw token into both Agents commands, but their CopyableCode renderer has no data-reload-snapshot-sensitive marker. Reloading with either command visible therefore lets public/reload-snapshot.js clone the token into sessionStorage and restore it in the reload overlay, even though the new store is intended to keep it memory-only and discard it on reload. Mark both token-bearing command blocks as sensitive, as the API example boxes already do.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 7734d51: the Agents command and subagent setup command carry data-reload-snapshot-sensitive whenever they hold a fresh key, so reload-snapshot.js clears them.
|
@codex review |
1 similar comment
|
@codex review |
|
Codex Review: Didn't find any major issues. Chef's kiss. 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". |
What changed
After you create an API token on Settings > API, the commands and examples that need it now include it again, so you can copy them straight into a terminal.
Reported on r/unsloth: creating a token used to fill it into the commands for connecting clients, but after #15467 the API page's Agents tab only links to Settings > Agents, whose command never carried a token. The Settings > API examples also lost the token as soon as you left that tab.
--api-key <new token>when Studio is reached on a non-loopback address (LAN, tunnel). Loopback stays keyless, since the CLI mints its own key there. Only a token created in this page session is used: an explicit key is cached by the CLI per server, so a stale one would replace a working saved key.sk-unsloth-YOUR_KEY, and the example box is redacted from reload snapshots when it holds a real token.The token lives in a small in-memory store (
fresh-api-key-store.ts): never persisted, gone on reload, and dropped when that token is revoked (matched on itskey_prefix). The one-time "Your token" card is unchanged.Settings > Agents right after creating a token, opened on a non-loopback address. The token is masked in the screenshot.
Settings > API after switching to Remote & LAN and back, and the API page's examples.
How it was verified
npm run typecheck,npm run build,npm test(14377 pass, 0 fail). Newtests/agents-fresh-api-key.test.tscovers the command with and without a fresh key, loopback staying keyless, revoke only dropping the matching token, and the Settings > API and API page wiring. Two layout tests that named the oldrevealedvariable now namefreshKey.Not tested here
Windows PowerShell commands were not run (same builder path, covered by the existing shell tests). A real LAN or tunnel client was not connected.