Skip to content

πŸ™Œ OpenHands: AI-Driven Development

Add GitHub prompt to CodeAct (#1792)

Graham Neubig3cef8ee18769
diff --git a/agenthub/codeact_agent/codeact_agent.py b/agenthub/codeact_agent/codeact_agent.py
index 96ff1366ac..46a25e285d 100644
--- a/agenthub/codeact_agent/codeact_agent.py
+++ b/agenthub/codeact_agent/codeact_agent.py
@@ -1,6 +1,12 @@
import re
-from agenthub.codeact_agent.prompt import EXAMPLES, SYSTEM_MESSAGE
+from agenthub.codeact_agent.prompt import (
+ COMMAND_DOCS,
+ EXAMPLES,
+ GITHUB_MESSAGE,
+ SYSTEM_PREFIX,
+ SYSTEM_SUFFIX,
+)
from opendevin.controller.agent import Agent
from opendevin.controller.state.state import State
from opendevin.core.logger import opendevin_logger as logger
@@ -22,6 +28,8 @@ from opendevin.runtime.plugins import (
SWEAgentCommandsRequirement,
)
+ENABLE_GITHUB = True
+
def parse_response(response) -> str:
action = response.choices[0].message.content
@@ -77,7 +85,7 @@ def swe_agent_edit_hack(bash_command: str) -> str:
class CodeActAgent(Agent):
- VERSION = '1.1'
+ VERSION = '1.2'
"""
The Code Act Agent is a minimalist agent.
The agent works by passing the model a list of action-observation pairs and prompting the model to take the next step.
@@ -119,6 +127,12 @@ class CodeActAgent(Agent):
SWEAgentCommandsRequirement(),
]
+ system_message: str = (
+ f'{SYSTEM_PREFIX}\n{GITHUB_MESSAGE}\n\n{COMMAND_DOCS}\n\n{SYSTEM_SUFFIX}'
+ if ENABLE_GITHUB
+ else f'{SYSTEM_PREFIX}\n\n{COMMAND_DOCS}\n\n{SYSTEM_SUFFIX}'
+ )
+
def __init__(
self,
llm: LLM,
@@ -138,7 +152,7 @@ class CodeActAgent(Agent):
"""
super().reset()
self.messages: list[dict[str, str]] = [
- {'role': 'system', 'content': SYSTEM_MESSAGE},
+ {'role': 'system', 'content': self.system_message},
{
'role': 'user',
'content': f"Here is an example of how you can interact with the environment for task solving:\n{EXAMPLES}\n\nNOW, LET'S START!",
diff --git a/agenthub/codeact_agent/prompt.py b/agenthub/codeact_agent/prompt.py
index 04008aba4b..e84f4d8e0e 100644
--- a/agenthub/codeact_agent/prompt.py
+++ b/agenthub/codeact_agent/prompt.py
@@ -21,13 +21,13 @@ edit <start_line>:<end_line>
end_of_edit - replaces lines <start_line> through <end_line> (inclusive) with the given text in the open file. The replacement text is terminated by a line with only end_of_edit on it. All of the <replacement text> will be entered, so make sure your indentation is formatted properly. Python files will be checked for syntax errors after the edit. If the system detects a syntax error, the edit will not be executed. Simply try to edit the file again, but make sure to read the error message and modify the edit command you issue accordingly. Issuing the same command a second time will just lead to the same error message again. Remember, the file must be open before editing.
"""
-_COMMAND_DOCS = (
+COMMAND_DOCS = (
'\nApart from the standard bash commands, you can also use the following special commands in <execute_bash> environment:\n'
f'{_SWEAGENT_BASH_DOCS}'
"Please note that THE EDIT COMMAND REQUIRES PROPER INDENTATION. If you'd like to add the line ' print(x)' you must fully write that out, with all those spaces before the code! Indentation is important and code that is not indented correctly will fail and require fixing before it can be run."
)
-SYSTEM_MESSAGE = f"""A chat between a curious user and an artificial intelligence assistant. The assistant gives helpful, detailed, and polite answers to the user's questions.
+SYSTEM_PREFIX = """A chat between a curious user and an artificial intelligence assistant. The assistant gives helpful, detailed, and polite answers to the user's questions.
The assistant can interact with an interactive Python (Jupyter Notebook) environment and receive the corresponding output when needed. The code should be enclosed using "<execute_ipython>" tag, for example:
<execute_ipython>
print("Hello World!")
@@ -41,12 +41,15 @@ If the assistant encounters an import error in IPython for a newly installed pac
<execute_ipython>
import IPython
IPython.Application.instance().kernel.do_shutdown(True) # Restart the kernel
-</execute_ipython>
+</execute_ipython>"""
-{_COMMAND_DOCS}
+GITHUB_MESSAGE = """To do any activities on GitHub, you should use the token in the $GITHUB_TOKEN environment variable.
+For instance, to push a local branch `my_branch` to the github repo `owner/repo`, you can use the following four commands:
+<execute_bash> git push https://[email protected]/owner/repo.git my_branch </execute_bash>
+If you require access to GitHub but $GITHUB_TOKEN is not set, ask the user to set it for you."""
-The assistant's response should be concise, but do express their thoughts.
-Try to include one of <execute_ipython> or <execute_bash> in each of your responses, unless it is a direct answer to a question OR a message to the user.
+SYSTEM_SUFFIX = """The assistant's response should be concise.
+You should include <execute_ipython> or <execute_bash> in every one of your responses, unless you are finished with the task or need more input or action from the user in order to proceed.
IMPORTANT: Whenever possible, execute the code for the user using <execute_ipython> or <execute_bash> instead of providing it.
"""
diff --git a/tests/integration/mock/CodeActAgent/test_edits/prompt_001.log b/tests/integration/mock/CodeActAgent/test_edits/prompt_001.log
index 92c47c0b0a..22c72ff477 100644
--- a/tests/integration/mock/CodeActAgent/test_edits/prompt_001.log
+++ b/tests/integration/mock/CodeActAgent/test_edits/prompt_001.log
@@ -17,6 +17,10 @@ If the assistant encounters an import error in IPython for a newly installed pac
import IPython
IPython.Application.instance().kernel.do_shutdown(True) # Restart the kernel
</execute_ipython>
+To do any activities on GitHub, you should use the token in the $GITHUB_TOKEN environment variable.
+For instance, to push a local branch `my_branch` to the github repo `owner/repo`, you can use the following four commands:
+<execute_bash> git push https://[email protected]/owner/repo.git my_branch </execute_bash>
+If you require access to GitHub but $GITHUB_TOKEN is not set, ask the user to set it for you.
Apart from the standard bash commands, you can also use the following special commands in <execute_bash> environment:
@@ -33,8 +37,8 @@ edit <start_line>:<end_line>
end_of_edit - replaces lines <start_line> through <end_line> (inclusive) with the given text in the open file. The replacement text is terminated by a line with only end_of_edit on it. All of the <replacement text> will be entered, so make sure your indentation is formatted properly. Python files will be checked for syntax errors after the edit. If the system detects a syntax error, the edit will not be executed. Simply try to edit the file again, but make sure to read the error message and modify the edit command you issue accordingly. Issuing the same command a second time will just lead to the same error message again. Remember, the file must be open before editing.
Please note that THE EDIT COMMAND REQUIRES PROPER INDENTATION. If you'd like to add the line ' print(x)' you must fully write that out, with all those spaces before the code! Indentation is important and code that is not indented correctly will fail and require fixing before it can be run.
-The assistant's response should be concise, but do express their thoughts.
-Try to include one of <execute_ipython> or <execute_bash> in each of your responses, unless it is a direct answer to a question OR a message to the user.
+The assistant's response should be concise.
+You should include <execute_ipython> or <execute_bash> in every one of your responses, unless you are finished with the task or need more input or action from the user in order to proceed.
IMPORTANT: Whenever possible, execute the code for the user using <execute_ipython> or <execute_bash> instead of providing it.
diff --git a/tests/integration/mock/CodeActAgent/test_edits/prompt_002.log b/tests/integration/mock/CodeActAgent/test_edits/prompt_002.log
index 9b6c76219c..912b44ca85 100644
--- a/tests/integration/mock/CodeActAgent/test_edits/prompt_002.log
+++ b/tests/integration/mock/CodeActAgent/test_edits/prompt_002.log
@@ -17,6 +17,10 @@ If the assistant encounters an import error in IPython for a newly installed pac
import IPython
IPython.Application.instance().kernel.do_shutdown(True) # Restart the kernel
</execute_ipython>
+To do any activities on GitHub, you should use the token in the $GITHUB_TOKEN environment variable.
+For instance, to push a local branch `my_branch` to the github repo `owner/repo`, you can use the following four commands:
+<execute_bash> git push https://[email protected]/owner/repo.git my_branch </execute_bash>
+If you require access to GitHub but $GITHUB_TOKEN is not set, ask the user to set it for you.
Apart from the standard bash commands, you can also use the following special commands in <execute_bash> environment:
@@ -33,8 +37,8 @@ edit <start_line>:<end_line>
end_of_edit - replaces lines <start_line> through <end_line> (inclusive) with the given text in the open file. The replacement text is terminated by a line with only end_of_edit on it. All of the <replacement text> will be entered, so make sure your indentation is formatted properly. Python files will be checked for syntax errors after the edit. If the system detects a syntax error, the edit will not be executed. Simply try to edit the file again, but make sure to read the error message and modify the edit command you issue accordingly. Issuing the same command a second time will just lead to the same error message again. Remember, the file must be open before editing.
Please note that THE EDIT COMMAND REQUIRES PROPER INDENTATION. If you'd like to add the line ' print(x)' you must fully write that out, with all those spaces before the code! Indentation is important and code that is not indented correctly will fail and require fixing before it can be run.
-The assistant's response should be concise, but do express their thoughts.
-Try to include one of <execute_ipython> or <execute_bash> in each of your responses, unless it is a direct answer to a question OR a message to the user.
+The assistant's response should be concise.
+You should include <execute_ipython> or <execute_bash> in every one of your responses, unless you are finished with the task or need more input or action from the user in order to proceed.
IMPORTANT: Whenever possible, execute the code for the user using <execute_ipython> or <execute_bash> instead of providing it.
@@ -224,7 +228,7 @@ ENVIRONMENT REMINDER: You have 98 turns left to complete the task.
----------
-Certainly! I will start by opening the file `bad.txt` to see what content it has and then proceed to fix any typos I find.
+Certainly! I will start by opening the file `bad.txt` to see the content and then proceed to fix the typos.
<execute_bash>
open bad.txt
@@ -233,10 +237,10 @@ open bad.txt
----------
OBSERVATION:
-[File: /workspace/bad.txt (4 lines total)]
-1:This is a stupid typoo.
-2:Really?
-3:No mor typos!
+[File: /workspace/bad.txt (4 lines total)]
+1:This is a stupid typoo.
+2:Really?
+3:No mor typos!
4:Enjoy!
[Command -1 finished with exit code 0]]
diff --git a/tests/integration/mock/CodeActAgent/test_edits/prompt_003.log b/tests/integration/mock/CodeActAgent/test_edits/prompt_003.log
index f4cc2a086c..c0581fd310 100644
--- a/tests/integration/mock/CodeActAgent/test_edits/prompt_003.log
+++ b/tests/integration/mock/CodeActAgent/test_edits/prompt_003.log
@@ -17,6 +17,10 @@ If the assistant encounters an import error in IPython for a newly installed pac
import IPython
IPython.Application.instance().kernel.do_shutdown(True) # Restart the kernel
</execute_ipython>
+To do any activities on GitHub, you should use the token in the $GITHUB_TOKEN environment variable.
+For instance, to push a local branch `my_branch` to the github repo `owner/repo`, you can use the following four commands:
+<execute_bash> git push https://[email protected]/owner/repo.git my_branch </execute_bash>
+If you require access to GitHub but $GITHUB_TOKEN is not set, ask the user to set it for you.
Apart from the standard bash commands, you can also use the following special commands in <execute_bash> environment:
@@ -33,8 +37,8 @@ edit <start_line>:<end_line>
end_of_edit - replaces lines <start_line> through <end_line> (inclusive) with the given text in the open file. The replacement text is terminated by a line with only end_of_edit on it. All of the <replacement text> will be entered, so make sure your indentation is formatted properly. Python files will be checked for syntax errors after the edit. If the system detects a syntax error, the edit will not be executed. Simply try to edit the file again, but make sure to read the error message and modify the edit command you issue accordingly. Issuing the same command a second time will just lead to the same error message again. Remember, the file must be open before editing.
Please note that THE EDIT COMMAND REQUIRES PROPER INDENTATION. If you'd like to add the line ' print(x)' you must fully write that out, with all those spaces before the code! Indentation is important and code that is not indented correctly will fail and require fixing before it can be run.
-The assistant's response should be concise, but do express their thoughts.
-Try to include one of <execute_ipython> or <execute_bash> in each of your responses, unless it is a direct answer to a question OR a message to the user.
+The assistant's response should be concise.
+You should include <execute_ipython> or <execute_bash> in every one of your responses, unless you are finished with the task or need more input or action from the user in order to proceed.
IMPORTANT: Whenever possible, execute the code for the user using <execute_ipython> or <execute_bash> instead of providing it.
@@ -224,7 +228,7 @@ ENVIRONMENT REMINDER: You have 98 turns left to complete the task.
----------
-Certainly! I will start by opening the file `bad.txt` to see what content it has and then proceed to fix any typos I find.
+Certainly! I will start by opening the file `bad.txt` to see the content and then proceed to fix the typos.
<execute_bash>
open bad.txt
@@ -233,10 +237,10 @@ open bad.txt
----------
OBSERVATION:
-[File: /workspace/bad.txt (4 lines total)]
-1:This is a stupid typoo.
-2:Really?
-3:No mor typos!
+[File: /workspace/bad.txt (4 lines total)]
+1:This is a stupid typoo.
+2:Really?
+3:No mor typos!
4:Enjoy!
[Command -1 finished with exit code 0]]
@@ -244,7 +248,7 @@ ENVIRONMENT REMINDER: You have 97 turns left to complete the task.
----------
-I see a few typos in the file `bad.txt`. I will correct them now.
+I will now edit the file to correct the typos.
<execute_bash>
edit 1:1
@@ -258,17 +262,17 @@ end_of_edit
----------
OBSERVATION:
-> > [File: /workspace/bad.txt (4 lines total)]
-1:This is a stupid typo.
-2:Really?
-3:No mor typos!
-4:Enjoy!
-File updated. Please review the changes and make sure they are correct (correct indentation, no duplicate lines, etc). Edit the file again if necessary.
-> > [File: /workspace/bad.txt (4 lines total)]
-1:This is a stupid typo.
-2:Really?
-3:No more typos!
-4:Enjoy!
+> > [File: /workspace/bad.txt (4 lines total)]
+1:This is a stupid typo.
+2:Really?
+3:No mor typos!
+4:Enjoy!
+File updated. Please review the changes and make sure they are correct (correct indentation, no duplicate lines, etc). Edit the file again if necessary.
+> > [File: /workspace/bad.txt (4 lines total)]
+1:This is a stupid typo.
+2:Really?
+3:No more typos!
+4:Enjoy!
File updated. Please review the changes and make sure they are correct (correct indentation, no duplicate lines, etc). Edit the file again if necessary.
[Command -1 finished with exit code 0]]
diff --git a/tests/integration/mock/CodeActAgent/test_edits/response_001.log b/tests/integration/mock/CodeActAgent/test_edits/response_001.log
index 56ec1bbd36..9a251342e9 100644
--- a/tests/integration/mock/CodeActAgent/test_edits/response_001.log
+++ b/tests/integration/mock/CodeActAgent/test_edits/response_001.log
@@ -1,4 +1,4 @@
-Certainly! I will start by opening the file `bad.txt` to see what content it has and then proceed to fix any typos I find.
+Certainly! I will start by opening the file `bad.txt` to see the content and then proceed to fix the typos.
<execute_bash>
open bad.txt
diff --git a/tests/integration/mock/CodeActAgent/test_edits/response_002.log b/tests/integration/mock/CodeActAgent/test_edits/response_002.log
index 3dfd3f47e5..8016c2db85 100644
--- a/tests/integration/mock/CodeActAgent/test_edits/response_002.log
+++ b/tests/integration/mock/CodeActAgent/test_edits/response_002.log
@@ -1,4 +1,4 @@
-I see a few typos in the file `bad.txt`. I will correct them now.
+I will now edit the file to correct the typos.
<execute_bash>
edit 1:1
diff --git a/tests/integration/mock/CodeActAgent/test_edits/response_003.log b/tests/integration/mock/CodeActAgent/test_edits/response_003.log
index 4b2024e1ee..b515529ad1 100644
--- a/tests/integration/mock/CodeActAgent/test_edits/response_003.log
+++ b/tests/integration/mock/CodeActAgent/test_edits/response_003.log
@@ -1 +1 @@
-The typos in the file `bad.txt` have been fixed. The content should now be correct without any spelling mistakes. If there's anything else you need, let me know!
+The typos in `bad.txt` have been fixed. The task is complete. If you need further assistance, feel free to ask!
diff --git a/tests/integration/mock/CodeActAgent/test_ipython/prompt_001.log b/tests/integration/mock/CodeActAgent/test_ipython/prompt_001.log
index df1f5c59ea..c278b62882 100644
--- a/tests/integration/mock/CodeActAgent/test_ipython/prompt_001.log
+++ b/tests/integration/mock/CodeActAgent/test_ipython/prompt_001.log
@@ -17,6 +17,10 @@ If the assistant encounters an import error in IPython for a newly installed pac
import IPython
IPython.Application.instance().kernel.do_shutdown(True) # Restart the kernel
</execute_ipython>
+To do any activities on GitHub, you should use the token in the $GITHUB_TOKEN environment variable.
+For instance, to push a local branch `my_branch` to the github repo `owner/repo`, you can use the following four commands:
+<execute_bash> git push https://[email protected]/owner/repo.git my_branch </execute_bash>
+If you require access to GitHub but $GITHUB_TOKEN is not set, ask the user to set it for you.
Apart from the standard bash commands, you can also use the following special commands in <execute_bash> environment:
@@ -33,8 +37,8 @@ edit <start_line>:<end_line>
end_of_edit - replaces lines <start_line> through <end_line> (inclusive) with the given text in the open file. The replacement text is terminated by a line with only end_of_edit on it. All of the <replacement text> will be entered, so make sure your indentation is formatted properly. Python files will be checked for syntax errors after the edit. If the system detects a syntax error, the edit will not be executed. Simply try to edit the file again, but make sure to read the error message and modify the edit command you issue accordingly. Issuing the same command a second time will just lead to the same error message again. Remember, the file must be open before editing.
Please note that THE EDIT COMMAND REQUIRES PROPER INDENTATION. If you'd like to add the line ' print(x)' you must fully write that out, with all those spaces before the code! Indentation is important and code that is not indented correctly will fail and require fixing before it can be run.
-The assistant's response should be concise, but do express their thoughts.
-Try to include one of <execute_ipython> or <execute_bash> in each of your responses, unless it is a direct answer to a question OR a message to the user.
+The assistant's response should be concise.
+You should include <execute_ipython> or <execute_bash> in every one of your responses, unless you are finished with the task or need more input or action from the user in order to proceed.
IMPORTANT: Whenever possible, execute the code for the user using <execute_ipython> or <execute_bash> instead of providing it.
diff --git a/tests/integration/mock/CodeActAgent/test_ipython/prompt_002.log b/tests/integration/mock/CodeActAgent/test_ipython/prompt_002.log
index 44b766fde2..1e2108e22f 100644
--- a/tests/integration/mock/CodeActAgent/test_ipython/prompt_002.log
+++ b/tests/integration/mock/CodeActAgent/test_ipython/prompt_002.log
@@ -17,6 +17,10 @@ If the assistant encounters an import error in IPython for a newly installed pac
import IPython
IPython.Application.instance().kernel.do_shutdown(True) # Restart the kernel
</execute_ipython>
+To do any activities on GitHub, you should use the token in the $GITHUB_TOKEN environment variable.
+For instance, to push a local branch `my_branch` to the github repo `owner/repo`, you can use the following four commands:
+<execute_bash> git push https://[email protected]/owner/repo.git my_branch </execute_bash>
+If you require access to GitHub but $GITHUB_TOKEN is not set, ask the user to set it for you.
Apart from the standard bash commands, you can also use the following special commands in <execute_bash> environment:
@@ -33,8 +37,8 @@ edit <start_line>:<end_line>
end_of_edit - replaces lines <start_line> through <end_line> (inclusive) with the given text in the open file. The replacement text is terminated by a line with only end_of_edit on it. All of the <replacement text> will be entered, so make sure your indentation is formatted properly. Python files will be checked for syntax errors after the edit. If the system detects a syntax error, the edit will not be executed. Simply try to edit the file again, but make sure to read the error message and modify the edit command you issue accordingly. Issuing the same command a second time will just lead to the same error message again. Remember, the file must be open before editing.
Please note that THE EDIT COMMAND REQUIRES PROPER INDENTATION. If you'd like to add the line ' print(x)' you must fully write that out, with all those spaces before the code! Indentation is important and code that is not indented correctly will fail and require fixing before it can be run.
-The assistant's response should be concise, but do express their thoughts.
-Try to include one of <execute_ipython> or <execute_bash> in each of your responses, unless it is a direct answer to a question OR a message to the user.
+The assistant's response should be concise.
+You should include <execute_ipython> or <execute_bash> in every one of your responses, unless you are finished with the task or need more input or action from the user in order to proceed.
IMPORTANT: Whenever possible, execute the code for the user using <execute_ipython> or <execute_bash> instead of providing it.
@@ -224,10 +228,10 @@ ENVIRONMENT REMINDER: You have 98 turns left to complete the task.
----------
-Certainly! I will write the text 'hello world' to the file `/workspace/test.txt` using IPython.
+Certainly! I will write the text 'hello world' to the file `/workspace/test.txt` using Jupyter IPython.
<execute_ipython>
-# Writing 'hello world' to the specified text file
+# Write 'hello world' to the specified text file
with open('/workspace/test.txt', 'w') as file:
file.write('hello world')
</execute_ipython>
diff --git a/tests/integration/mock/CodeActAgent/test_ipython/response_001.log b/tests/integration/mock/CodeActAgent/test_ipython/response_001.log
index 9d44462487..7525ffbf6d 100644
--- a/tests/integration/mock/CodeActAgent/test_ipython/response_001.log
+++ b/tests/integration/mock/CodeActAgent/test_ipython/response_001.log
@@ -1,6 +1,6 @@
-Certainly! I will write the text 'hello world' to the file `/workspace/test.txt` using IPython.
+Certainly! I will write the text 'hello world' to the file `/workspace/test.txt` using Jupyter IPython.
<execute_ipython>
-# Writing 'hello world' to the specified text file
+# Write 'hello world' to the specified text file
with open('/workspace/test.txt', 'w') as file:
file.write('hello world')
diff --git a/tests/integration/mock/CodeActAgent/test_ipython/response_002.log b/tests/integration/mock/CodeActAgent/test_ipython/response_002.log
index 873abf1f12..f0a4ebd49a 100644
--- a/tests/integration/mock/CodeActAgent/test_ipython/response_002.log
+++ b/tests/integration/mock/CodeActAgent/test_ipython/response_002.log
@@ -1 +1 @@
-The text 'hello world' has been successfully written to `/workspace/test.txt`. If you need any further assistance or another task to be done, feel free to let me know!
+The text 'hello world' has been successfully written to `/workspace/test.txt`. If you need any further assistance, feel free to ask!
diff --git a/tests/integration/mock/CodeActAgent/test_write_simple_script/prompt_001.log b/tests/integration/mock/CodeActAgent/test_write_simple_script/prompt_001.log
index 8a9449183c..e8af801abf 100644
--- a/tests/integration/mock/CodeActAgent/test_write_simple_script/prompt_001.log
+++ b/tests/integration/mock/CodeActAgent/test_write_simple_script/prompt_001.log
@@ -17,6 +17,10 @@ If the assistant encounters an import error in IPython for a newly installed pac
import IPython
IPython.Application.instance().kernel.do_shutdown(True) # Restart the kernel
</execute_ipython>
+To do any activities on GitHub, you should use the token in the $GITHUB_TOKEN environment variable.
+For instance, to push a local branch `my_branch` to the github repo `owner/repo`, you can use the following four commands:
+<execute_bash> git push https://[email protected]/owner/repo.git my_branch </execute_bash>
+If you require access to GitHub but $GITHUB_TOKEN is not set, ask the user to set it for you.
Apart from the standard bash commands, you can also use the following special commands in <execute_bash> environment:
@@ -33,8 +37,8 @@ edit <start_line>:<end_line>
end_of_edit - replaces lines <start_line> through <end_line> (inclusive) with the given text in the open file. The replacement text is terminated by a line with only end_of_edit on it. All of the <replacement text> will be entered, so make sure your indentation is formatted properly. Python files will be checked for syntax errors after the edit. If the system detects a syntax error, the edit will not be executed. Simply try to edit the file again, but make sure to read the error message and modify the edit command you issue accordingly. Issuing the same command a second time will just lead to the same error message again. Remember, the file must be open before editing.
Please note that THE EDIT COMMAND REQUIRES PROPER INDENTATION. If you'd like to add the line ' print(x)' you must fully write that out, with all those spaces before the code! Indentation is important and code that is not indented correctly will fail and require fixing before it can be run.
-The assistant's response should be concise, but do express their thoughts.
-Try to include one of <execute_ipython> or <execute_bash> in each of your responses, unless it is a direct answer to a question OR a message to the user.
+The assistant's response should be concise.
+You should include <execute_ipython> or <execute_bash> in every one of your responses, unless you are finished with the task or need more input or action from the user in order to proceed.
IMPORTANT: Whenever possible, execute the code for the user using <execute_ipython> or <execute_bash> instead of providing it.
diff --git a/tests/integration/mock/CodeActAgent/test_write_simple_script/prompt_002.log b/tests/integration/mock/CodeActAgent/test_write_simple_script/prompt_002.log
index 047f8e6754..8d71bcb66b 100644
--- a/tests/integration/mock/CodeActAgent/test_write_simple_script/prompt_002.log
+++ b/tests/integration/mock/CodeActAgent/test_write_simple_script/prompt_002.log
@@ -17,6 +17,10 @@ If the assistant encounters an import error in IPython for a newly installed pac
import IPython
IPython.Application.instance().kernel.do_shutdown(True) # Restart the kernel
</execute_ipython>
+To do any activities on GitHub, you should use the token in the $GITHUB_TOKEN environment variable.
+For instance, to push a local branch `my_branch` to the github repo `owner/repo`, you can use the following four commands:
+<execute_bash> git push https://[email protected]/owner/repo.git my_branch </execute_bash>
+If you require access to GitHub but $GITHUB_TOKEN is not set, ask the user to set it for you.
Apart from the standard bash commands, you can also use the following special commands in <execute_bash> environment:
@@ -33,8 +37,8 @@ edit <start_line>:<end_line>
end_of_edit - replaces lines <start_line> through <end_line> (inclusive) with the given text in the open file. The replacement text is terminated by a line with only end_of_edit on it. All of the <replacement text> will be entered, so make sure your indentation is formatted properly. Python files will be checked for syntax errors after the edit. If the system detects a syntax error, the edit will not be executed. Simply try to edit the file again, but make sure to read the error message and modify the edit command you issue accordingly. Issuing the same command a second time will just lead to the same error message again. Remember, the file must be open before editing.
Please note that THE EDIT COMMAND REQUIRES PROPER INDENTATION. If you'd like to add the line ' print(x)' you must fully write that out, with all those spaces before the code! Indentation is important and code that is not indented correctly will fail and require fixing before it can be run.
-The assistant's response should be concise, but do express their thoughts.
-Try to include one of <execute_ipython> or <execute_bash> in each of your responses, unless it is a direct answer to a question OR a message to the user.
+The assistant's response should be concise.
+You should include <execute_ipython> or <execute_bash> in every one of your responses, unless you are finished with the task or need more input or action from the user in order to proceed.
IMPORTANT: Whenever possible, execute the code for the user using <execute_ipython> or <execute_bash> instead of providing it.
@@ -224,10 +228,10 @@ ENVIRONMENT REMINDER: You have 98 turns left to complete the task.
----------
-Certainly! I will create a shell script named `hello.sh` that prints "hello" when executed.
+Certainly! I will create a shell script named `hello.sh` that prints 'hello'.
<execute_bash>
-echo 'echo hello' > hello.sh && chmod +x hello.sh
+echo "echo 'hello'" > hello.sh && chmod +x hello.sh
</execute_bash>
----------
diff --git a/tests/integration/mock/CodeActAgent/test_write_simple_script/response_001.log b/tests/integration/mock/CodeActAgent/test_write_simple_script/response_001.log
index 5f55b150aa..fb26597bad 100644
--- a/tests/integration/mock/CodeActAgent/test_write_simple_script/response_001.log
+++ b/tests/integration/mock/CodeActAgent/test_write_simple_script/response_001.log
@@ -1,4 +1,4 @@
-Certainly! I will create a shell script named `hello.sh` that prints "hello" when executed.
+Certainly! I will create a shell script named `hello.sh` that prints 'hello'.
<execute_bash>
-echo 'echo hello' > hello.sh && chmod +x hello.sh
+echo "echo 'hello'" > hello.sh && chmod +x hello.sh
diff --git a/tests/integration/mock/CodeActAgent/test_write_simple_script/response_002.log b/tests/integration/mock/CodeActAgent/test_write_simple_script/response_002.log
index 17999ba56a..966062535b 100644
--- a/tests/integration/mock/CodeActAgent/test_write_simple_script/response_002.log
+++ b/tests/integration/mock/CodeActAgent/test_write_simple_script/response_002.log
@@ -1 +1 @@
-The shell script `hello.sh` has been created and made executable. You can now run this script to print "hello". If you need anything else, feel free to ask!
+The shell script `hello.sh` has been created and made executable. You can now run it to print 'hello'.