Skip to content

fix: zsh compdef directive on first line - #53383

Closed
gigamonster256 wants to merge 1 commit into
openclaw:mainfrom
gigamonster256:gigamonster256/push-pmuqnromwtyx
Closed

gigamonster256 wants to merge 1 commit into
openclaw:mainfrom
gigamonster256:gigamonster256/push-pmuqnromwtyx

Conversation

@gigamonster256

Copy link
Copy Markdown

Summary

  • Problem: zsh completions do not work when auto loaded
  • Why it matters: zsh completions must have the #compdef directive on the first line to work properly (works fine when sourced but not loaded automatically from fpath)
  • What changed: zsh completion output
  • What did NOT change (scope boundary):

Change Type (select all)

  • Bug fix
  • Feature
  • Refactor
  • Docs
  • Security hardening
  • Chore/infra

Scope (select all touched areas)

  • Gateway / orchestration
  • Skills / tool execution
  • Auth / tokens
  • Memory / storage
  • Integrations
  • API / contracts
  • UI / DX
  • CI/CD / infra

User-visible / Behavior Changes

None

Security Impact (required)

  • New permissions/capabilities? (No)
  • Secrets/tokens handling changed? (No)
  • New/changed network calls? (No)
  • Command/tool execution surface changed? (No)
  • Data access scope changed? (No)

Repro + Verification

Environment

  • OS: NixOS
  • Runtime/container: N/A
  • Model/provider: N/A
  • Integration/channel (if any): N/A
  • Relevant config (redacted): N/A

Human Verification (required)

What you personally verified (not just CI), and how:

  • Verified scenarios: zsh completions now load automatically from the file openclaw completion --shell zsh outputs
  • verified compinit -D loads openclaw completion file in addition to sourcing the file working

Review Conversations

  • I replied to or resolved every bot review conversation I addressed in this PR.
  • I left unresolved only the conversations that still need reviewer or maintainer judgment.

If a bot review conversation is addressed by this PR, resolve that conversation yourself. Do not leave bot review conversation cleanup for maintainers.

Compatibility / Migration

  • Backward compatible? (Yes)
  • Config/env changes? (No)
  • Migration needed? (No)

Risks and Mitigations

List only real risks for this PR. Add/remove entries as needed. If none, write None.

None

@openclaw-barnacle openclaw-barnacle Bot added cli CLI command changes size: XS labels Mar 24, 2026
@greptile-apps

greptile-apps Bot commented Mar 24, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes a one-line bug where a leading newline in the generateZshCompletion template literal pushed the #compdef directive off the first line of the generated script. Zsh requires this directive to be on line 1 for autoloading from fpath to work; sourcing the file directly would still succeed, which is why the bug only manifested in the autoloaded case.

  • Removes the extra newline before #compdef ${rootCmd} so the directive is on line 1 of the output.
  • No functional logic changes — only the whitespace at the start of the generated completion script is affected.
  • Fully backward-compatible; users who source the file will see no change in behaviour.

Confidence Score: 5/5

  • Safe to merge — minimal, targeted fix with no functional side-effects.
  • The change is a single-character whitespace fix with a clear, well-understood root cause (zsh #compdef must be on line 1 for fpath autoloading). It is backward-compatible, has no security or logic implications, and the author verified it manually in both the sourced and autoloaded scenarios.
  • No files require special attention.

Reviews (1): Last reviewed commit: "fix: zsh compdef directive on first line" | Re-trigger Greptile

@vincentkoc

Copy link
Copy Markdown
Member

Thanks for the contribution. I am closing this because it is a tiny zsh completion tweak that is stale and failing check, contracts, additional, and Windows lanes. Please reopen from a fresh green branch if this is still needed.

@vincentkoc vincentkoc closed this Apr 25, 2026
@gigamonster256

Copy link
Copy Markdown
Author

Did you even look at this? It's not stale, it's literally a 1 line change, and CI failing has nothing to do with it

@clawsweeper clawsweeper Bot mentioned this pull request Apr 29, 2026
4 of 16 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes size: XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants