Skip to content

Find aged running jobs and read get_job from one snapshot (0.6) - #603

Merged
hardbyte merged 3 commits into
release/0.6.6from
ccr-37ca53f6-xza211-aged-lease-06
Nov 6, 2026
Merged

hardbyte merged 3 commits into
release/0.6.6from
ccr-37ca53f6-xza211-aged-lease-06

Conversation

@hardbyte

@hardbyte hardbyte commented Nov 4, 2026

Copy link
Copy Markdown
Owner

Backport of #600 to the 0.6 line. Rust only: no migration, no schema patch, no public API change.

The bug on 0.6.11

Claims and leases record a job's aged effective priority; its ready row keeps the lane priority. Three reads joined them on ready.priority = lease.priority:

Read Effect when the job had aged before its claim
load_job (get_job, admin job detail, lifecycle events) read back in the wrong state
callback_job_in_tx callback completion with an expected kind finds no job; the mixed-transition routing check misses it
load_active_lease_in_tx the parked row after entering a callback wait isn't reloaded

Priority aging is on by default (every 60 s), so any job that waited more than a minute at priority 2–4 before its claim is affected. The joins now match the attempt (job_id and run_lease + 1), which the substrate already relies on.

load_job also reads its seven relations in one REPEATABLE READ, READ ONLY transaction, so a job moving between two of them during the read can't come back missing.

The two remaining ready.priority = claims.priority joins on this branch are claim-cursor probes, which compare lane priorities and are correct.

Tests (local, PG16)

  • The two new tests fail on 0.6.11's queue_storage.rs (wrong load_job state for a materialized lease, no callback match for a receipt claim) and pass with the fix.
  • queue_storage_runtime_test 129/129, cel_callback_test 19, external_wait_test 38, lifecycle_hook_test 18.
  • cargo fmt --check and clippy -D warnings on awa-model are clean.

CHANGELOG has the entry under Unreleased.


Generated by Claude Code

Backport of #600. Claims and leases record the aged effective priority
while the ready row keeps the lane priority; load_job,
load_active_lease_in_tx and callback_job_in_tx joined the two on priority,
so with priority aging on a job that had aged before its claim could not be
found by callback or read back as running. Match the attempt by job_id and
run_lease instead, and read load_job's relations from one REPEATABLE READ,
READ ONLY snapshot.
@hardbyte hardbyte added the full-ci Run the full CI matrix (Python build+test, E2E) on this PR label Nov 4, 2026 — with Claude
@coderabbitai

coderabbitai Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

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: 9ce3efa4-74f5-4d72-a4a8-9edaa6eac427

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • 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

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-04T14:46:28.206729Z a6680d8 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

…-xza211-aged-lease-06

# Conflicts:
#	CHANGELOG.md
#	awa/tests/queue_storage_runtime_test.rs
The admin current-jobs, recent-jobs and kind-count CTEs, the job-id
candidates behind list_jobs and the unique-key cancel lookup joined a
materialized lease to its ready row on priority. A lease records the aged
effective priority, so a job that aged before its claim was missing from the
job list and kinds page and was not found by cancel_by_unique_key. Match the
attempt by job_id and run_lease instead, and add a regression test.
@hardbyte
hardbyte merged commit 3e8c694 into release/0.6.6 Nov 6, 2026
30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

full-ci Run the full CI matrix (Python build+test, E2E) on this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants