fix(shell): restore ZDOTDIR and source full zsh startup chain#3
Merged
fix(shell): restore ZDOTDIR and source full zsh startup chain#3
Conversation
The zsh wrapper pointed ZDOTDIR at a temp directory containing only a
synthetic .zshrc. This caused two correctness problems for any zsh
setup that depends on ZDOTDIR or .zshenv:
- `.zshenv` was silently skipped, because zsh reads it from the
overridden temp ZDOTDIR before our wrapper runs. PATH additions,
env vars, and bootstraps (nvm, pyenv, etc.) placed there were lost
inside wt shells.
- Frameworks that locate files via `${ZDOTDIR:-$HOME}/...` — e.g.
prezto's `${ZDOTDIR:-$HOME}/.zprezto/init.zsh` — looked in the temp
dir and failed to load. Without the framework, `compinit` never
ran, so completion loads such as `kops completion zsh` emitted
`compdef: command not found`.
The wrapper now restores ZDOTDIR to _WT_ORIG_ZDOTDIR first, re-sources
.zshenv / .zprofile (for login shells) / .zshrc in the normal order
from the real ZDOTDIR/HOME, and defines a no-op compdef stub as a
safety net for any framework (oh-my-zsh, prezto, zim, custom dotfiles)
that calls compdef before compinit runs.
pld
approved these changes
Apr 26, 2026
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.
The zsh wrapper pointed ZDOTDIR at a temp directory containing only a synthetic .zshrc. This caused two correctness problems for any zsh setup that depends on ZDOTDIR or .zshenv:
.zshenvwas silently skipped, because zsh reads it from the overridden temp ZDOTDIR before our wrapper runs. PATH additions, env vars, and bootstraps (nvm, pyenv, etc.) placed there were lost inside wt shells.${ZDOTDIR:-$HOME}/...— e.g. prezto's${ZDOTDIR:-$HOME}/.zprezto/init.zsh— looked in the temp dir and failed to load. Without the framework,compinitnever ran, so completion loads such askops completion zshemittedcompdef: command not found.The wrapper now restores ZDOTDIR to _WT_ORIG_ZDOTDIR first, re-sources .zshenv / .zprofile (for login shells) / .zshrc in the normal order from the real ZDOTDIR/HOME, and defines a no-op compdef stub as a safety net for any framework (oh-my-zsh, prezto, zim, custom dotfiles) that calls compdef before compinit runs.