Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revamp AgentRejectAction and allow ManagerAgent to handle rejection #1735

Merged
merged 37 commits into from
Jun 9, 2024
Merged
Changes from 1 commit
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
479a78f
Fix AgentRejectAction handling
li-boxuan May 12, 2024
2eddf6f
Add ManagerAgent to integration tests
li-boxuan May 12, 2024
16ddbdb
Merge remote-tracking branch 'upstream/main' into reject-action
li-boxuan May 12, 2024
4fb56e9
Fix regenerate.sh
li-boxuan May 12, 2024
224069d
Merge remote-tracking branch 'upstream/main' into reject-action
li-boxuan May 12, 2024
c612c02
Fix merge
li-boxuan May 13, 2024
d9b1b4b
Update README for micro-agents
li-boxuan May 13, 2024
342033c
Add test reject to regenerate.sh
li-boxuan May 13, 2024
77c383a
regenerate.sh: Add support for running a specific test and/or agent
li-boxuan May 13, 2024
c3565c5
Refine reject schema, and allow ManagerAgent to handle reject
li-boxuan May 13, 2024
aacc7ec
Add test artifacts for test_simple_task_rejection
li-boxuan May 13, 2024
99233cd
Fix manager agent tests
li-boxuan May 13, 2024
9f62fca
Fix README
li-boxuan May 13, 2024
fc63c05
test_simple_task_rejection: check final agent state
li-boxuan May 13, 2024
c466c1c
Integration test: exit if mock prompt not found
li-boxuan May 13, 2024
a709edc
Update test_simple_task_rejection tests
li-boxuan May 13, 2024
a72d37c
Merge branch 'main' into reject-action
li-boxuan May 13, 2024
7d64a8a
Fix test_edits test artifacts after prompt update
li-boxuan May 13, 2024
a6b1144
Merge remote-tracking branch 'origin/reject-action' into reject-action
li-boxuan May 13, 2024
3d6054b
Merge branch 'main' into reject-action
li-boxuan May 13, 2024
7db9109
Merge remote-tracking branch 'upstream/main' into reject-action
li-boxuan May 14, 2024
c242f29
Fix ManagerAgent test_edits
li-boxuan May 14, 2024
bd810d8
Merge remote-tracking branch 'upstream/main' into reject-action
li-boxuan May 15, 2024
b4d6309
Merge remote-tracking branch 'upstream/main' into reject-action
li-boxuan May 16, 2024
dd56bd7
Merge remote-tracking branch 'upstream/main' into reject-action
li-boxuan May 18, 2024
073e440
Merge remote-tracking branch 'upstream/main' into reject-action
li-boxuan May 31, 2024
3dd7cc2
Merge remote-tracking branch 'upstream/main' into reject-action
li-boxuan Jun 1, 2024
9b99f01
Merge remote-tracking branch 'upstream/main' into reject-action
li-boxuan Jun 1, 2024
8566678
WIP
li-boxuan Jun 1, 2024
b7c1f22
Merge remote-tracking branch 'upstream/main' into reject-action
li-boxuan Jun 1, 2024
e1931fd
Merge remote-tracking branch 'upstream/main' into reject-action
li-boxuan Jun 1, 2024
e9734e5
Merge remote-tracking branch 'upstream/main' into reject-action
li-boxuan Jun 4, 2024
9dfa624
Fix tests
li-boxuan Jun 4, 2024
707d133
update test_edits for ManagerAgent
li-boxuan Jun 4, 2024
1243d6d
Skip local sandbox for reject test
li-boxuan Jun 4, 2024
48d81d5
Merge remote-tracking branch 'upstream/main' into reject-action
li-boxuan Jun 9, 2024
07a104c
Fix test comparison
li-boxuan Jun 9, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions opendevin/controller/agent_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
AddTaskAction,
AgentDelegateAction,
AgentFinishAction,
AgentRejectAction,
ChangeAgentStateAction,
MessageAction,
ModifyTaskAction,
Expand Down Expand Up @@ -114,7 +115,7 @@
self, action: Action, observation: Observation, add_to_stream=True
):
if self.state is None:
raise ValueError('Added history while state was None')

Check failure on line 118 in opendevin/controller/agent_controller.py

View workflow job for this annotation

GitHub Actions / test

Added history while state was None
if not isinstance(action, Action):
raise TypeError(
f'action must be an instance of Action, got {type(action).__name__} instead'
Expand Down Expand Up @@ -187,7 +188,9 @@
self.agent.reset()

async def set_agent_state_to(self, new_state: AgentState):
logger.info(f'Setting agent({type(self.agent).__name__}) state from {self._agent_state} to {new_state}')
logger.info(
f'Setting agent({type(self.agent).__name__}) state from {self._agent_state} to {new_state}'
)
if new_state == self._agent_state:
return

Expand All @@ -201,7 +204,11 @@
self._cur_step += 1
if self.agent_task is not None:
self.agent_task.cancel()
elif new_state == AgentState.STOPPED or new_state == AgentState.ERROR or new_state == AgentState.FINISHED:
elif (
new_state == AgentState.STOPPED
or new_state == AgentState.ERROR
or new_state == AgentState.FINISHED
):
await self.reset_task()

await self.event_stream.add_event(
Expand Down Expand Up @@ -262,7 +269,9 @@

self.update_state_after_step()

if isinstance(action, AgentFinishAction):
if isinstance(action, AgentFinishAction) or isinstance(
action, AgentRejectAction
):
self.state.outputs = action.outputs # type: ignore[attr-defined]
logger.info(action, extra={'msg_type': 'INFO'})
return True
Expand Down
Loading