-
Notifications
You must be signed in to change notification settings - Fork 7.7k
Description
Describe the issue
I intentionally reproduced the test failure of #1759.
#1759 summary : If the execution policy of user's powershell is restricted in window, all the powershell(including .sh) code will cause an error.
I worried that it will stop the application unwantedly.
The expectation was wrong because the code execution process deals with errors by returning error messages,
however it causes another serious problem that we might hate more. See the logs below.
When the execution of some codes are obviously no possible, they keep trying to execute the codes.
It makes me believe that the current code execution process was badly designed.
Steps to reproduce
- OS : Window
- Execute the cmd in powershell: Set-ExecutionPolicy Restricted -scope CurrentUser (Why CurrentUser? you might not have the root authority in the current shell).
- Go to agentchat_auto_feedback_from_code_execution notebook.
- Replace the message by "Write a simple .sh script in the code block
sh
."
used model: ollama/llama2
Screenshots and logs
user_proxy (to assistant):
Write a simple .sh script in the code block sh
.
assistant (to user_proxy):
TERMINATE
To create a simple shell script, we can use the following code:
# My Script
# Print the current date and time
echo "$(date +%Y-%m-%d %H:%M:%S)"
# Print the operating system
echo "$(uname -s)"
# Print a message
echo "Hello, world!"
Explanation:
- The first line,
# My Script
, is a comment and is ignored by the shell. - The second line,
echo "$(date +%Y-%m-%d %H:%M:%S)"
, uses thedate
command to print the current date and time in the formatYYYY-MM-DD HH:MM:SS
. - The third line,
echo "$(uname -s)"
, uses theuname
command to print the name of the operating system. - The fourth line,
echo "Hello, world!"
, simply prints a message.
When you run this script in a terminal, it will output the current date and time, as well as the name of the operating system.
Please execute the script by running it in a terminal and let me know if there are any errors or issues.
EXECUTING CODE BLOCK 0 (inferred language is sh)...
user_proxy (to assistant):
exitcode: 1 (execution failed)
Code output:
[.](https://file+.vscode-resource.vscode-cdn.net/c%3A/Users/sisun/VSCode/autogen_project/autogen/notebook/) : File C:\Users\sisun\VSCode\autogen_project\autogen\notebook\coding\tm
p_code_1f24b9445c0008f7d122db7c3e74e346.ps1 cannot be loaded because running scripts is disabled on this system. For mo
re information, see about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170.
At line:1 char:1
- [.](https://file+.vscode-resource.vscode-cdn.net/c%3A/Users/sisun/VSCode/autogen_project/autogen/notebook/)
-
+ CategoryInfo : SecurityError: (:) [], PSSecurityException + FullyQualifiedErrorId : UnauthorizedAccess
assistant (to user_proxy):
TERMINATE
Thank you for executing the script! Unfortunately, it looks like there is an issue with running scripts on your system. According to the error message, running scripts is disabled on this system.
To resolve this issue, you can try enabling the execution of scripts by following these steps:
- Open the Windows Control Panel.
- Click on "System and Security" or "Security Settings" (depending on your version of Windows).
- Click on "Execution Policy" in the left-hand menu.
- In the "Execution Policy" window, click on "Edit" to modify the policy settings.
- In the "Scripts can execute any script" section, select "Enable" or "Unrestricted".
- Click "OK" to save the changes.
After making these changes, try executing the script again by running the .sh
file in a terminal. If you encounter any further issues, please let me know and I'll be happy to help!
user_proxy (to assistant):
assistant (to user_proxy):
TERMINATE
Thank you for executing the script! Unfortunately, there is an issue with running scripts on your system, as indicated by the error message. To resolve this issue, you can try enabling the execution of scripts by following the steps I provided in my previous response.
If you are unable to enable script execution after trying the steps I provided, please let me know and I will be happy to provide further assistance.
user_proxy (to assistant):
assistant (to user_proxy):
TERMINATE
Thank you for executing the script! Unfortunately, there is an issue with running scripts on your system, as indicated by the error message. According to the error message, running scripts is disabled on this system.
To resolve this issue, you can try enabling the execution of scripts by following these steps:
- Open the Windows Control Panel.
- Click on "System and Security" or "Security Settings" (depending on your version of Windows).
- Click on "Execution Policy" in the left-hand menu.
- In the "Execution Policy" window, click on "Edit" to modify the policy settings.
- In the "Scripts can execute any script" section, select "Enable" or "Unrestricted".
- Click "OK" to save the changes.
After making these changes, try executing the script again by running the .sh
file in a terminal. If you encounter any further issues, please let me know and I'll be happy to help!
user_proxy (to assistant):
assistant (to user_proxy):
TERMINATE
Thank you for executing the script! Unfortunately, there is an issue with running scripts on your system, as indicated by the error message. According to the error message, running scripts is disabled on this system.
To resolve this issue, you can try enabling the execution of scripts by following these steps:
- Open the Windows Control Panel.
- Click on "System and Security" or "Security Settings" (depending on your version of Windows).
- Click on "Execution Policy" in the left-hand menu.
- In the "Execution Policy" window, click on "Edit" to modify the policy settings.
- In the "Scripts can execute any script" section, select "Enable" or "Unrestricted".
- Click "OK" to save the changes.
After making these changes, try executing the script again by running the .sh
file in a terminal. If you encounter any further issues, please let me know and I'll be happy to help!
user_proxy (to assistant):
assistant (to user_proxy):
TERMINATE
Thank you for executing the script! Unfortunately, there is an issue with running scripts on your system, as indicated by the error message. According to the error message, running scripts is disabled on this system.
To resolve this issue, you can try enabling the execution of scripts by following these steps:
- Open the Windows Control Panel.
- Click on "System and Security" or "Security Settings" (depending on your version of Windows).
- Click on "Execution Policy" in the left-hand menu.
- In the "Execution Policy" window, click on "Edit" to modify the policy settings.
- In the "Scripts can execute any script" section, select "Enable" or "Unrestricted".
- Click "OK" to save the changes.
After making these changes, try executing the script again by running the .sh
file in a terminal. If you encounter any further issues, please let me know and I'll be happy to help!
Additional Information
No response