@@ -1861,8 +1861,7 @@ var DeleteTask = Tool[DeleteTaskArgs, codersdk.Response]{
1861
1861
}
1862
1862
owner = task .OwnerName
1863
1863
}else {
1864
- workspaceName := NormalizeWorkspaceInput (args .TaskID )
1865
- ws ,err := namedWorkspace (ctx ,deps .coderClient ,workspaceName )
1864
+ ws ,err := normalizedNamedWorkspace (ctx ,deps .coderClient ,args .TaskID )
1866
1865
if err != nil {
1867
1866
return codersdk.Response {},xerrors .Errorf ("get task workspace %q: %w" ,args .TaskID ,err )
1868
1867
}
@@ -1962,8 +1961,7 @@ var GetTaskStatus = Tool[GetTaskStatusArgs, GetTaskStatusResponse]{
1962
1961
1963
1962
id ,err := uuid .Parse (args .TaskID )
1964
1963
if err != nil {
1965
- workspaceName := NormalizeWorkspaceInput (args .TaskID )
1966
- ws ,err := namedWorkspace (ctx ,deps .coderClient ,workspaceName )
1964
+ ws ,err := normalizedNamedWorkspace (ctx ,deps .coderClient ,args .TaskID )
1967
1965
if err != nil {
1968
1966
return GetTaskStatusResponse {},xerrors .Errorf ("get task workspace %q: %w" ,args .TaskID ,err )
1969
1967
}
@@ -1982,6 +1980,13 @@ var GetTaskStatus = Tool[GetTaskStatusArgs, GetTaskStatusResponse]{
1982
1980
},
1983
1981
}
1984
1982
1983
+ // normalizedNamedWorkspace normalizes the workspace name before getting the
1984
+ // workspace by name.
1985
+ func normalizedNamedWorkspace (ctx context.Context ,client * codersdk.Client ,name string ) (codersdk.Workspace ,error ) {
1986
+ // Maybe namedWorkspace should itself call NormalizeWorkspaceInput?
1987
+ return namedWorkspace (ctx ,client ,NormalizeWorkspaceInput (name ))
1988
+ }
1989
+
1985
1990
// NormalizeWorkspaceInput converts workspace name input to standard format.
1986
1991
// Handles the following input formats:
1987
1992
// - workspace → workspace