Skip to content

Commit eeeb666

Browse files
cailmdaleyclaude
andcommitted
shuttle-ctl resume: file review-comment so dispatcher takes resume path
check_resume_intent/3 reads the latest --kind review-comment event for payload.resume_mode == "previous" to decide whether to invoke `claude --resume <uuid>`. Without this event, CLI-resumed fibers always got a fresh worker even when shuttle.session.id was set — the resume path was unreachable from CLI. Kanban worked because it writes the review-comment correctly; CLI didn't. Fix: after writing the block in the non-standing resume path, if shuttle.session.id is set, file a review-comment with resume_mode=previous. Mirrors exactly what the kanban's "Resume previous" button does. New helper: appendFeltHistoryReviewComment(host, fiberID, summary, resumeMode) in history.go — same best-effort pattern as appendFeltHistory but adds --kind review-comment + --field resume_mode. Relies on the felt fix (commit 4166815) that allows --summary "". Integration test coverage: dispatch_integration_test.exs "CLI resume after fix: review-comment filed → --resume in run-script" Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 7c0aac5 commit eeeb666

2 files changed

Lines changed: 28 additions & 0 deletions

File tree

cmd/shuttle/history.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,19 @@ func appendFeltHistory(host, fiberID, summary string) error {
1313
_ = cmd.Run()
1414
return nil
1515
}
16+
17+
// appendFeltHistoryReviewComment files a `--kind review-comment` event so the
18+
// dispatcher's check_resume_intent/3 can read resume_mode from the latest event.
19+
// Summary may be empty (felt ≥ commit 4166815 accepts --summary "").
20+
func appendFeltHistoryReviewComment(host, fiberID, summary, resumeMode string) error {
21+
if host == "" {
22+
return nil
23+
}
24+
cmd := exec.Command("felt", "-C", host, "history", "append", fiberID,
25+
"--kind", "review-comment",
26+
"--summary", summary,
27+
"--field", "resume_mode="+resumeMode,
28+
)
29+
_ = cmd.Run()
30+
return nil
31+
}

cmd/shuttle/lifecycle.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,18 @@ closed fiber back into active work.`,
106106
fmt.Printf(" status: %s → active\n", statusBefore)
107107
}
108108
}
109+
110+
// File a review-comment so the dispatcher's check_resume_intent/3
111+
// can detect resume intent. Without this event the dispatcher always
112+
// takes the fresh path — shuttle.session.id alone is insufficient
113+
// because check_resume_intent reads only the latest review-comment.
114+
// Mirror what the kanban's "Resume previous" button does.
115+
if f.Block.Session != nil && f.Block.Session.ID != "" {
116+
sessionID := f.Block.Session.ID
117+
summary := "resumed via shuttle-ctl; session " + sessionID + " available for reattach"
118+
_ = appendFeltHistoryReviewComment(host, fiberID, summary, "previous")
119+
fmt.Printf(" resume_mode: previous (session %s)\n", sessionID)
120+
}
109121
return nil
110122
},
111123
}

0 commit comments

Comments
 (0)