Skip to content

[Feature]: Portable interpreter fallback and interpreter check for generated event hooks #5619

Backlog

Description

@markuswondrak

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

  1. Portable fallback: Hooks should find a working interpreter where the default is missing. On Windows, fall back to the py -3 launcher when python is absent, without hard-coding a host-specific path into checked-in configs that are shared across OSes (Copilot's bash/powershell pair).

  2. 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 on PATH, or create a project .venv and rerun specify 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 command steps with additional_context: fail before the CLI starts, like the existing capability check.

    The check should resolve the interpreter the same way the hook command does: PATH lookup for bare names, and the project-relative path resolved against the hook's working directory for a venv interpreter.

Alternatives Considered

  • Document the requirement only. That is cheap, but the failure stays silent.
  • Check only in additional_context pre-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 python on PATH installs Copilot. Extension session_start handlers and workflow additional_context silently do nothing.
  • A CI image runs uvx specify without a system python3, and its hooks never run.

Acceptance Criteria

  • On Windows without python but with py, 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: PATH command, 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

  1. added
    triage-must-have
    on Nov 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    triage-must-have

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions