Skip to content

fix(zsh): keep deferred line-init defined for plugins that call it by name - #26842

Merged
OrcaWin merged 2 commits into
mainfrom
nwparker/obvious-zsh-wrapper-10-09-2
Oct 11, 2026
Merged

OrcaWin merged 2 commits into
mainfrom
nwparker/obvious-zsh-wrapper-10-09-2

Conversation

@nwparker

@nwparker nwparker commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 4 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​71 $\color{#cf222e}{\Huge{\mathbf{−}}}$​29 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​42
Prod 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​2 $\color{#cf222e}{\Huge{\mathbf{−}}}$​10 $\color{#cf222e}{\Huge{\mathbf{−}}}$​8

ELI5

Some zsh plugins made every new prompt in an Orca terminal print command not found: __orca_deferred_line_init. Prompts now stay clean and the plugin keeps working.

What Changed

Before: with a plugin such as an input-mode plugin loaded, each prompt printed the error above. After: no error, and the plugin's own code still runs on every prompt.

Orca's zsh startup script installs a small one-time function, __orca_deferred_line_init, and deleted it once startup finished, after checking that no key-binding widget still pointed at it. Some plugins don't point a widget at it; they copy a call to it into the body of their own function. That check can't see such a call, so the function was deleted while the plugin still called it. Now the function stays defined. Its first line already returns right away once startup is done, so a leftover call does nothing. The same generated script is used for local terminals, the terminal daemon, and remote (SSH) hosts, so the fix reaches all three.

Why

Keeping one inert function is the only way to cover every place a plugin might keep a reference. Scanning plugin function bodies for the name would still miss calls kept in variables or built at runtime. This adapts @petersindex's original fix in #26157.

Linked Issue

Fixes #26029

Visual Proof

N/A: this changes shell startup text only; no Orca layout or interaction changed. The new real-zsh test prints the exact error on main and is clean with this change.

Testing

  • I manually tested these changes locally
  • Automated tests added/updated

A new real-zsh terminal test runs a plugin that copies the call into its own function, for the local and daemon scripts (the remote-host script is generated by the same builder, and its snapshot shows the same eight-line removal). On main both fail with command not found: __orca_deferred_line_init; with this change they pass, the plugin runs on every prompt, and a direct call after startup returns 0 and does nothing. The test is added to the existing deferred-startup test file, which already runs in the shell test lane. The generated-script snapshots lose exactly the eight deleted cleanup lines per script. Focused zsh suites (72 tests), node typecheck, pnpm lint, and the changed-code quality gate pass on macOS zsh 5.9.

AI Disclosure

Review

Self-reviewed and independently reviewed for P0/P1 issues (re-sourcing the script, the widget chain, exit status, local/daemon/remote parity). No findings.

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

The function lives only inside each shell and is not exported. Native Windows shells don't use this script; WSL zsh uses the same local script. No RPC, wire, or launch-argument changes, so mixed client/host versions are unaffected. Folder workspaces and all git providers use the same shell startup path.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

@nwparker
nwparker marked this pull request as ready for review October 9, 2026 11:26
@coderabbitai

coderabbitai Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 5a63a722-f997-4ab5-930f-e97e5089d578

📥 Commits

Reviewing files that changed from the base of the PR and between b4e39456ec349c44d8b89a7ca39f1c368d68cc34 and 267ffa1.


You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 85b1f36e-a37f-4ce9-8998-bd45e30e2338




📥 Commits

Reviewing files that changed from the base of the PR and between 9235c2070ef88186906d300bc070e6a6d0e4ba87 and b4e39456ec349c44d8b89a7ca39f1c368d68cc34.





📒 Files selected for processing (1)
  • src/main/zsh-deferred-startup-line-init.live-shell.test.ts




Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.






📝 Walkthrough
📝 Walkthrough
📝 Walkthrough
📝 Walkthrough

Walkthrough

The deferred-startup cleanup no longer scans widget bindings or conditionally removes __orca_deferred_line_init. It still conditionally removes the scheduled initializer when no callback is armed. Live-shell tests cover copied line-init function-name calls with local and daemon wrappers.








Priority: ➖ Normal

Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to b4e39

Plugins can call the deferred line-init helper by its copied name after startup without encountering a missing-command error; the helper is then inert. No actionable merge risk is established.

Pre-merge checks | Passed 5
✅ Passed checks (5 passed)
Check name Status Explanation
Linked Issues check Passed Issue #26029 requires that plugins can call __orca_deferred_line_init by name after startup without an error. The cleanup block no longer removes that function. Its existing guard returns 0 after `_…
Out of Scope Changes check Passed The production change directly fixes issue #26029. The test change reproduces the plugin function-body reference and checks the required behavior. The local, daemon, and relay snapshots record the gen…
Docstring Coverage Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 5…
Title check Passed The title clearly and concisely describes the primary change: keeping the deferred line-init function defined for plugins that call it by name.
Description check Passed The description follows the required template and explains the user impact, mechanism, rationale, linked issue, testing, scope, compatibility, and checklist status. Visual proof is correctly marked N/…



✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR








  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

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

nwparker added a commit that referenced this pull request Oct 9, 2026
Records the retained adapted contribution from #26157 in replacement PR #26842.

Co-authored-by: petersindex <[email protected]>
@OrcaWin
OrcaWin force-pushed the nwparker/obvious-zsh-wrapper-10-09-2 branch from 1bb3bee to 9235c20 Compare October 11, 2026 05:32
@OrcaWin OrcaWin changed the title fix(zsh): preserve startup functions referenced by plugins fix(zsh): keep deferred line-init defined for plugins that call it by name Oct 11, 2026
@OrcaWin
OrcaWin force-pushed the nwparker/obvious-zsh-wrapper-10-09-2 branch from b4e3945 to 267ffa1 Compare October 11, 2026 06:37
@OrcaWin
OrcaWin merged commit c37ce7a into main Oct 11, 2026
29 checks 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.

[Bug]: zsh prints "command not found: __orca_deferred_line_init" at every prompt with zimfw/input

2 participants