Skip to content

refactor(consensus): Delete Engine Task Queue#2538

Draft
refcell wants to merge 1 commit intorf/refactor/direct-engine-forkchoice-finalizefrom
rf/refactor/delete-engine-task-queue
Draft

refactor(consensus): Delete Engine Task Queue#2538
refcell wants to merge 1 commit intorf/refactor/direct-engine-forkchoice-finalizefrom
rf/refactor/delete-engine-task-queue

Conversation

@refcell
Copy link
Copy Markdown
Contributor

@refcell refcell commented May 5, 2026

Summary

Delete the remaining engine priority queue, task enum, trait dispatch, enqueue, drain, and delegated/finalize wrapper structs. The engine processor now publishes direct-operation state changes without a pre-drain step, and Engine is a non-generic state owner with generic methods for the client-specific calls. The legacy dev queue-length RPC now reports zero without carrying queue state through the engine actor.

Delete the remaining engine priority queue, task enum, trait dispatch, enqueue, drain, and thin delegated/finalize wrappers. Make Engine a non-generic state owner with generic direct methods, and keep only a small severity helper plus processor-local operation error mapping for reset/flush/critical handling.

Co-authored-by: Codex <noreply@openai.com>
@refcell refcell added consensus Area: consensus stacked Meta: Stacked PR labels May 5, 2026
@refcell refcell self-assigned this May 5, 2026
@vercel
Copy link
Copy Markdown

vercel Bot commented May 5, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
base Ignored Ignored May 5, 2026 6:12pm

Request Review

Comment on lines +138 to +143
Self::QueueLengthReceiver(subscription) => {
let (_, queue_length_recv) = tokio::sync::watch::channel(0);
subscription
.send(queue_length_recv)
.map_err(|_| EngineQueriesError::OutputChannelClosed)
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The sender (_) from watch::channel(0) is immediately dropped. When the dev RPC subscriber calls wait_for on this receiver (in dev.rs:80), it will get Err(RecvError) immediately because the sender is gone, causing the subscription loop to exit and log a "Subscription to engine queue size has been closed" warning on every subscription attempt.

If this is intentional stub behavior for a deprecated API, consider either:

  1. Documenting why the sender is intentionally dropped (e.g., a comment explaining the legacy stub), or
  2. Keeping the sender alive so the subscription hangs (returning 0 forever) rather than erroring out — which might be friendlier to existing callers expecting a live subscription.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 5, 2026

Review Summary

Clean refactor that removes the EngineTask enum, EngineTaskExt trait, BinaryHeap queue, drain() loop, and associated wrapper structs (DelegatedForkchoiceTask, FinalizeTask). Engine operations are now called directly on Engine methods, and the Engine struct is no longer generic over EngineClient_ — the generic is pushed to method-level where needed. The EngineTaskErrors enum is relocated from the engine crate to the service crate as EngineOperationError.

Findings:

  1. QueueLengthReceiver stub drops watch sender immediately (query.rs:138-143) — The legacy dev RPC QueueLengthReceiver handler creates a watch::channel(0) and immediately drops the sender. This causes existing dev RPC subscribers to see an immediate RecvError from wait_for, terminating the subscription loop and logging a warning on every attempt. Left an inline comment with suggestions.

No other correctness, safety, or concurrency issues found. The retry-on-temporary-error loops that previously lived in the deleted EngineTask::execute are preserved in the direct Engine methods (build, consolidate, delegated_forkchoice, finalize, insert_payload_with_retry). The Box::pin(build_and_seal(...)) addition in seal/task.rs correctly breaks the indirect async recursion. Test updates are consistent with the API changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

consensus Area: consensus stacked Meta: Stacked PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant