Skip to content

Commit fe77f09

Browse files
fix(workspace): render the attached-run offer before the idle break
The handler sat after the loop's idle check, so an offer arriving in the same batch as idle was never rendered — the loop had already stopped. Moved above it. An offer published strictly after idle still cannot be shown there, since the stream is over; that residual is noted in place and affects only the attached-run surface.
1 parent 33d37f3 commit fe77f09

1 file changed

Lines changed: 15 additions & 8 deletions

File tree

  • packages/opencode/src/cli/cmd

‎packages/opencode/src/cli/cmd/run.ts‎

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -755,14 +755,6 @@ You are speaking to a non-technical business executive. Follow these rules stric
755755
UI.error(err)
756756
}
757757

758-
if (
759-
event.type === "session.status" &&
760-
event.properties.sessionID === sessionID &&
761-
event.properties.status.type === "idle"
762-
) {
763-
break
764-
}
765-
766758
// altimate_change start — an attached run is the only surface that can
767759
// show the workspace engine offer. The headless marker is set on THIS
768760
// process, but with --attach the attach flow and isHeadless() run in
@@ -781,8 +773,23 @@ You are speaking to a non-technical business executive. Follow these rules stric
781773
)
782774
continue
783775
}
776+
// Placed BEFORE the idle break deliberately: the loop stops on idle,
777+
// so a handler after it never runs for an offer that arrives in the
778+
// same batch. An offer published strictly after idle still cannot be
779+
// shown here — the stream is over by then — which is a real gap when
780+
// the attach exceeds its bounded wait. The TUI and local headless
781+
// paths are unaffected.
784782
// altimate_change end
785783

784+
if (
785+
event.type === "session.status" &&
786+
event.properties.sessionID === sessionID &&
787+
event.properties.status.type === "idle"
788+
) {
789+
break
790+
}
791+
792+
786793
if (event.type === "permission.asked") {
787794
const permission = event.properties
788795
if (permission.sessionID !== sessionID) continue

0 commit comments

Comments
 (0)