Skip to content

openspec validate hangs when runnings as pre-commit hook #367

Closed

Description

@greenkiwi

We use pre-commit to ensure that our code is linted before committing.

https://pre-commit.com/

We have noticed that pre-commit hangs when it goes to run this check.

I wanted to run openspec validate there

repos:
  - repo: local
    hooks:
      - id: openspec-validate
        name: Validate OpenSpec
        language: script
        entry: openspec
        args:
          - "validate"
          - "--specs"
          - "--strict"
          - "--no-interactive"
        pass_filenames: false
        files: ^openspec/specs/

For some reason this hook just hangs. Running the command locally works - as does wrapping the call in a separate script:

#!/bin/sh
set -e
# Disable any potential interactive features
export CI=true
export OPENSPEC_NO_INTERACTIVE=1
# Close stdin and exec
exec openspec validate --specs --strict --no-interactive 0<&-

I've created a repo to help test this out:

https://github.com/greenkiwi/openspec-pre-commit-hook-issue

It has all the files and hooks.

Activity

  1. TabishB commented on Dec 21, 2025

    @TabishB
    Contributor

    @greenkiwi I have a feeling it's something to do with the non-interactive flag not being respected because of something funky happening with @inquirer/prompts. I'm taking a look now.

  2. added a commit that references this issue on Dec 21, 2025
    03ea323
  3. added a commit that references this issue on Dec 21, 2025
    68e0a7e
  4. added 2 commits that reference this issue on Dec 21, 2025
    d5156cd
    258801f
  5. greenkiwi commented on Dec 22, 2025

    @greenkiwi
    Author

    @TabishB I'm still setting this issue. I'm happy to add anything to get more debugging.

    ❯ pre-commit run -a -v -v
    View OpenSpec............................................................Passed
    - hook id: openspec-view
    - duration: 0.13s
    
    0.17.0
    
    View OpenSpec............................................................Passed
    - hook id: openspec-view
    - duration: 0.13s
    
    
    OpenSpec Dashboard
    
    ════════════════════════════════════════════════════════════
    Summary:
      ● Specifications: 1 specs, 1 requirements
      ● Active Changes: 0 in progress
      ● Completed Changes: 0
    
    Specifications
    ────────────────────────────────────────────────────────────
      ▪ sample                         1 requirement
    
    ════════════════════════════════════════════════════════════
    
    Use openspec list --changes or openspec list --specs for detailed views
    
    Validate OpenSpec with Script............................................Passed
    - hook id: openspec-validate-script
    - duration: 0.15s
    
    - Validating...
    ✓ spec/sample
    Totals: 1 passed, 0 failed (1 items)
    
    Validate OpenSpec........................................................^CInterrupted (^C): KeyboardInterrupt: 
    
  6. added 3 commits that reference this issue on Dec 22, 2025
    ce79ec0
    e4a0217
    6d84924
  7. added 5 commits that reference this issue on Dec 24, 2025
    8995cfd
    dae974d
    77b50dc
    e8df941
    bbe294f
  8. added 2 commits that reference this issue on Feb 21, 2026
    f1fc027
    8e4aebe
  9. added 2 commits that reference this issue on Mar 27, 2026
    acd87c8
    95b66c8
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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions