Repository navigation
Description
Problem Statement
Generated native event hooks start the dispatcher with a fixed interpreter. They use the project .venv Python when one exists. Otherwise they use python3 on POSIX and python on Windows (_resolve_interpreter, _resolve_interpreter_for_target in src/specify_cli/events/__init__.py).
If that interpreter is not on the agent's PATH, every Spec Kit event hook fails. Examples: Windows with only the py launcher, or Spec Kit run through uvx with no system Python. Most agents fail open in that case, so the hook is skipped, the agent run still succeeds, and no message tells the user why.
Nothing checks the interpreter up front. Spec Kit writes the hook, and the failure only shows up later, inside the agent's hook runner.
This affects every event-capable integration on main (f2010547). #5616 makes it more visible: it adds additional_context on workflow command steps, delivered through a built-in session_start hook, so a missing interpreter now silently drops workflow context (review comment: #5616 (comment)).
Proposed Solution
-
Portable fallback: Hooks should find a working interpreter where the default is missing. On Windows, fall back to the
py -3launcher whenpythonis absent, without hard-coding a host-specific path into checked-in configs that are shared across OSes (Copilot'sbash/powershellpair). -
Interpreter check: Report a missing hook interpreter before it matters:
- when hooks are installed (
init,install,upgrade, event refresh), as a warning that names the interpreter and the fix (put it onPATH, or create a project.venvand rerunspecify integration upgrade <key>) - as a pre-flight check in workflow dispatch that depends on a hook. With feat(workflows): add additional_context to command steps #5616 this applies to
commandsteps withadditional_context: fail before the CLI starts, like the existing capability check.
The check should resolve the interpreter the same way the hook command does:
PATHlookup for bare names, and the project-relative path resolved against the hook's working directory for a venv interpreter. - when hooks are installed (
Alternatives Considered
- Document the requirement only. That is cheap, but the failure stays silent.
- Check only in
additional_contextpre-flight, which was proposed in feat(workflows): add additional_context to command steps #5616 review. This was rejected because the cause and the impact are shared by all event hooks, so it would leave the other hooks unprotected.
Component
Specify CLI (integration events)
AI Agent (if applicable)
All event-capable integrations (for example GitHub Copilot, Claude Code, Codex CLI, opencode, Antigravity).
Use Cases
- A Windows developer without
pythononPATHinstalls Copilot. Extensionsession_starthandlers and workflowadditional_contextsilently do nothing. - A CI image runs
uvx specifywithout a systempython3, and its hooks never run.
Acceptance Criteria
- On Windows without
pythonbut withpy, generated hooks run the dispatcher, verified with Windows PowerShell 5.1. - A missing hook interpreter produces a warning at hook installation that names the interpreter and the remedy.
- A workflow step that needs a hook fails before the CLI starts when the hook interpreter cannot be resolved, and the message is actionable.
- Positive and negative tests for the resolution:
PATHcommand, project-relative venv path, absolute path.
Additional Context
Found while reviewing #5616 (part of #5533). Deferred there because it is pre-existing behavior of the event system, not a regression of that PR.
AI Disclosure
Filed on behalf of @markuswondrak by the pi coding agent (provider github-copilot, model claude-opus-5.5, reasoning effort xhigh, interactive and human-supervised). The agent read the code on main and wrote this issue at @markuswondrak's request; the Windows scenario comes from the review comment and code reading, not from a Windows run.


Activity