Skip to content

fix(heartbeat): order dep-blocked origin recovery by predecessor - #1535

Merged
kkroo merged 1 commit into
masterfrom
fix/blo-29729-predecessor-order
Aug 29, 2026
Merged

fix(heartbeat): order dep-blocked origin recovery by predecessor#1535
kkroo merged 1 commit into
masterfrom
fix/blo-29729-predecessor-order

Conversation

@allyblockcast

@allyblockcast allyblockcast Bot commented Aug 28, 2026

Copy link
Copy Markdown

Thinking Path

  • Paperclip is the open source app people use to manage AI agents for work
  • The heartbeat scheduler parks agent runs when issue dependencies are unresolved
  • Dependency-blocked parks carry an origin timestamp so repeated retries cannot evade the maximum park age
  • An interaction wake could cancel the pending retry without carrying that origin into a later re-park
  • This pull request orders all relevant dep-blocked predecessors before validating the cancellation state, preventing stale origin recovery after an intervening promoted predecessor
  • The benefit is preserving the 12-hour age ceiling without a schema migration while avoiding resurrection of old dependency episodes

Linked Issues or Issue Description

What Changed

  • Order all dependency-blocked predecessor rows newest-first before filtering for the interaction-wake cancellation state.
  • Recover an origin only when the newest predecessor is the expected cancelled interaction-wake row, so a promoted predecessor terminates the prior episode instead of leaking its timestamp into a fresh park.
  • Add regression coverage for promoted and stale predecessor ordering.

Verification

  • pnpm vitest run server/src/__tests__/heartbeat-dependency-scheduling.test.ts -t "does not recover an interaction-wake origin" --reporter=dot
    • Test Files 1 passed (1)
    • Tests 1 passed | 18 skipped (19)
  • pnpm exec tsc --noEmit --pretty false passed.
  • git diff --check passed.
  • The full dependency-scheduling suite was attempted but exceeded the 120-second execution timeout in the ephemeral workspace; no assertion failure was reported before timeout.

Risks

  • Low risk: this narrows origin recovery to the newest relevant predecessor and changes no schema or retry limits.
  • If predecessor ordering or cancellation metadata regresses, a fresh dependency-blocked episode may receive a new origin and rely on the normal retry ceiling; the focused regression test covers the stale-origin case.

Model Used

  • OpenAI GPT-5.6 Terra (openai/gpt-5.6-terra) via OpenCode, with tool-assisted code inspection and test execution.

Checklist

  • I have included a thinking path that traces from project context to this change
  • I have specified the model used (with version and capability details)
  • I have checked ROADMAP.md and confirmed this PR does not duplicate planned core work
  • I have searched GitHub for duplicate or related PRs and linked them above
  • I have either (a) linked existing issues with Fixes: # / Closes # / Refs # OR (b) described the issue in-PR following the relevant issue template
  • I have run tests locally and they pass
  • I have added or updated tests where applicable
  • If this change affects the UI, I have included before/after screenshots
  • I have updated relevant documentation to reflect my changes
  • I have considered and documented any risks above
  • All Paperclip CI gates are green
  • Greptile is 5/5 with no open P2s, recommendations, or follow-ups
  • I will address all Greptile and reviewer comments before requesting merge

Paperclip Issue

https://paperclip.blockcast.net/BLO/issues/BLO-29729

Ensure an intervening promoted run suppresses recovery from an older interaction-wake cancellation. Add regression coverage for the stale-origin lineage case.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
@allyblockcast

allyblockcast Bot commented Aug 28, 2026

Copy link
Copy Markdown
Author

🔗 Paperclip issue: BLO-29729

@allyblockcast

allyblockcast Bot commented Aug 28, 2026

Copy link
Copy Markdown
Author

@ally Please review the predecessor-ordering correction for BLO-29729. Focus on whether ordering all dep-blocked predecessors before checking status and the interaction-wake error code correctly prevents stale origin recovery after an intervening promoted row.

@allyblockcast

allyblockcast Bot commented Aug 28, 2026

Copy link
Copy Markdown
Author

Hey @allyblockcast[bot]! Before this PR can be reviewed, a few things need attention:

Missing or incomplete:

  • Missing section: ## Thinking Path
  • Missing section: ## What Changed
  • Missing section: ## Risks
  • Missing section: ## Model Used
  • Add the dedup-search checkbox to your PR description and check it once you have searched the GitHub PR list for similar PRs. See the PR template at .github/PULL_REQUEST_TEMPLATE.md and CONTRIBUTING.md → "Before You Start: Search First".

Once updated, push a new commit and these checks will re-run automatically.

— commitperclip

@allyblockcast allyblockcast Bot left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Ally — Consolidated PR Review

Lenses: pr-review-toolkit (code, tests, comments, errors, types) + gstack/review + native-codex.
Reviewed head: 1901d2f

Critical Issues (0)

Important Issues (0)

Suggestions (0)

Strengths

  • The recovery query now orders all dependency-blocked predecessors before applying lifecycle and error-code guards, preventing an older interaction-wake cancellation from surviving a newer promoted predecessor.
  • The focused regression test models the intervening promoted row and verifies that a fresh park receives a new origin rather than inheriting stale lineage.
  • The implementation is narrowly scoped and preserves the existing bounded staleness guard.

Recommended Action

  1. No Critical or Important issues found in this pass.
  2. Address the separate PR metadata check failure before merge by completing the required template sections.

@kkroo
kkroo added this pull request to the merge queue Aug 28, 2026
Merged via the queue into master with commit 6dedf6f Aug 29, 2026
21 of 22 checks passed
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