Skip to content

Commit 0dadea8

Browse files
committed
changes from copilot
1 parent ebf2d84 commit 0dadea8

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

cmd/thv/app/proxy_stdio.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,10 @@ func proxyStdioCmdFunc(cmd *cobra.Command, args []string) error {
6161
logger.Infof("Starting stdio proxy for server=%q on %s:%d -> %s",
6262
serverName, host, port, stdioWorkloadName)
6363

64-
bridge := transport.NewStdioBridge(stdioWorkload.URL)
64+
bridge, err := transport.NewStdioBridge(stdioWorkload.URL)
65+
if err != nil {
66+
return fmt.Errorf("failed to create stdio bridge: %w", err)
67+
}
6568
bridge.Start(ctx)
6669

6770
// Consume until interrupt

docs/cli/thv_proxy_stdio.md

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/transport/bridge.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,6 @@ func (b *StdioBridge) loop(ctx context.Context) {
5858
go b.runStreamableWriter(ctx)
5959
} else { // legacy SSE
6060
b.postURL = b.baseURL // reset
61-
const legacyWorkerCount = 2
62-
b.wg.Add(legacyWorkerCount)
6361
go b.runLegacyReader(ctx)
6462
go b.runLegacyWriter(ctx)
6563
}
@@ -126,7 +124,11 @@ func (b *StdioBridge) handleInitializeResponse(resp *http.Response) {
126124
// Streamable HTTP handlers
127125
func (b *StdioBridge) runStreamableReader(ctx context.Context) {
128126
defer b.wg.Done()
129-
req, _ := http.NewRequestWithContext(ctx, "GET", b.baseURL.String(), nil)
127+
req, err := http.NewRequestWithContext(ctx, "GET", b.baseURL.String(), nil)
128+
if err != nil {
129+
logger.Errorf("Failed to create GET request: %v", err)
130+
return
131+
}
130132
req.Header.Set("Accept", "text/event-stream")
131133
copyHeaders(req.Header, b.headers)
132134
resp, err := http.DefaultClient.Do(req)

0 commit comments

Comments
 (0)