fix(serve): forward the full environment to the streaming daemon - #7796
Merged
JanDeDobbeleer merged 1 commit intoAug 12, 2026
Merged
Conversation
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
📦 Release binary size reportCompares this PR's release-equivalent build against the latest published release, per OS (amd64).
🎉 Binary size shrank on at least one platform. |
JanDeDobbeleer
force-pushed
the
claude/loving-shannon-gokc13
branch
from
August 12, 2026 20:20
730d018 to
afc43df
Compare
JanDeDobbeleer
changed the base branch from
main
to
claude/powershell-utf8-encoding-ati5z1
August 12, 2026 20:34
When streaming is enabled, the daemon only saw environment variable
changes for a hardcoded whitelist (PATH, POSH_* variables, VIRTUAL_ENV,
CONDA_PROMPT_MODIFIER), forwarded per-prompt by the shell integration
scripts. Anything outside that whitelist - like a variable direnv
exports - stayed pinned to whatever value existed when the daemon
started, so `{{ .Env.XXX }}` templates never picked up live changes.
The daemon now reads the shell's complete environment on every prompt
instead: each request's JSON header is unconditionally followed by a
raw "KEY=VALUE\0" record stream terminated by an empty record, which
the daemon parses with readEnvBlob before applying it via the existing
overlay/unset machinery. This wire format needs no escaping (env
values can never contain a NUL byte on any OS), fixing latent
correctness bugs in the shell-side JSON escapers it replaces (fish
silently dropped embedded newlines; zsh's control-character stripper
only handled the first stray character due to a single-substitution
bug) and is cheaper to produce than the JSON it replaces, particularly
in fish.
All four shell integrations (fish, zsh, pwsh, cmd/Clink) were updated
to send the full env this way instead of a whitelist, including at
their abort/quit call sites, which now also send the (empty) blob
every request line requires to keep the stream in sync.
Fixes #7792.
JanDeDobbeleer
force-pushed
the
claude/loving-shannon-gokc13
branch
from
August 12, 2026 20:49
afc43df to
041c38c
Compare
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.
Prerequisites
Description
Fixes #7792.
When
streamingis enabled, the persistentoh-my-posh servedaemon only saw environment variable changes for a hardcoded whitelist (PATH,POSH_*variables,VIRTUAL_ENV,CONDA_PROMPT_MODIFIER), forwarded per-prompt by the shell integration scripts. Anything outside that whitelist - like a variable direnv exports - stayed pinned to whatever value existed when the daemon started, so{{ .Env.XXX }}templates never picked up live changes.The daemon now reads the shell's complete environment on every prompt instead of a whitelist. Each request's JSON header is unconditionally followed by a raw
KEY=VALUE\0record stream terminated by an empty record, which the daemon parses (readEnvBlob) before applying it via the existing overlay/unset machinery. This wire format needs no escaping - environment variable values can never contain a NUL byte on any OS - which also fixes latent correctness bugs in the shell-side JSON escapers it replaces (fish silently dropped embedded newlines; zsh's control-character stripper only handled the first stray character due to a single-substitution bug), and is cheaper to produce than the JSON it replaces, particularly in fish.All four shell integrations (fish, zsh, pwsh, cmd/Clink) were updated to send the full environment this way, including at their abort/quit call sites, which now also send the (empty) blob every request line requires to keep the protocol stream in sync.
Docs were checked -
streaming.mdx's "Known limitations" section never claimed environment variables were live, so nothing there needed correcting.Generated by Claude Code