Skip to content

[codex] fix Oh My Zsh completion compinit setup#1033

Merged
TabishB merged 1 commit intomainfrom
codex/fix-omz-completion-compinit
May 1, 2026
Merged

[codex] fix Oh My Zsh completion compinit setup#1033
TabishB merged 1 commit intomainfrom
codex/fix-omz-completion-compinit

Conversation

@TabishB
Copy link
Copy Markdown
Contributor

@TabishB TabishB commented May 1, 2026

Summary

  • Stop auto-mutating .zshrc for Oh My Zsh zsh completion installs.
  • Keep installing _openspec into OMZ custom/completions, letting OMZ manage fpath and compinit itself.
  • Update zsh installer tests to assert OMZ installs leave .zshrc unchanged and do not inject OpenSpec compinit lines.

Root Cause

The installer detected Oh My Zsh for the completion script path, but still called the generic zsh .zshrc configurator when the OMZ completions directory was not already referenced. That generic block prepended autoload -Uz compinit and compinit before source "$ZSH/oh-my-zsh.sh", causing zsh's raw insecure-directory prompt before OMZ's own guarded completion initialization could run.

Fixes #1018.

Validation

  • pnpm exec vitest run test/core/completions/installers/zsh-installer.test.ts
  • pnpm run lint
  • pnpm run build
  • Isolated OMZ-style CLI smoke test confirmed .zshrc remained unchanged while _openspec was installed under custom/completions.

Summary by CodeRabbit

  • Bug Fixes
    • Modified installer behavior for Oh My Zsh: the configuration file is no longer automatically modified during the completion installation process. Standard Zsh setups continue to receive configuration as before.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 1, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: b5442e63-1cb8-416f-8d58-bb1032712567

📥 Commits

Reviewing files that changed from the base of the PR and between 485c97e and 4c0d6a7.

📒 Files selected for processing (2)
  • src/core/completions/installers/zsh-installer.ts
  • test/core/completions/installers/zsh-installer.test.ts

📝 Walkthrough

Walkthrough

The zsh installer is modified to skip .zshrc configuration entirely for Oh My Zsh installations, removing the conditional logic that previously inspected ~/.zshrc to determine if fpath updates were needed. The needsFpathConfig function is removed. Only standard (non-Oh My Zsh) setups receive .zshrc auto-configuration.

Changes

Cohort / File(s) Summary
Zsh Installer Logic
src/core/completions/installers/zsh-installer.ts
Removed conditional .zshrc inspection and needsFpathConfig function. Oh My Zsh installations now completely skip .zshrc configuration, while standard setups retain auto-configuration behavior.
Zsh Installer Tests
test/core/completions/installers/zsh-installer.test.ts
Updated Oh My Zsh test case to verify .zshrc is not modified (zshrcConfigured is false), and confirmed # OPENSPEC markers and compinit directives are not injected.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Suggested reviewers

  • alfred-openspec

Poem

🐰 A zsh conflict now resolved with care,
No more compinit doubly declared there,
Oh My Zsh sings without a warning cry,
The paths align, the shells say goodbye! 🎉

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title '[codex] fix Oh My Zsh completion compinit setup' accurately summarizes the main change: preventing the installer from injecting compinit lines into .zshrc for Oh My Zsh installations.
Linked Issues check ✅ Passed The changes fully address issue #1018: the installer no longer injects autoload/compinit into .zshrc for OMZ, removes the needsFpathConfig logic that was causing conditional execution, and tests verify .zshrc remains unchanged for OMZ setups.
Out of Scope Changes check ✅ Passed All changes are directly related to the objective of fixing OMZ compinit conflicts; the installer logic and corresponding tests are tightly scoped to this issue with no extraneous modifications.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/fix-omz-completion-compinit

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
Review rate limit: 6/8 reviews remaining, refill in 12 minutes and 1 second.

Comment @coderabbitai help to get the list of available commands and usage tips.

@TabishB TabishB marked this pull request as ready for review May 1, 2026 14:38
Copy link
Copy Markdown
Collaborator

@alfred-openspec alfred-openspec left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. The change keeps OMZ in charge of fpath/compinit while preserving auto-configuration for standard zsh, and the test coverage now locks in the no-.zshrc-mutation behavior.

@TabishB TabishB added this pull request to the merge queue May 1, 2026
Merged via the queue into main with commit 44e4bee May 1, 2026
12 checks passed
@TabishB TabishB deleted the codex/fix-omz-completion-compinit branch May 1, 2026 15:31
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.

compinit injected by installer conflicts with Oh My Zsh

2 participants