Skip to content

Commit 68d2e78

Browse files
author
Test
committed
feat: add progress reporting to Symphony executor
- Report progress for each movement via WebSocket and HTTP - Export ReportProgress, ReportError, ReportComplete methods - Add movement-level progress to Live Dashboard
1 parent 9ed0d52 commit 68d2e78

File tree

2 files changed

+35
-14
lines changed

2 files changed

+35
-14
lines changed

internal/autonomous/symphony.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,16 +112,22 @@ func (e *Executor) Execute(ctx context.Context, task string) error {
112112
for i, movement := range symphony.Movements {
113113
symphony.CurrentMovement = i
114114

115+
movementMsg := fmt.Sprintf("Movement %d/%d: %s", i+1, len(symphony.Movements), movement.Name)
115116
fmt.Printf("Movement %d/%d: %s\n", i+1, len(symphony.Movements), movement.Name)
116117
fmt.Printf(" Goal: %s\n", movement.Goal)
117118

119+
// Report progress to Live Dashboard
120+
e.maestro.ReportProgress("symphony", movementMsg)
121+
118122
err := e.executeMovement(ctx, &symphony.Movements[i])
119123
if err != nil {
120124
symphony.Status = "failed"
125+
e.maestro.ReportError("symphony", fmt.Sprintf("Movement %d failed: %v", i+1, err))
121126
return fmt.Errorf("movement %d failed: %w", i+1, err)
122127
}
123128

124129
fmt.Printf(" [OK] Movement %d complete\n\n", i+1)
130+
e.maestro.ReportProgress("symphony", fmt.Sprintf("Movement %d complete", i+1))
125131

126132
// Save checkpoint (enable resume)
127133
if err := e.saveCheckpoint(symphony); err != nil {

internal/maestro/conductor.go

Lines changed: 29 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,23 @@ func (c *Conductor) SetProgressCallback(callback ProgressCallback) {
7777
c.progressCallback = callback
7878
}
7979

80-
// reportProgress sends progress to Live Dashboard via HTTP and WebSocket, and calls progress callback
81-
func (c *Conductor) reportProgress(phase string, details string) {
80+
// ReportProgress sends progress to Live Dashboard via HTTP and WebSocket, and calls progress callback
81+
func (c *Conductor) ReportProgress(phase string, details string) {
82+
c.sendProgress(phase, details)
83+
}
84+
85+
// ReportError sends error to Live Dashboard
86+
func (c *Conductor) ReportError(phase string, errMsg string) {
87+
c.sendError(phase, errMsg)
88+
}
89+
90+
// ReportComplete sends completion to Live Dashboard
91+
func (c *Conductor) ReportComplete(success bool, summary string) {
92+
c.sendComplete(success, summary)
93+
}
94+
95+
// sendProgress internal helper
96+
func (c *Conductor) sendProgress(phase string, details string) {
8297
msg := phase + ": " + details
8398

8499
// Send via HTTP API (backup/reliability)
@@ -100,8 +115,8 @@ func (c *Conductor) reportProgress(phase string, details string) {
100115
}
101116
}
102117

103-
// reportError sends error to Live Dashboard
104-
func (c *Conductor) reportError(phase string, errMsg string) {
118+
// sendError internal helper
119+
func (c *Conductor) sendError(phase string, errMsg string) {
105120
// Send via HTTP API
106121
if c.liveReportConfig != nil {
107122
c.liveReportConfig.Step(phase+": ERROR - "+errMsg, "error")
@@ -116,8 +131,8 @@ func (c *Conductor) reportError(phase string, errMsg string) {
116131
}
117132
}
118133

119-
// reportComplete sends completion to Live Dashboard
120-
func (c *Conductor) reportComplete(success bool, summary string) {
134+
// sendComplete internal helper
135+
func (c *Conductor) sendComplete(success bool, summary string) {
121136
stepType := "complete"
122137
if !success {
123138
stepType = "failed"
@@ -182,11 +197,11 @@ func (c *Conductor) ExecuteTask(ctx context.Context, task string, complexity str
182197
planner := agents.NewPlanner(planProvider, planModel)
183198

184199
fmt.Println("Creating plan...")
185-
c.reportProgress("planning", "Creating plan")
200+
c.ReportProgress("planning", "Creating plan")
186201
start := time.Now()
187202
plan, err := planner.CreatePlan(ctx, task, "", nil)
188203
elapsed := time.Since(start)
189-
c.reportProgress("planning", "Plan created")
204+
c.ReportProgress("planning", "Plan created")
190205
c.selector.RecordUsage(planBackend, planModel, err == nil, errorMsg(err))
191206
if err != nil {
192207
return fmt.Errorf("planning failed: %w", err)
@@ -231,9 +246,9 @@ func (c *Conductor) ExecuteTask(ctx context.Context, task string, complexity str
231246
attempt := c.loopDetector.Iteration
232247
if attempt > 1 {
233248
fmt.Printf("Retrying (attempt %d)...\n", attempt)
234-
c.reportProgress("retry", fmt.Sprintf("Attempt %d", attempt))
249+
c.ReportProgress("retry", fmt.Sprintf("Attempt %d", attempt))
235250
} else {
236-
c.reportProgress("editing", "Starting code changes")
251+
c.ReportProgress("editing", "Starting code changes")
237252
}
238253

239254
// Select model for editing
@@ -258,11 +273,11 @@ func (c *Conductor) ExecuteTask(ctx context.Context, task string, complexity str
258273

259274
// Execute with editor
260275
fmt.Println("Executing changes...")
261-
c.reportProgress("editing", "Executing code changes")
276+
c.ReportProgress("editing", "Executing code changes")
262277
start = time.Now()
263278
result, modifiedFiles, err := editor.Execute(ctx, history, nil)
264279
elapsed = time.Since(start)
265-
c.reportProgress("editing", fmt.Sprintf("Completed - %d files changed", len(modifiedFiles)))
280+
c.ReportProgress("editing", fmt.Sprintf("Completed - %d files changed", len(modifiedFiles)))
266281
c.selector.RecordUsage(editBackend, editModel, err == nil, errorMsg(err))
267282
if err != nil {
268283
// LoopDetector will handle max iterations check on next iteration
@@ -350,11 +365,11 @@ func (c *Conductor) ExecuteTask(ctx context.Context, task string, complexity str
350365

351366
// Validate
352367
fmt.Println("Validating...")
353-
c.reportProgress("validation", "Running tests and checks")
368+
c.ReportProgress("validation", "Running tests and checks")
354369
start = time.Now()
355370
review, err := reviewer.Review(ctx, plan, modifiedFiles, nil)
356371
elapsed = time.Since(start)
357-
c.reportProgress("validation", "Validation complete")
372+
c.ReportProgress("validation", "Validation complete")
358373
c.selector.RecordUsage(reviewBackend, reviewModel, err == nil, errorMsg(err))
359374
if err != nil {
360375
// LoopDetector will handle max iterations check on next iteration

0 commit comments

Comments
 (0)