Skip to content

Worker extraction (Plan 2)#16

Draft
knutties wants to merge 8 commits into
feat/embedded-modefrom
feat/worker-extraction
Draft

Worker extraction (Plan 2)#16
knutties wants to merge 8 commits into
feat/embedded-modefrom
feat/worker-extraction

Conversation

@knutties

@knutties knutties commented May 7, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Moves the worker pipeline (poller, pipeline, backoff, dispatcher) from crates/worker/ into crates/embedded-worker/.
  • Introduces Worker::builder(pool) + WorkerHandle, with library defaults system_schema = "kronos" / tenant_schema_prefix = "kronos_" and binary-side from_app_config(&AppConfig) preserving service-mode public / "".
  • kronos-worker becomes a binary-only crate (~15 lines).
  • Worker::build() validates SchemaConfig and probes the system schema's organizations and workspaces tables, failing fast on misconfiguration.
  • Behavior is preserved: same poll cadence, same claim semantics, same retry/backoff math, same dispatcher logic, same metrics names and labels.

Stacked PR context

This PR targets feat/embedded-mode (Plan 1). It will be merged after the Plan 1 PR; reviewers should diff against feat/embedded-mode, not main.

Test plan

  • cargo build --workspace --all-features (with --exclude kronos-dashboard; the dashboard --all-features failure is pre-existing on feat/embedded-mode)
  • cargo test --workspace --lib (with --test-threads=1 and kronos-mock-server running on :9999; both requirements pre-existing)
  • cargo test -p kronos-embedded-worker --test builder -- --ignored --test-threads=1
  • cargo test -p kronos-embedded-worker --test shutdown -- --ignored --test-threads=1
  • just test-immediate
  • just test-delayed
  • just test-cron
  • just test-e2e — pre-existing failure: kronos-scheduler crate not yet in workspace on this branch (identical on parent feat/embedded-mode); not a Plan 2 regression.

Spec

docs/superpowers/specs/2026-04-29-kronos-embedded-mode-design.md — Plan 2.

knutties and others added 8 commits May 1, 2026 00:26
… from worker

Relocate the worker pipeline modules into kronos-embedded-worker so the
poller, pipeline, dispatcher (with http/kafka/redis_stream submodules),
and backoff helpers live in the embeddable crate. Module contents are
unchanged; the existing crate::backoff and crate::dispatcher sibling
imports continue to resolve. kronos-worker keeps a thin lib.rs shim that
re-exports kronos_embedded_worker::poller so main.rs's call to
kronos_worker::poller::run still resolves; the kafka/redis-stream
features and their optional deps are kept on the worker manifest as
no-op feature surface until Task 6 collapses them into feature
pass-through.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Adds Drop impl that aborts the spawned task (matching the
documented contract; tokio::JoinHandle::drop alone detaches
rather than aborts). Tightens the oneshot send-error comment
and notes the mid-claim drain test gap covered by Task 7.
@coderabbitai

coderabbitai Bot commented May 7, 2026

Copy link
Copy Markdown

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

Run ID: fbda23a1-cee7-4877-b5a8-17a55000eaee

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
  • Commit unit tests in branch feat/worker-extraction

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


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 and usage tips.

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