Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions internal/loop/opencode_parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,11 @@ func ParseLineOpenCode(line string) *Event {
}

case "step_finish":
if ev.Part == nil {
return nil
}
if ev.Part.Reason == "stop" {
return &Event{Type: EventComplete}
}
// step_finish signals the end of a single agent step, not the end of the PRD.
// Per-story completion is signaled via the <chief-done/> text marker (handled in
// the "text" case above). Overall PRD completion is emitted by the loop when
// NextStory() returns nil. Mapping reason=="stop" to EventComplete here would
// fire the completion screen after every story.
return nil

case "error":
Expand Down
7 changes: 2 additions & 5 deletions internal/loop/opencode_parser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,8 @@ func TestParseLineOpenCode_text(t *testing.T) {
func TestParseLineOpenCode_stepFinishStop(t *testing.T) {
line := `{"type":"step_finish","timestamp":1767036064273,"sessionID":"ses_494719016ffe85dkDMj0FPRbHK","part":{"id":"prt_b6b8e9209001ojZ4ECN1geZISm","sessionID":"ses_494719016ffe85dkDMj0FPRbHK","messageID":"msg_b6b8e8627001yM4qKJCXdC7W1L","type":"step-finish","reason":"stop","snapshot":"09dd05d11a4ac013136c1df10932efc0ad9116e8","cost":0.001,"tokens":{"input":671,"output":8,"reasoning":0,"cache":{"read":21415,"write":0}}}}`
ev := ParseLineOpenCode(line)
if ev == nil {
t.Fatal("expected event, got nil")
}
if ev.Type != EventComplete {
t.Errorf("expected EventComplete, got %v", ev.Type)
if ev != nil {
t.Errorf("expected nil (step_finish does not signal PRD completion; <chief-done/> + buildPrompt drive completion), got %v", ev)
}
}

Expand Down