Skip to content

Failed tasks should not open PRs #18

@sophstad

Description

@sophstad

When a task (non-custom) fails validation, nightshift opens (and then does not clean up) PRs. The agent creates the PR as part of its workflow before nightshift's validator runs, so a failed task leaves a PR open with a fabricated description of work that was never applied. Ideally, the PR would never be opened at all (instead of opened and then closed on failure).

What happened

The lint-fix task ran against a Next.js project. Across 3 iterations:

  1. Iteration 1 (00:41–00:45): Agent committed, pushed to branch nightshift/lint-fix, and opened a PR via gh pr create. Validator then found scope creep and ESLint config issues, so the review stage failed.
  2. Iteration 2 (00:46–00:51): Agent claimed to modify 8 files. Validator found zero changes on disk — "all files on disk are unchanged from their original state." Review failed.
  3. Iteration 3 (00:52–00:55): Same result — agent reported 8 file modifications, validator confirmed nothing was written to disk. Task abandoned ("max iterations reached").

The final report correctly shows "0 completed · 1 failed · 0% success" with 0 tokens used. But the PR from iteration 1 remained open on GitHub with a description claiming all fixes were applied.

Evidence

From nightshift logs (~/.local/share/nightshift/logs/nightshift-2026-02-17.log):

00:45:27  "implementation complete" (files_modified: 8)
00:45:27  "implementation referenced missing files" (skipped: ["eslint.config.mjs"])
00:46:48  "review failed" (iteration 1)
...
00:55:50  "task abandoned" (reason: "max iterations")

From the Claude Code session transcript, the agent ran during iteration 1:

git push -u origin nightshift/lint-fix
gh pr create --title "Fix linting errors and add ESLint config" ...

Expected behavior

Nightshift should prevent the agent from opening PRs until validation passes (e.g., gate git push / gh pr create as a post-validation step rather than part of the agent prompt)

Environment

  • nightshift version: 0.3.1
  • Provider: Claude Code
  • Task: lint-fix

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions