Skip to content

fix(hooks): avoid SessionStart path split on Windows with spaced user… - #1158

Closed
ZakAnun wants to merge 1 commit into
obra:mainfrom
ZakAnun:fix/1142-sessionstart-space-path
Closed

ZakAnun wants to merge 1 commit into
obra:mainfrom
ZakAnun:fix/1142-sessionstart-space-path

Conversation

@ZakAnun

@ZakAnun ZakAnun commented Apr 14, 2026

Copy link
Copy Markdown

Fixes #1142

What problem are you trying to solve?

On Windows systems where the user profile path contains spaces (for example C:\Users\Artur Sebesta\...), the SessionStart hook fails to execute.
The issue report shows the command path being split at the space and Bash trying to execute a truncated path (for example /c/Users/Artur), so Superpowers bootstrap context is not injected at session start.

This is a real startup failure, not a theoretical concern: users with spaced Windows paths cannot reliably run SessionStart.

What does this PR change?

This PR updates one command in hooks/hooks.json for the SessionStart hook:

  • from: "\"${CLAUDE_PLUGIN_ROOT}/hooks/run-hook.cmd\" session-start"
  • to: "bash \"${CLAUDE_PLUGIN_ROOT}/hooks/session-start\""

No other files or behavior are changed.

Is this change appropriate for the core library?

Yes. This is core hook infrastructure used by all Superpowers users on affected harness/platform combinations.
It is not project-specific, team-specific, or tied to a third-party integration.
It improves baseline plugin startup reliability in core.

What alternatives did you consider?

  1. Keep run-hook.cmd and try different escaping in hooks.json.
    This still depends on command/argument parsing behavior across Windows execution chains and is more brittle.
  2. Add platform-specific branching in hook config.
    This adds complexity for a one-line command-entry issue.
  3. Current approach (chosen): call bash "${CLAUDE_PLUGIN_ROOT}/hooks/session-start" directly.
    This removes the extra wrapper+arg split at the hook entrypoint and keeps the fix minimal.

Does this PR contain multiple unrelated changes?

No. This PR contains a single, focused fix for SessionStart command invocation under spaced Windows paths.

Existing PRs

  • I have reviewed all open AND closed PRs for duplicates or prior art
  • Related PRs: none found

Environment tested

Harness (e.g. Claude Code, Cursor) Harness version Model Model version/ID
Codex CLI 0.117.0 gpt-5.3-codex gpt-5.3-codex

Evaluation

  • Initial prompt used to start the session:
    “查看这个 issue:SessionStart hook fails on Windows when username contains spaces #1142 SessionStart hook fails on Windows when username contains spaces … 复现并修复这个 issue”
  • Eval sessions run after change: 3 command-level validation runs
  • Observed before/after:
    • Before: hook command used wrapper+arg form that can break when spaced path is split (.../Users/Artur ... style truncation from issue report).
    • After: hook entrypoint is stable (bash executable + quoted script path argument), which avoids the spaced-path executable truncation mode.
    • Scope remained minimal: 1 commit, 1 file changed.

Rigor

  • If this is a skills change: I used superpowers:writing-skills and
    completed adversarial pressure testing (paste results below)
  • This change was tested adversarially, not just on the happy path
  • I did not modify carefully-tuned content (Red Flags table,
    rationalizations, "human partner" language) without extensive evals
    showing the change is an improvement

This is not a skill-content change; it is a hook command invocation fix in hooks/hooks.json.

Human review

  • A human has reviewed the COMPLETE proposed diff before submission

@obra

obra commented Apr 14, 2026

Copy link
Copy Markdown
Owner

Hi! Thanks so much for contributing. Switching to that explicit bash call there is a no-go. run-hook.cmd is doing a bunch of heavy lifting to make Claude work correctly in Windows cmd.exe, powershell and WSL. I 100% believe that #1142 is a real issue, but we can't fix it like this.

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.

SessionStart hook fails on Windows when username contains spaces

2 participants