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

Fix issue #4739: '[Bug]: The agent doesn'"'"'t know its name' #4740

Merged
merged 3 commits into from
Nov 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -279,4 +279,3 @@ Cette fonction fait ce qui suit :
3. Si l'agent a fait plusieurs tentatives, il lui donne la possibilité d'abandonner

En utilisant cette fonction, vous pouvez garantir un comportement cohérent sur plusieurs exécutions d'évaluation et empêcher l'agent de rester bloqué en attendant une entrée humaine.

Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,3 @@ docker run -it \
ghcr.io/all-hands-ai/openhands:0.11 \
python -m openhands.core.main -t "write a bash script that prints hi"
```

1 change: 0 additions & 1 deletion evaluation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,3 @@ all the preprocessing/evaluation/analysis scripts.
- Raw data and experimental records should not be stored within this repo.
- For model outputs, they should be stored at [this huggingface space](https://huggingface.co/spaces/OpenHands/evaluation) for visualization.
- Important data files of manageable size and analysis scripts (e.g., jupyter notebooks) can be directly uploaded to this repo.

2 changes: 1 addition & 1 deletion frontend/.eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,4 @@
}
}
]
}
}
2 changes: 1 addition & 1 deletion frontend/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# i18n translation files make by script using `make build`
public/locales/**/*
src/i18n/declaration.ts
.env
.env
1 change: 0 additions & 1 deletion frontend/__tests__/utils/extractModelAndProvider.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,3 @@ describe("extractModelAndProvider", () => {
});
});
});

Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,3 @@ test("organizeModelsAndProviders", () => {
},
});
});

2 changes: 1 addition & 1 deletion frontend/src/assets/arrow-send.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion frontend/src/assets/branding/all-hands-logo-spark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion frontend/src/assets/branding/github-logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion frontend/src/assets/clip.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion frontend/src/assets/clipboard.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion frontend/src/assets/default-user.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion frontend/src/assets/docs.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion frontend/src/assets/external-link.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion frontend/src/assets/lightbulb.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion frontend/src/assets/loading-outer.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion frontend/src/assets/message.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion frontend/src/assets/new-project.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion frontend/src/assets/refresh.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions frontend/src/utils/suggestions/non-repo-suggestions.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const KEY_1 = "Build an app to view pull requests";
const VALUE_1 = `I want to create a React app to view all of the open pull
requests that exist on all of my team's github repos. Here
const VALUE_1 = `I want to create a React app to view all of the open pull
requests that exist on all of my team's github repos. Here
are some details:

1. Please initialize the app using vite and react-ts.
Expand Down
2 changes: 1 addition & 1 deletion frontend/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@
// Vite takes care of building everything, not tsc.
"noEmit": true
}
}
}
3 changes: 2 additions & 1 deletion openhands/agenthub/codeact_agent/function_calling.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@
)
from openhands.events.tool import ToolCallMetadata

SYSTEM_PROMPT = """You are a helpful assistant that can interact with a computer to solve tasks.
SYSTEM_PROMPT = """You are OpenHands agent, a helpful AI assistant that can interact with a computer to solve tasks.
<IMPORTANT>
* If user provides a path, you should NOT assume it's relative to the current working directory. Instead, you should explore the file system to find the file before working on it.
* When configuring git credentials, use "openhands" as the user.name and "[email protected]" as the user.email by default, unless explicitly instructed otherwise.
</IMPORTANT>
"""

Expand Down
2 changes: 1 addition & 1 deletion openhands/runtime/impl/eventstream/eventstream_runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ def _init_container(self):
volumes = None
self.log(
'debug',
f'Sandbox workspace: {self.config.workspace_mount_path_in_sandbox}'
f'Sandbox workspace: {self.config.workspace_mount_path_in_sandbox}',
)

if self.config.sandbox.browsergym_eval_env is not None:
Expand Down
4 changes: 3 additions & 1 deletion openhands/runtime/utils/runtime_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,9 @@ def build_runtime_image_in_folder(

logger.info(f'Building image: {hash_image_name}')
if force_rebuild:
logger.debug(f'Force rebuild: [{runtime_image_repo}:{source_tag}] from scratch.')
logger.debug(
f'Force rebuild: [{runtime_image_repo}:{source_tag}] from scratch.'
)
prep_build_folder(
build_folder,
base_image,
Expand Down
5 changes: 2 additions & 3 deletions openhands/runtime/utils/tenacity_stop.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@


from tenacity import RetryCallState
from tenacity.stop import stop_base

from openhands.runtime.utils.shutdown_listener import should_exit


class stop_if_should_exit(stop_base):
"""Stop if the should_exit flag is set."""

def __call__(self, retry_state: "RetryCallState") -> bool:
def __call__(self, retry_state: 'RetryCallState') -> bool:
return should_exit()
3 changes: 2 additions & 1 deletion openhands/server/session/agent_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,10 @@ async def _start(
def close(self):
"""Closes the Agent session"""
self._closed = True

def inner_close():
asyncio.run(self._close())

asyncio.get_event_loop().run_in_executor(None, inner_close)

async def _close(self):
Expand All @@ -142,7 +144,6 @@ async def _close(self):
if self.security_analyzer is not None:
await self.security_analyzer.close()


def _create_security_analyzer(self, security_analyzer: str | None):
"""Creates a SecurityAnalyzer instance that will be used to analyze the agent actions

Expand Down
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ reportlab = "*"
[tool.coverage.run]
concurrency = ["gevent"]


[tool.poetry.group.runtime.dependencies]
jupyterlab = "*"
notebook = "*"
Expand Down Expand Up @@ -122,6 +123,7 @@ ignore = ["D1"]
[tool.ruff.lint.pydocstyle]
convention = "google"


[tool.poetry.group.evaluation.dependencies]
streamlit = "*"
whatthepatch = "*"
Expand Down