Skip to content

fix(deriver): keep active work unit claims alive#930

Draft
PraveenKumarSridhar wants to merge 1 commit into
plastic-labs:mainfrom
PraveenKumarSridhar:fix/queue-claim-heartbeat
Draft

fix(deriver): keep active work unit claims alive#930
PraveenKumarSridhar wants to merge 1 commit into
plastic-labs:mainfrom
PraveenKumarSridhar:fix/queue-claim-heartbeat

Conversation

@PraveenKumarSridhar

Copy link
Copy Markdown

Summary

  • heartbeat exact ActiveQueueSession claims while long-running queue work executes
  • fail closed when ownership is lost or heartbeat database operations stall
  • require exact claim ownership before marking queue items processed or errored
  • emit queue.empty only after a clean queue drain
  • cover dream, summary, and representation processing races

Closes #794

Test plan

  • 112 passed — deriver and DB-resilience suites
  • uv run ruff check src/ tests/
  • uv run basedpyright
  • uv run pre-commit run --files src/deriver/queue_manager.py tests/deriver/test_queue_processing.py

The full pytest run stops at TestDocumentCRUD::test_duplicate_rejection_reinforces_existing when no OpenAI API key is configured. The identical failure was reproduced on clean upstream/main.

Heartbeat exact queue claims during long-running work and fail closed when ownership cannot be proven. Guard completion writes and queue-empty webhooks against replacement-claim races.
@coderabbitai

coderabbitai Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Draft detected.

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

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 97714d9e-0714-41de-ab53-be7f9baa4afa

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
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

[Bug] Dream tasks outlive the stale work-unit claim timeout, spawning duplicate concurrent dream cycles for the same peer

1 participant