Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit21bf5d1

Browse files
committed
chore: migrate mcp changes upstack for more focused review
1 parent4ef526a commit21bf5d1

File tree

7 files changed

+12
-308
lines changed

7 files changed

+12
-308
lines changed

‎aibridged/aibridged.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ func (s *Server) GetRequestHandler(ctx context.Context, req Request) (http.Handl
139139
returnnil,xerrors.New("nil requestBridgePool")
140140
}
141141

142-
reqBridge,err:=s.requestBridgePool.Acquire(ctx,req,s.Client,NewMCPProxyFactory(s.logger,s.Client))
142+
reqBridge,err:=s.requestBridgePool.Acquire(ctx,req,s.Client)
143143
iferr!=nil {
144144
returnnil,xerrors.Errorf("acquire request bridge: %w",err)
145145
}

‎aibridged/aibridged_test.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ func TestServeHTTP_FailureModes(t *testing.T) {
122122
// Should pass authorization.
123123
client.EXPECT().IsAuthorized(gomock.Any(),gomock.Any()).AnyTimes().Return(&proto.IsAuthorizedResponse{OwnerId:uuid.NewString()},nil)
124124
// But fail when acquiring a pool instance.
125-
pool.EXPECT().Acquire(gomock.Any(),gomock.Any(),gomock.Any(),gomock.Any()).AnyTimes().Return(nil,xerrors.New("oops"))
125+
pool.EXPECT().Acquire(gomock.Any(),gomock.Any(),gomock.Any()).AnyTimes().Return(nil,xerrors.New("oops"))
126126
},
127127
expectedErr:aibridged.ErrAcquireRequestHandler,
128128
expectedStatus:http.StatusInternalServerError,

‎aibridged/aibridgedmock/poolmock.go‎

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎aibridged/mcp.go‎

Lines changed: 0 additions & 190 deletions
This file was deleted.

‎aibridged/mcp_internal_test.go‎

Lines changed: 0 additions & 61 deletions
This file was deleted.

‎aibridged/pool.go‎

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import (
1414
"cdr.dev/slog"
1515

1616
"github.com/coder/aibridge"
17-
"github.com/coder/aibridge/mcp"
1817
)
1918

2019
const (
@@ -24,7 +23,7 @@ const (
2423
// Pooler describes a pool of [*aibridge.RequestBridge] instances from which instances can be retrieved.
2524
// One [*aibridge.RequestBridge] instance is created per given key.
2625
typePoolerinterface {
27-
Acquire(ctx context.Context,reqRequest,clientFnClientFunc,mcpBootstrapperMCPProxyBuilder) (http.Handler,error)
26+
Acquire(ctx context.Context,reqRequest,clientFnClientFunc) (http.Handler,error)
2827
Shutdown(ctx context.Context)error
2928
}
3029

@@ -103,7 +102,7 @@ func NewCachedBridgePool(options PoolOptions, providers []aibridge.Provider, log
103102
//
104103
// Each returned [*aibridge.RequestBridge] is safe for concurrent use.
105104
// Each [*aibridge.RequestBridge] is stateful because it has MCP clients which maintain sessions to the configured MCP server.
106-
func (p*CachedBridgePool)Acquire(ctx context.Context,reqRequest,clientFnClientFunc,mcpProxyFactoryMCPProxyBuilder) (http.Handler,error) {
105+
func (p*CachedBridgePool)Acquire(ctx context.Context,reqRequest,clientFnClientFunc) (http.Handler,error) {
107106
iferr:=ctx.Err();err!=nil {
108107
returnnil,xerrors.Errorf("acquire: %w",err)
109108
}
@@ -142,25 +141,7 @@ func (p *CachedBridgePool) Acquire(ctx context.Context, req Request, clientFn Cl
142141
// Creating an *aibridge.RequestBridge may take some time, so gate all subsequent callers behind the initial request and return the resulting value.
143142
// TODO: track startup time since it adds latency to first request (histogram count will also help us see how often this occurs).
144143
instance,err,_:=p.singleflight.Do(req.InitiatorID.String(),func() (*aibridge.RequestBridge,error) {
145-
var (
146-
mcpServers mcp.ServerProxier
147-
errerror
148-
)
149-
150-
mcpServers,err=mcpProxyFactory.Build(ctx,req)
151-
iferr!=nil {
152-
p.logger.Warn(ctx,"failed to create MCP server proxiers",slog.Error(err))
153-
// Don't fail here; MCP server injection can gracefully degrade.
154-
}
155-
156-
ifmcpServers!=nil {
157-
// This will block while connections are established with upstream MCP server(s), and tools are listed.
158-
iferr:=mcpServers.Init(ctx);err!=nil {
159-
p.logger.Warn(ctx,"failed to initialize MCP server proxier(s)",slog.Error(err))
160-
}
161-
}
162-
163-
bridge,err:=aibridge.NewRequestBridge(ctx,p.providers,p.logger,recorder,mcpServers)
144+
bridge,err:=aibridge.NewRequestBridge(ctx,p.providers,p.logger,recorder,nil)
164145
iferr!=nil {
165146
returnnil,xerrors.Errorf("create new request bridge: %w",err)
166147
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp