Skip to content

refactor: group PhaseContext into services/io/callbacks sub-objects#77

Merged
jafreck merged 1 commit intomainfrom
refactor/phase-context-grouping
Feb 23, 2026
Merged

refactor: group PhaseContext into services/io/callbacks sub-objects#77
jafreck merged 1 commit intomainfrom
refactor/phase-context-grouping

Conversation

@jafreck
Copy link
Copy Markdown
Owner

@jafreck jafreck commented Feb 23, 2026

Summary

Reorganizes the flat PhaseContext type 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) — shared launchWithRetry() 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 shared launchWithRetry() helper, significantly reducing boilerplate.

Other updated filesissue-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 PhaseContext structure.

Stats

31 files changed, 1026 insertions(+), 720 deletions(-)

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.
@jafreck jafreck merged commit dd0f338 into main Feb 23, 2026
2 checks passed
@jafreck jafreck deleted the refactor/phase-context-grouping branch February 23, 2026 05:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant