Skip to content

[IMP] core: Provide AI-friendly instructions and prevent PTY hangs#222

Merged
moylop260 merged 2 commits intomainfrom
headless-ai-pre-commit-fix
Apr 28, 2026
Merged

[IMP] core: Provide AI-friendly instructions and prevent PTY hangs#222
moylop260 merged 2 commits intomainfrom
headless-ai-pre-commit-fix

Conversation

@nhomar
Copy link
Copy Markdown
Member

@nhomar nhomar commented Apr 26, 2026

This PR enhances the pre-commit hook to be resilient in headless and AI agent environments, while also shipping a native agent skill.

1. Robust Hook Execution (Code)

In environments where an agent operates inside an Integrated Terminal (like Cursor or Copilot), a Pseudo-TTY (PTY) is allocated. This previously trapped the agent in the interactive read prompt indefinitely.

  • Added a 10-second timeout (-t 10) to the interactive prompt. If no input is received, it assumes "Y" and proceeds.
  • If the hook fails, it now explicitly prints a 🤖 AUTOMATION & AI AGENT INSTRUCTION block with recovery steps (git add, fix lints, retry). This is printed universally, regardless of TTY presence.

2. Native AI Skill (.agents)

Ships .agents/skills/vauxoo-pre-commit/SKILL.md directly in the repository.
Developers can symlink this skill into their global AI environments (e.g., ~/.gemini/antigravity/skills/). This natively teaches any AI agent working on Odoo projects to ALWAYS verify and install pre-commit-vauxoo before committing, preventing silent CI failures.

cc @moylop260 as requested by @nhomar for review.

…on universally

In environments where an agent operates inside an Integrated Terminal (like Cursor
or Copilot), a Pseudo-TTY (PTY) is allocated. This causes the pre-commit hook
to evaluate `[ -c /dev/tty ] && [ -t 1 ]` as TRUE, trapping the agent in the
interactive `read` prompt indefinitely since agents cannot type "y".

This commit improves the safety net by:
1. Adding a 10-second timeout (`-t 10`) to the interactive prompt. If no input is
   received (e.g. from an agent), it assumes "Y" and proceeds to run the linter.
2. Removing the `[ ! -c /dev/tty ]` condition from the failure instructions block.
   This ensures that the 🤖 AUTOMATION & AI AGENT INSTRUCTION is printed universally
   whenever the hook fails, serving as a vital recovery manual for both agents (in PTYs),
   headless CI environments, and human developers.
@nhomar nhomar force-pushed the headless-ai-pre-commit-fix branch from a06ac5c to 19100b1 Compare April 26, 2026 03:34
@nhomar nhomar changed the title [IMP] core: Provide AI-friendly instructions when pre-commit fails in headless mode [IMP] core: Provide AI-friendly instructions and prevent PTY hangs Apr 26, 2026
By embedding an AI agent skill directly into the pre-commit-vauxoo
repository, developers can symlink this skill into their global AI
environments (like ~/.gemini/antigravity/skills/).

This natively teaches any AI agent working on 15+ different Odoo projects
to ALWAYS verify and install pre-commit-vauxoo before making a commit,
preventing silent CI failures and enforcing the ecosystem's quality rules.
@nhomar nhomar force-pushed the headless-ai-pre-commit-fix branch from 19100b1 to 9086a33 Compare April 26, 2026 03:48
@moylop260 moylop260 merged commit d2309da into main Apr 28, 2026
22 checks passed
@moylop260 moylop260 deleted the headless-ai-pre-commit-fix branch April 28, 2026 01:31
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.

2 participants