refactor: group PhaseContext into services/io/callbacks sub-objects#77
Merged
refactor: group PhaseContext into services/io/callbacks sub-objects#77
Conversation
Reorganize the flat PhaseContext type into three cohesive sub-objects: - services: cross-cutting execution services (launcher, retryExecutor, tokenTracker, contextBuilder, resultParser, logger) - io: persistence and I/O dependencies (progressDir, progressWriter, checkpoint, commitManager) - callbacks: orchestrator-injected callbacks (recordTokens, checkBudget, updateProgress) Add src/executors/helpers.ts with a shared launchWithRetry() helper that consolidates the budget-check / launch / token-record / retry pattern that was duplicated across every phase executor. Add src/util/failure-parser.ts to extract structured failure information from agent error output. Update all phase executors (analysis, implementation, integration, planning, pr-composition) to use the new grouped context shape and the shared launchWithRetry() helper, significantly reducing boilerplate. Update issue-orchestrator.ts, fleet-orchestrator.ts, phase-executor.ts, phase-registry.ts, issue-notifier.ts, notifications/manager.ts, and logging/events.ts to match the new signatures and surface additional notification/event types. Update all affected tests to reflect the new PhaseContext structure.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Reorganizes the flat
PhaseContexttype into three cohesive sub-objects to improve clarity and reduce constructor sprawl.Changes
src/core/phase-executor.ts— introduces three new types:PhaseServices— cross-cutting execution services (launcher,retryExecutor,tokenTracker,contextBuilder,resultParser,logger)PhaseIO— persistence and I/O dependencies (progressDir,progressWriter,checkpoint,commitManager)PhaseCallbacks— orchestrator-injected callbacks (recordTokens,checkBudget,updateProgress)src/executors/helpers.ts(new) — sharedlaunchWithRetry()helper that consolidates the budget-check / launch / token-record / retry pattern duplicated across every phase executor.src/util/failure-parser.ts(new) — extracts structured failure information from agent error output.Phase executors (
analysis,implementation,integration,planning,pr-composition) — updated to use the new grouped context shape and the sharedlaunchWithRetry()helper, significantly reducing boilerplate.Other updated files —
issue-orchestrator.ts,fleet-orchestrator.ts,phase-registry.ts,issue-notifier.ts,notifications/manager.ts,logging/events.ts— updated to match new signatures and surface additional notification/event types.Tests — all affected test files updated to reflect the new
PhaseContextstructure.Stats
31 files changed, 1026 insertions(+), 720 deletions(-)