Fix clipped server badge and client_hands hang across servers

This commit is contained in:
Ian Gulliver
2026-10-19 12:12:17 -07:00
parent 0797b56568
commit d55218d1db
4 changed files with 15 additions and 14 deletions
+12 -2
View File
@@ -26,7 +26,7 @@ const (
replyGrace = 30 * time.Second
copyTimeout = 10 * time.Minute
fileTimeout = 2 * time.Minute
handsTimeout = 11 * time.Minute
handsTimeout = 2 * time.Minute
defaultReadLimit = 2000
)
@@ -528,7 +528,17 @@ func (m *Manager) clientHands(ctx context.Context, raw json.RawMessage) mcp.Resu
args.Arguments = &map[string]any{}
}
cctx, cancel := context.WithTimeout(ctx, handsTimeout)
ms := func(m map[string]any, key string) time.Duration {
v, _ := m[key].(float64)
return time.Duration(v) * time.Millisecond
}
timeout := handsTimeout + ms(*args.Arguments, "wait_ms") + 2*ms(*args.Arguments, "timeout_ms")
steps, _ := (*args.Arguments)["steps"].([]any)
for _, s := range steps {
step, _ := s.(map[string]any)
timeout += ms(step, "wait")
}
cctx, cancel := context.WithTimeout(ctx, timeout)
defer cancel()
reply, err := m.clients.Call(cctx, args.Client, api.ClientRequest{Op: api.Hands, Tool: &args.Tool, Arguments: args.Arguments})
if err != nil {