Skip to content

refactor(consensus): Move Forkchoice Finalize Off Queue#2536

Draft
refcell wants to merge 1 commit intorf/refactor/direct-engine-consolidatefrom
rf/refactor/direct-engine-forkchoice-finalize
Draft

refactor(consensus): Move Forkchoice Finalize Off Queue#2536
refcell wants to merge 1 commit intorf/refactor/direct-engine-consolidatefrom
rf/refactor/direct-engine-forkchoice-finalize

Conversation

@refcell
Copy link
Copy Markdown
Contributor

@refcell refcell commented May 5, 2026

Summary

Move delegated forkchoice and finalized-head updates onto direct Engine methods. The engine processor now executes those paths directly and maps errors through the existing engine task severity handling. The old task wrappers remain as compatibility shells so the queue machinery can be deleted in the next stage without mixing behavior changes into this PR.

Move delegated forkchoice and finalized-head updates onto direct Engine methods. Route the engine processor through those methods and leave the old task wrappers as compatibility shells until the queue machinery is deleted in the next stage.

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 5:23pm

Request Review

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 5, 2026

Review Summary

Clean refactoring that moves delegated forkchoice and finalize logic from the task queue path into direct Engine methods, while keeping the old task wrappers as thin compatibility shells.

Verified:

  • Retry semantics preserved: both delegated_forkchoice() and finalize() retry Temporary errors internally with yield_now(), matching the existing EngineTask::execute() retry loop. Non-temporary errors propagate to handle_engine_task_error() as before.
  • No double-retry: the _with_state methods called by both the task wrappers and the new direct methods do not contain retry loops themselves.
  • Error type hierarchy is sound: DelegatedForkchoiceTaskError has From<ConsolidateTaskError> and From<FinalizeTaskError>; FinalizeTaskError has From<SynchronizeTaskError>. Severity delegation is correct.
  • State broadcasting: state_sender.send_replace() only fires on success in the new direct methods, consistent with the existing pattern for build(), consolidate(), and insert_payload_with_retry().
  • Idempotency on retry: if consolidate_with_state succeeds but finalize_with_state fails with a Temporary error inside delegated_forkchoice, the retry re-runs consolidation on already-updated state — this is safe because consolidation is idempotent (same behavior as the old task-based path).
  • Safe head notifications: happen on the next loop iteration via drain()send_derivation_actor_safe_head_if_updated(), same as all other already-migrated direct methods.

No issues found.

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