Skip to content

feat(tasks): record a task failure with an explicit retry decision - #2161

Merged
c-thiel merged 2 commits into
mainfrom
ct/task-record-failure-with-decision
Oct 23, 2026
Merged

c-thiel merged 2 commits into
mainfrom
ct/task-record-failure-with-decision

Conversation

@c-thiel

@c-thiel c-thiel commented Oct 23, 2026 •

Copy link
Copy Markdown
Member

Adds SpecializedTask::record_failure_with_decision, which records a failed task attempt with a RetryDecision chosen by the worker, whatever the queue's retry policy says. A worker can use it to end a task without a retry, for example after a run that stopped at its time limit or that already committed its result. It can also use it to schedule a retry with its own backoff and resource demand. record_failure works as before and now delegates to it, so the retry loop that records a failure exists once. The HTTP API, the database and the audit log do not change.

Summary by CodeRabbit

  • New Features
    • Task workers can now explicitly choose whether a failed task should be retried or marked as failed, including setting retry backoff and resource demand. Queue retry limits still apply, so tasks reaching the configured maximum are recorded as failed.
  • Bug Fixes
    • Explicit failure decisions now take precedence over the queue’s retry policy when recording task failures.

Adds SpecializedTask::record_failure_with_decision, which records a failed task attempt with a RetryDecision chosen by the worker, whatever the queue's retry policy says. A worker can use it to end a task without a retry, for example after a run that stopped at its time limit or that already committed its result. It can also use it to schedule a retry with its own backoff and resource demand. record_failure works as before and now delegates to it, so the retry loop that records a failure exists once. The HTTP API, the database and the audit log do not change.
@coderabbitai

coderabbitai Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: d2fb6db4-d0b5-4af4-addb-534d63942f20
📥 Commits

Reviewing files that changed from the base of the PR and between e3bb4d1 and c2973fd.

📒 Files selected for processing: 2
  • crates/lakekeeper-storage-postgres/src/tasks.rs
  • crates/lakekeeper/src/service/tasks/mod.rs

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 2 remain after this review.

Walkthrough

Workers can supply a retry decision when recording a task failure. The queue’s max_retries still limits retries. PostgreSQL tests verify explicit give-up and retry decisions, including retry limits.

Changes

Task Retry Decisions

Layer / File(s) Summary
Failure decision recording
crates/lakekeeper/src/service/tasks/mod.rs, crates/lakekeeper-storage-postgres/src/tasks.rs
record_failure now gets its decision from the queue’s retry policy and delegates to record_failure_with_decision. The new method records a supplied decision while retaining the queue’s max_retries. Tests check explicit give-up and retry decisions, backoff, resource demand, and behavior at the retry limit.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Feature

Merge Risk: ⚪ Minimal · up to c2973

The explicit retry-decision API has no identified merge-blocking issue. Normal checks can proceed.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 63.64% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 11 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "feat(tasks): record a task failure with an explicit retry decision" matches the main change. The PR adds SpecializedTask::record_failure_with_decision, which accepts a RetryDecision directl…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "feat(tasks): record a task failure with an explicit retry decision" matches the main change. The PR adds SpecializedTask::record_failure_with_decision, which accepts a RetryDecision directly, and record_failure delegates to it. The raw summary also confirms the new test covers the explicit decision overriding the queue's retry policy. The title is specific and concise, and it follows a conventional commit style.

✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

I’m a rabbit with a task to tend,
A clear retry choice to send.
Give up, or wait, then try once more,
The retry limit guards the door.
I nibble clover, pleased with the score.

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

@c-thiel
c-thiel enabled auto-merge (squash) October 23, 2026 10:22
@github-actions

Copy link
Copy Markdown
Contributor

✅ PR Title Formatted Correctly

The title of this PR match the correct format. Thank you!

@c-thiel
c-thiel merged commit 5526753 into main Oct 23, 2026
87 of 89 checks passed
@c-thiel
c-thiel deleted the ct/task-record-failure-with-decision branch October 23, 2026 13:06
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