Skip to content

feat: implement issue #1660 — Action budget, slice 3a: checkpoint-push partial work before the budget expires - #1709

Merged
don-petry merged 4 commits into
mainfrom
dev-lead/issue-1660-20260908-0149
Sep 8, 2026
Merged

don-petry merged 4 commits into
mainfrom
dev-lead/issue-1660-20260908-0149

Conversation

@don-petry

@don-petry don-petry commented Sep 8, 2026 •

Copy link
Copy Markdown
Collaborator

User description

Closes #1660

Implemented by dev-lead agent. Please review.

Summary by CodeRabbit

  • New Features

    • Preserves partial work when an implementation stage times out by creating and pushing a clearly marked incomplete checkpoint.
    • Includes the checkpoint branch in timeout escalation details for easier recovery and review.
  • Bug Fixes

    • Retains the existing recovery message when checkpoint publishing fails.
    • Prevents timed-out partial work from being reported as completed.

CodeAnt-AI Description

Preserve partial work from timed-out issue runs

What Changed

  • Timed-out runs now commit uncommitted changes with a clear incomplete, unreviewed marker and push the working branch for recovery
  • Already-committed changes are also pushed when a timeout occurs, without creating an extra checkpoint commit
  • Timeout notices identify the checkpoint branch and explain that the work is partial and must not be merged as-is
  • Failed checkpoint pushes retain the existing unrecoverable-work warning
  • Checkpoints do not claim completion or create pull requests, while successful runs keep their normal completion behavior
  • Added coverage for successful checkpoints, push failures, completion-gate protection, and unchanged successful runs

Impact

✅ Recoverable partial work after timeouts
✅ Clear incomplete status for checkpoint branches
✅ No false completion claims for timed-out runs

💡 Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.

…h partial work before the budget expires
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@qodo-code-review

Copy link
Copy Markdown

ⓘ Qodo reviews are paused because your trial has ended. Ask your workspace admin to add credits to resume reviews. Manage billing

@codeant-ai

codeant-ai Bot commented Sep 8, 2026 •

Copy link
Copy Markdown

🤖 CodeAnt AI — Review Status

Status Commit Started (UTC) Finished (UTC)
✅ Incremental review completed 13cc2bf Sep 08, 2026 · 11:37 11:37
✅ Incremental review completed 2fd9ce8 Sep 08, 2026 · 03:10 03:10
✅ Reviewed your PR a1b1df5 Sep 08, 2026 · 02:03 02:05

@codeant-ai

codeant-ai Bot commented Sep 8, 2026

Copy link
Copy Markdown

Thanks for using CodeAnt! 🎉

We're free for open-source projects. if you're enjoying it, help us grow by sharing.

Share on X ·
Reddit ·
LinkedIn

@codeant-ai codeant-ai Bot added the size:L This PR changes 100-499 lines, ignoring generated files label Sep 8, 2026
@don-petry

Copy link
Copy Markdown
Collaborator Author

Dev-Lead — waiting on PR blockers (intent: review-changes)

PR: #1709
No changes were committed, but the PR still has blocking checks or reviews (failing or cancelled checks, or changes-requested reviews). The retry cron will re-attempt automatically. Next attempt after: 2026-09-08T02:34:56Z

@don-petry

Copy link
Copy Markdown
Collaborator Author

Note

@don-petry I reviewed this PR and no code changes were needed, but it still has blocking checks or reviews (failing or cancelled checks, or changes-requested reviews), so I cannot mark it done yet. I'll re-check automatically.
Next attempt after: 2026-09-08T02:34:56Z

@don-petry
don-petry enabled auto-merge (squash) September 8, 2026 02:05

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request implements a checkpoint-push mechanism in scripts/dev-lead-fix-issue.sh to preserve partial work on stage timeouts (exit 124) by committing changes under an incomplete marker and pushing the branch. It also updates the corresponding unit tests in tests/dev-lead/unit/test_fix_issue.bats. The review feedback recommends using $BATS_TEST_TMPDIR in the BATS tests instead of manually creating and cleaning up temporary files with mktemp and rm, which ensures automatic per-test isolation and cleanup on failure.

Comment thread tests/dev-lead/unit/test_fix_issue.bats Outdated
Comment thread tests/dev-lead/unit/test_fix_issue.bats Outdated
Comment thread tests/dev-lead/unit/test_fix_issue.bats Outdated
Comment thread tests/dev-lead/unit/test_fix_issue.bats Outdated
Comment thread tests/dev-lead/unit/test_fix_issue.bats Outdated
Comment thread tests/dev-lead/unit/test_fix_issue.bats Outdated
Comment thread tests/dev-lead/unit/test_fix_issue.bats Outdated
Comment thread tests/dev-lead/unit/test_fix_issue.bats Outdated
@coderabbitai

coderabbitai Bot commented Sep 8, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Team

Run ID: 04398fc1-0acf-4518-98f8-8d7555a5e20f

📥 Commits

Reviewing files that changed from the base of the PR and between 27b0e8a and a1b1df5.

📒 Files selected for processing (2)
  • scripts/dev-lead-fix-issue.sh
  • tests/dev-lead/unit/test_fix_issue.bats

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


Important

Approval pending

CodeRabbit has no unresolved comments, but it has not reviewed the latest commit.

Use the checkbox below to review the latest commit. CodeRabbit will approve the changes if it finds no blocking issues.

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

On stage timeout, the engine now commits and pushes partial work with an incomplete marker. Escalation comments name successful checkpoint branches or retain the unrecoverable note after push failure. Tests verify timeout, completion-gate, failure, and normal-run behavior.

Changes

Timeout checkpoint flow

Layer / File(s) Summary
Checkpoint commit and push
scripts/dev-lead-fix-issue.sh
Adds the incomplete checkpoint marker and a function that commits and pushes partial work.
Timeout escalation integration
scripts/dev-lead-fix-issue.sh
Uses the checkpoint function during stage timeouts and reports its result in the escalation comment.
Checkpoint and path validation
tests/dev-lead/unit/test_fix_issue.bats
Tests successful and failed pushes, incomplete checkpoint messages, closed completion status, and unchanged normal completion behavior.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: ⚪ Minimal · up to a1b1d

Timed-out work is now saved as an explicitly incomplete checkpoint and reported for human follow-up, while normal successful runs retain their existing completion behavior. No actionable merge-blocking risk remains.

Sequence Diagram(s)

sequenceDiagram
  participant handle_engine_failure
  participant checkpoint_push_partial_work
  participant GitRemote
  participant IssueComment
  handle_engine_failure->>checkpoint_push_partial_work: checkpoint partial work
  checkpoint_push_partial_work->>GitRemote: commit and push branch
  GitRemote-->>checkpoint_push_partial_work: branch name or push failure
  checkpoint_push_partial_work-->>handle_engine_failure: checkpoint result
  handle_engine_failure->>IssueComment: post timeout escalation
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description explains the implementation and impact, but it does not follow the repository template. It omits the required Summary heading, Interaction contract section, and checklist confirmations… Update the description to use the repository template. Add the Summary section, mark the Interaction contract as N/A or complete the required agentic-role contract details, and confirm the shellcheck and documentation checklist items. Remov…
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the checkpoint-push feature and links it to issue #1660. It is specific and relevant to the main change.
Linked Issues check ✅ Passed The changes satisfy issue #1660: timeout handling commits and pushes marked incomplete work, reports the branch as partial and unreviewed, keeps the resolution gate closed, preserves normal-run behavi…
Out of Scope Changes check ✅ Passed The changes are limited to timeout checkpoint handling and its tests. The summaries show no unrelated features, checkpoint resumption, or action-budget changes.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 2 files.
Full details: Description check

Explanation

The description explains the implementation and impact, but it does not follow the repository template. It omits the required Summary heading, Interaction contract section, and checklist confirmations.

Resolution

Update the description to use the repository template. Add the Summary section, mark the Interaction contract as N/A or complete the required agentic-role contract details, and confirm the shellcheck and documentation checklist items. Remove unrelated generated usage content if it is not needed.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch dev-lead/issue-1660-20260908-0149

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Comment thread scripts/dev-lead-fix-issue.sh
Comment thread scripts/dev-lead-fix-issue.sh
@codeant-ai

codeant-ai Bot commented Sep 8, 2026

Copy link
Copy Markdown

CodeAnt Nitpicks

1 code suggestion

1. Any different HEAD is treated as engine work, so a timeout after a reset, checkout, or unrelated history change can checkpoint and push the wrong branch state.

Logic error · scripts/dev-lead-fix-issue.sh:202-204

@don-petry
don-petry disabled auto-merge September 8, 2026 02:06
@donpetry-bot

Copy link
Copy Markdown
Contributor

CI checks on this PR are still running. Once they complete, re-mention @donpetry-bot to trigger a fresh review.

Posted by the donpetry-bot PR-review cascade.

@don-petry

Copy link
Copy Markdown
Collaborator Author

Dev-Lead — fix-reviews (applied)

Changes committed and pushed.

@don-petry
don-petry enabled auto-merge (squash) September 8, 2026 02:10
@don-petry
don-petry disabled auto-merge September 8, 2026 02:12
@don-petry
don-petry enabled auto-merge (squash) September 8, 2026 02:13

@donpetry-bot donpetry-bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Automated review — APPROVED ✓

Risk: MEDIUM
Reviewed commit: e8f81715834a07998ab672d0964c156e42aaa61a
Review mode: triage-approved (single reviewer)

Summary

Confirms the triage assessment: a focused, well-tested change to the dev-lead timeout path that checkpoint-pushes partial work (issue #1660, slice 3a). Adds checkpoint_push_partial_work() invoked only from the exit-124 branch of handle_engine_failure; the normal-run commit/push path is untouched. 2 files, +273/−25.

Linked issue analysis

Closes #1660 (rescoped: checkpoint only, resume out of scope). All acceptance criteria are substantively addressed:

  • AC1 — push happens before the run exits: exit 124 is delivered synchronously to the orchestrating shell (GNU timeout wraps only the engine child), so the checkpoint runs in ordinary control flow. The PR states which approach was chosen and why (trap has no signal to catch; fractional checkpoint would guess) — exactly what the issue asked for.
  • AC2 — distinct checkpoint(dev-lead): INCOMPLETE — prefix; no PR opened, no completion claim posted; test asserts no status=completed marker, keeping the harness-only resolution gate (#1621/#1691) closed.
  • AC3 — escalation names the pushed branch and calls the work partial/unreviewed, replacing "not recoverable from this run"; honest fallback retained when the push fails.
  • AC4 — non-timeout path is byte-identical: the checkpoint mirrors the existing success-path git add -A / git push --set-upstream and the diff touches only the timeout branch. Verified against the head-SHA script.
  • AC5 — four new bats tests cover: committed-work checkpoint (clean tree), uncommitted-work checkpoint with marker assertions, push-failure fallback, resolution-gate-stays-closed, and unchanged non-timeout success.

Findings

No blocking findings.

  • Variable scoping (verified OK): checkpoint_push_partial_work reads branch/pre_engine_sha, which are locals of the caller of handle_engine_failure — visible via bash dynamic scoping, the same pre-existing pattern the old work-note code used.
  • Unresolved review threads (2, codeant-ai, non-blocking): (1) git add -A breadth — declined as-is by design; it mirrors the success-path commit and the runner is ephemeral/single-issue, with gitleaks gating secrets. (2) Plain-push race — declined; the branch name is per-run date-stamped so a concurrent-update rejection is effectively impossible, and the code falls back to the honest "not recoverable" note. Both replies are technically sound and codeant-ai acknowledged each by saving a matching review instruction. All 8 gemini-code-assist threads are resolved/outdated. No unanswered human-reviewer questions.
  • Minor nuance (non-blocking): on the committed-work-only path (clean tree) no new commit is created, so the INCOMPLETE marker appears only in the escalation notice, not in a commit message. The branch is still unmistakably flagged partial/unreviewed on the issue, which satisfies the intent of AC2.
  • Secret scan: run_secret_scanning MCP tool not available in this environment; gitleaks CI check passed and the diff contains no credential-like content.

CI status

All checks green: shellcheck, bats, unit-tests, holdout-guard, CodeQL, SonarCloud quality gate, gitleaks, agent-shield, actionlint, and all policy/validation gates SUCCESS. Cancelled entries in the rollup are superseded review/dev-lead workflow runs, not code checks. mergeStateStatus BLOCKED solely on the pending review requirement.


Reviewed automatically by the PR-review agent (single-reviewer mode: fable 5). Reply if you need a human review.

@don-petry

Copy link
Copy Markdown
Collaborator Author

No description provided.

@donpetry-bot

Copy link
Copy Markdown
Contributor

Advisory bots were rate-limited; auto-approval is withheld until they recover. pr-review-sweep will re-review this PR after 2026-09-08T03:17:35Z.

@don-petry
don-petry disabled auto-merge September 8, 2026 02:17
@don-petry

Copy link
Copy Markdown
Collaborator Author

Dev-Lead — waiting on PR blockers (intent: fix-reviews)

PR: #1709
No changes were committed, but the PR still has blocking checks or reviews (failing or cancelled checks, or changes-requested reviews). The retry cron will re-attempt automatically. Next attempt after: 2026-09-08T02:48:46Z

@don-petry
don-petry enabled auto-merge (squash) September 8, 2026 02:18
@don-petry
don-petry disabled auto-merge September 8, 2026 03:08
@don-petry
don-petry enabled auto-merge (squash) September 8, 2026 03:09
@don-petry
don-petry disabled auto-merge September 8, 2026 03:18
@don-petry

Copy link
Copy Markdown
Collaborator Author

Dev-Lead — fix-bot-comment (no-changes)

Agent reasoning
- 0 Security Hotspots  
- 0 Accepted issues
- All metrics passing
**Tier 1 blockers analysis:**
- All CI checks: ✅ `success` or `skipped` (zero failures/timeouts)
- All reviews: ✅ zero `CHANGES_REQUESTED` states
- **Blockers:** 0
The SonarCloud comment describes the overall result without reporting specific code defects tied to files/lines. Per the constraints: *"A neutral overview is not an actionable finding."* There is nothing to fix.
The `gemini-code-assist` suggestion about using `$BATS_TEST_TMPDIR` in tests is a code review comment (not `CHANGES_REQUESTED`), and the PR's automated review (`donpetry-bot`) already approved the changes as-is, confirming the test approach is sound.
**No changes needed. PR is ready.**

@don-petry
don-petry enabled auto-merge (squash) September 8, 2026 03:18
@donpetry-bot

Copy link
Copy Markdown
Contributor

Advisory bots were rate-limited; auto-approval is withheld until they recover. pr-review-sweep will re-review this PR after 2026-09-08T04:18:51Z.

@sonarqubecloud

sonarqubecloud Bot commented Sep 8, 2026

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L This PR changes 100-499 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Action budget, slice 3a: checkpoint-push partial work before the budget expires

2 participants