Trim the settings pasted into the desktop setup screen - #417
Open
kevin9327 wants to merge 1 commit into
Open
Conversation
kevin9327
requested review from
MikeRyanDev,
davidmckayv,
guidovizoso and
tylerslaton
as code owners
September 7, 2026 11:15
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
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.
What this changes
Four values are typed or pasted on the desktop setup screen. The screen decides whether to enable
its button on the trimmed string:
and then sends the untrimmed one:
On the Rust side exactly one of them is rescued:
So
OPENAI_API_KEYsurvives a stray space and the other three carry it into.env.What that costs
Selecting a token in a provider's dashboard picks up a trailing space more often than not, and a
credential is the one kind of value nobody eyeballs after pasting — it is a wall of characters in a
password field.
The result is a deployment that starts cleanly and then fails at the first request, with the
provider rejecting a key that looks right in
.envand a Bot saying it cannot answer. Nothing inthat chain names the space. The trimming already applied to the model key is there for exactly this
reason; this extends it to the three values entered beside it.
Fix
composetrims the three intelligence values the way it already trims the model key. Nothing elsemoves: a value with nothing around it is byte-identical, and the "blank means leave it out
entirely" rule for the model key is untouched.
Done here rather than in the screen deliberately.
start_stackis a Tauri command and this is theboundary where the string becomes a setting, so trimming here holds whatever called it.
Where it runs
.envit writes is what every replica of the deployment then reads, so the fix reaches all ofthem by reaching the file.
Boundary and audit
exists.
boundary rather than taken as sent.
Changelog
CHANGELOG.mdunderUnreleased.Tests
Two in
desktop/src-tauri/src/env.rs:that pins them as consistent rather than each separately
Against
mainthe first fails:How I tested
Windows 11.
cargo test --libindesktop/src-tauriis 72 passed, 0 failed, up from 70 by the twonew tests.
cargo fmt --all -- --checkandcargo clippy --libare clean. The crate has norust-toolchain.toml, so I built it with the 1.98.0 toolchain installed here.I left
rootalone: it is a directory chosen through a picker rather than pasted, and trimming apath is a different question from trimming a credential. Happy to take it in this PR if you would
rather they moved together.