Skip to content

Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.

Go

fix(daemon): resolve codex app-server deadlock after turn completion

yushen828b75c76dc6
diff --git a/server/pkg/agent/codex.go b/server/pkg/agent/codex.go
index 97a67a89f5..a0b9376de7 100644
--- a/server/pkg/agent/codex.go
+++ b/server/pkg/agent/codex.go
@@ -205,6 +205,12 @@ func (b *codexBackend) Execute(ctx context.Context, prompt string, opts ExecOpti
b.cfg.Logger.Printf("[codex] finished pid=%d status=%s duration=%s",
cmd.Process.Pid, finalStatus, duration.Round(time.Millisecond))
+ // Close stdin and cancel context to signal the app-server to exit.
+ // Without this, the long-running codex process keeps stdout open and
+ // the reader goroutine blocks forever on scanner.Scan().
+ stdin.Close()
+ cancel()
+
// Wait for the reader goroutine to finish so all output is accumulated.
<-readerDone