Skip to content

refactor(runtime): route turn producers through dispatcher - #942

Closed
Neonforge98 wants to merge 1 commit into
codex/turn-dispatch-servicefrom
codex/turn-producer-migration
Closed

refactor(runtime): route turn producers through dispatcher#942
Neonforge98 wants to merge 1 commit into
codex/turn-dispatch-servicefrom
codex/turn-producer-migration

Conversation

@Neonforge98

Copy link
Copy Markdown
Collaborator

Problem

Agent turn producers currently own overlapping copies of optimistic status, turn-generation reservation, transport dispatch, activity timestamps, and terminal waiting. Composer, queue, side chat, mode-switch resume, plan execution, Work Item retry, and address-comments can therefore drift in idempotency and finality behavior.

Solution

  • Route interactive and headless Agent sends through the canonical TurnDispatchService introduced by the stacked dispatcher PR.
  • Preserve UI-specific transcript writes at the producer boundary while deleting duplicated transport/FSM bookkeeping.
  • Make address-comments wait for the exact dispatched intent outcome instead of maintaining a second terminal watcher.
  • Keep durable WorkItemRun retry as the primary path and route only the legacy local-session fallback through canonical dispatch.
  • Leave Team Chat and its human-message plane unchanged; audience routing remains owned by the separate routing PR.

Potential risks

Validation

  • pnpm typecheck
  • ESLint and Prettier on all 16 changed files
  • 8 focused Vitest files, 40 tests passed
  • Madge scan from the migrated entry points: 984 files, no circular dependency
  • Repository commit hooks passed

Migrate composer, queue, headless, retry, resume, and address-comment turn producers onto TurnDispatchService. Remove duplicated optimistic/FSM/finality wiring while keeping transcript writes and Team Chat routing at their existing boundaries.
@Harry19081 Harry19081 added refactor Code restructuring without an intended behavior change agent Agent runtime, behavior, memory, providers, or orchestration chat Chat, composer, markdown, canvas, browser, or terminal surfaces labels Aug 25, 2026
@Neonforge98

Copy link
Copy Markdown
Collaborator Author

Superseded by the final two-PR design: #844 removes the Work Item-specific remote continuation bridge, and stacked #939 keeps the reusable audience routing plus sender-local provider-native continuation. This dispatcher/store/handoff stack is intentionally retired.

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

Labels

agent Agent runtime, behavior, memory, providers, or orchestration chat Chat, composer, markdown, canvas, browser, or terminal surfaces refactor Code restructuring without an intended behavior change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants