Skip to content

feat: pre-commit quality gates in prompts + --context flag for resume#71

Merged
chanakyav merged 2 commits intomainfrom
feat/pre-commit-gates-and-resume-context
Mar 24, 2026
Merged

feat: pre-commit quality gates in prompts + --context flag for resume#71
chanakyav merged 2 commits intomainfrom
feat/pre-commit-gates-and-resume-context

Conversation

@chanakyav
Copy link
Copy Markdown
Owner

Summary

Two features to prevent CI failures and improve resume UX:

1. Pre-commit Quality Gate Instructions

All prompt templates now include a verification block that tells the agent to discover and run the project's linter, type checker, and test suite BEFORE committing. This catches lint, type, and test failures before they reach CI.

Affected prompts: implement_prompt, implement_on_existing_branch_prompt, plan_and_implement_prompt, fix_prompt, fix_ci_prompt.

The instructions are project-agnostic — the agent looks for config files (pyproject.toml, .eslintrc, Makefile, etc.) to discover tooling rather than hardcoding specific tools.

2. --context Flag for Resume

autopilot resume --pr 132 --context "fix all linting issues before committing"

Passes additional instructions to the agent during the fix loop. The context is stored in the task's prompt field and piped through as a Task Context section in every fix prompt iteration. No schema migration needed — reuses the existing prompt column.

Changes

File What
src/autopilot_loop/prompts.py Added _pre_commit_verification_instruction() helper; updated all 5 prompt templates; added task_context param to fix_prompt
src/autopilot_loop/cli.py Added --context / -c to resume subparser; updated cmd_resume to store context in prompt; updated module docstring
src/autopilot_loop/orchestrator.py _do_fix now passes self.task["prompt"] as task_context to fix_prompt
README.md Added resume --context example to Commands table
tests/test_cli.py Added TestCmdResumeContext (context stored, default prompt without context)
tests/test_orchestrator.py Added TestPreCommitVerification (5 prompts), TestFixPromptTaskContext (3 tests)

Testing

  • python3 -m ruff check src/ tests/ — all checks passed
  • python3 -m pytest tests/ — 272 tests passed

🤖 autopilot-loop

…esume

Two changes:

1. Pre-commit verification instructions: All prompt templates (implement,
   implement_on_existing_branch, plan_and_implement, fix, fix_ci) now
   include a quality gate block that tells the agent to discover and run
   the project's linter, type checker, and test suite BEFORE committing.
   This catches CI failures (lint, types, tests) before they happen.

2. Resume --context flag: 'autopilot resume --pr N --context "..."'
   passes additional instructions to the agent during the fix loop.
   The context is stored in the task's prompt field and piped through
   to fix_prompt as a Task Context section. Useful for nudging the
   agent to focus on specific issues (e.g. 'fix linting issues').

No schema migration needed — reuses existing prompt column.
@chanakyav chanakyav marked this pull request as ready for review March 24, 2026 20:27
@chanakyav chanakyav merged commit 6154abf into main Mar 24, 2026
@chanakyav chanakyav deleted the feat/pre-commit-gates-and-resume-context branch March 25, 2026 01:53
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.

1 participant