Repository navigation
Split routing controller into stage, classification, and observation modules - #11908
Conversation
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
There was a problem hiding this comment.
🔵 Needs a closer look
The asynchronous routing refactor requires integration-level review of how classifier retries interact with shared deadlines, cancellation, pinned eligibility, final guards, and observation behavior across provider paths.
No open issues 🎉
What changed in this PR
This PR separates the API proxy’s routing workflow into focused modules, leaving sequencing and route selection in the controller while preserving its public interface.
Changes:
- Extracts bounded preparation stages and classifier execution logic.
- Centralizes classification-attempt, selection, and failure records.
- Adds focused unit tests and packages the new modules in the Docker image.
| File | Description |
|---|---|
containers/api-proxy/routing-stages.test.js |
Tests preparation, validation, deadlines, and cancellation. |
containers/api-proxy/routing-stages.js |
Extracts health, capabilities, candidates, and immutable conversation loading. |
containers/api-proxy/routing-observation-records.test.js |
Tests record fields and observer-failure isolation. |
containers/api-proxy/routing-observation-records.js |
Centralizes attempt, selection, and failure records. |
containers/api-proxy/routing-controller.js |
Delegates extracted logic while retaining sequencing, selection, and constants. |
containers/api-proxy/routing-classify.test.js |
Tests classifier requests, capacity checks, retries, and terminal failures. |
containers/api-proxy/routing-classify.js |
Extracts classifier planning, execution, and output validation. |
containers/api-proxy/Dockerfile |
Includes the extracted modules in the container image. |
Review effort: Max (adaptive)
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
|
✅ Copilot review passed with no inline comments. @lpcox Add the |
| conversation, pool, planner, executor, observer, eligibilityRequest, | ||
| callPlanner, signal, deadline, clock, attemptTimeoutMs, maxAttempts, purpose, | ||
| }) { | ||
| const sanitizedConversation = sanitizeConversationPayload(conversation); |
|
@copilot merge main, resolve conflicts, and address review feedback |
…t-creatoroutingcontroller-execute Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Merged main in |
execute()combines bounded preparation, classifier retries, route selection, and observation construction. This refactor separates those concerns while preserving routing behavior.routing-stages.js.routing-classify.js.routing-observation-records.js, preserving fields and observer-failure isolation.