Skip to content

early exit if not files created/changed handlePostTask#107

Merged
gtrrz-victor merged 2 commits intomainfrom
gtrrz-victor/posttool-hook-should-not-commit-if-no-files
Jan 27, 2026
Merged

early exit if not files created/changed handlePostTask#107
gtrrz-victor merged 2 commits intomainfrom
gtrrz-victor/posttool-hook-should-not-commit-if-no-files

Conversation

@gtrrz-victor
Copy link
Contributor

@gtrrz-victor gtrrz-victor commented Jan 27, 2026

Note

Ensures PostTask does not create a checkpoint when a task results in no file changes, and still cleans up pre-task state.

  • In handlePostTask, early-return when FilterAndNormalizePaths yields no modified or new files; log and best-effort CleanupPreTaskState
  • Add integration test TestSubagentCheckpoints_PostTaskNoFileChanges to verify no commits are created and pre-task file is removed
  • Maintains existing behavior for PostTodo incremental checkpoints (no changes there)

Written by Cursor Bugbot for commit f93c865. This will update automatically on new commits. Configure here.

@gtrrz-victor gtrrz-victor requested a review from a team as a code owner January 27, 2026 06:16
Copilot AI review requested due to automatic review settings January 27, 2026 06:16
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds an early exit optimization to the handlePostTask function to skip creating a checkpoint when no file changes are detected (neither modified nor newly created files).

Changes:

  • Adds an early exit condition in handlePostTask that checks if both relModifiedFiles and relNewFiles are empty
  • Includes cleanup of pre-task state before returning when no changes are detected
  • Outputs a user-friendly message indicating the checkpoint is being skipped

@gtrrz-victor gtrrz-victor merged commit e660f37 into main Jan 27, 2026
4 checks passed
@gtrrz-victor gtrrz-victor deleted the gtrrz-victor/posttool-hook-should-not-commit-if-no-files branch January 27, 2026 22:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants