Complete the Codex host initialization handshake once
This commit is contained in:
@@ -117,6 +117,11 @@ func Serve(ctx context.Context, options Options) error {
|
||||
if failure := h.initialize["error"]; len(failure) > 0 && string(failure) != "null" {
|
||||
return errors.New("Codex App Server refused initialization")
|
||||
}
|
||||
// Complete the upstream handshake once before accepting Pipelines clients.
|
||||
// Reattached clients only initialize their downstream connection.
|
||||
if err := h.write(upstream, message{"method": json.RawMessage(`"initialized"`)}); err != nil {
|
||||
return fmt.Errorf("complete Codex App Server initialization: %w", err)
|
||||
}
|
||||
server := &http.Server{Handler: http.HandlerFunc(h.accept), ReadHeaderTimeout: 5 * time.Second}
|
||||
defer server.Close()
|
||||
go func() { <-child.Done(); _ = server.Close() }()
|
||||
|
||||
Reference in New Issue
Block a user