Skip to content

fix: queue-storage cancel_by_unique_key for running jobs (cut 0.6.0-rc.4)#359

Merged
hardbyte merged 3 commits into
mainfrom
fix/queue-storage-cancel-by-unique-key
Jun 29, 2026
Merged

fix: queue-storage cancel_by_unique_key for running jobs (cut 0.6.0-rc.4)#359
hardbyte merged 3 commits into
mainfrom
fix/queue-storage-cancel-by-unique-key

Conversation

@hardbyte

Copy link
Copy Markdown
Owner

Problem

On the queue-storage engine, admin::cancel_by_unique_key and cancel_by_unique_key_tx failed at plan time with:

column "unique_key" does not exist

so cancel-by-unique-key was unusable whenever queue storage was the active engine. The canonical engine was unaffected — it uses a separate candidate query against jobs_hot / scheduled_jobs.

Root cause

unique_key_candidate_sql unions three lookups — available (ready_entries), deferred (deferred_jobs), and running (leases). The running-job branch read leases.unique_key, but the leases substrate table has no unique_key column (only ready_entries, deferred_jobs, and done_entries carry it). PostgreSQL rejects the whole statement during planning, independent of whether any row matches.

Fix

Recover the running job's key by joining each lease back to its originating ready_entries row via the lane identity (ready_slot, ready_generation, queue, priority, enqueue_shard, lane_seq) — the same join queue_storage_current_jobs_cte already uses — and match ready.unique_key.

Test

New test_admin_cancel_by_unique_key_queue_storage_active activates the queue-storage engine and exercises both the pool and transaction entry points, asserting Ok(None) when nothing matches. It reproduces the failure (column "unique_key" does not exist) on the pre-fix code and passes after. Full integration_test suite green (44 tests); fmt / clippy -D warnings / build clean.

Cuts 0.6.0-rc.4.

hardbyte added 2 commits June 30, 2026 10:04
The candidate lookup's running-job branch read `unique_key` directly
from `{schema}.leases`, but the `leases` table carries no `unique_key`
column, so any `cancel_by_unique_key` / `cancel_by_unique_key_tx`
issued while queue storage was the active engine failed at plan time
with `column "unique_key" does not exist`.

Recover the key by joining each lease back to its originating
`ready_entries` row, the same lane-identity join already used by the
queue-storage jobs-compat view. Canonical-engine behaviour is
unchanged.

Add a queue-storage-active regression test covering both the pool and
transaction entry points; it fails at plan time before this change.
@coderabbitai

coderabbitai Bot commented Jun 29, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@hardbyte, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 58 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 787440e6-fb3d-4e10-a669-cbaac2da7e5d

📥 Commits

Reviewing files that changed from the base of the PR and between 7b568c9 and 072234a.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (10)
  • CHANGELOG.md
  • Cargo.toml
  • awa-cli/Cargo.toml
  • awa-cli/pyproject.toml
  • awa-model/src/admin.rs
  • awa-python/Cargo.toml
  • awa-python/pyproject.toml
  • awa-seaorm/Cargo.toml
  • awa/Cargo.toml
  • awa/tests/integration_test.rs

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.

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