Skip to content

fix(shell): restore ZDOTDIR and source full zsh startup chain#3

Merged
pld merged 2 commits intopld:mainfrom
ukanga:fix/zsh-prezto-compdef-errors
Apr 26, 2026
Merged

fix(shell): restore ZDOTDIR and source full zsh startup chain#3
pld merged 2 commits intopld:mainfrom
ukanga:fix/zsh-prezto-compdef-errors

Conversation

@ukanga
Copy link
Copy Markdown
Collaborator

@ukanga ukanga commented Apr 21, 2026

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.

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 pld merged commit 49d0a3c into pld:main Apr 26, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants