mirror of
https://github.com/Sea-Haven-Industries/open-swe.git
synced 2026-10-04 14:52:12 +00:00
feat: add AGENTS.md support and fix repo cloning
This commit is contained in:
parent
2d5da34b3d
commit
66bd62b69b
2 changed files with 9 additions and 5 deletions
|
|
@ -140,8 +140,7 @@ async def _clone_or_pull_repo_in_sandbox( # noqa: PLR0915
|
||||||
logger.info("Repo updated at %s", repo_dir)
|
logger.info("Repo updated at %s", repo_dir)
|
||||||
return repo_dir
|
return repo_dir
|
||||||
|
|
||||||
|
# If we reach here, repo doesn't exist or is invalid - clone it
|
||||||
|
|
||||||
logger.info("Cloning repo %s/%s to %s", owner, repo, repo_dir)
|
logger.info("Cloning repo %s/%s to %s", owner, repo, repo_dir)
|
||||||
try:
|
try:
|
||||||
result = await loop.run_in_executor(
|
result = await loop.run_in_executor(
|
||||||
|
|
@ -218,7 +217,6 @@ async def get_agent(config: RunnableConfig) -> Pregel: # noqa: PLR0915
|
||||||
encrypted_token = config["configurable"].get("github_token_encrypted")
|
encrypted_token = config["configurable"].get("github_token_encrypted")
|
||||||
if encrypted_token:
|
if encrypted_token:
|
||||||
github_token = decrypt_token(encrypted_token)
|
github_token = decrypt_token(encrypted_token)
|
||||||
logger.debug("Decrypted GitHub token")
|
|
||||||
|
|
||||||
if thread_id is None or not graph_loaded_for_execution(config):
|
if thread_id is None or not graph_loaded_for_execution(config):
|
||||||
logger.info("No thread_id or not for execution, returning agent without sandbox")
|
logger.info("No thread_id or not for execution, returning agent without sandbox")
|
||||||
|
|
|
||||||
|
|
@ -3,10 +3,13 @@
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import asyncio
|
import asyncio
|
||||||
|
import logging
|
||||||
import shlex
|
import shlex
|
||||||
|
|
||||||
from deepagents.backends.protocol import SandboxBackendProtocol
|
from deepagents.backends.protocol import SandboxBackendProtocol
|
||||||
|
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
async def read_agents_md_in_sandbox(
|
async def read_agents_md_in_sandbox(
|
||||||
sandbox_backend: SandboxBackendProtocol,
|
sandbox_backend: SandboxBackendProtocol,
|
||||||
|
|
@ -24,7 +27,10 @@ async def read_agents_md_in_sandbox(
|
||||||
f"test -f {safe_agents_path} && cat {safe_agents_path}",
|
f"test -f {safe_agents_path} && cat {safe_agents_path}",
|
||||||
)
|
)
|
||||||
if result.exit_code != 0:
|
if result.exit_code != 0:
|
||||||
|
logger.debug("AGENTS.md not found at %s", safe_agents_path)
|
||||||
return None
|
return None
|
||||||
content = result.output or ""
|
content = result.output or ""
|
||||||
content = content.strip()
|
content = content.strip()
|
||||||
|
if content:
|
||||||
|
logger.info("Loaded AGENTS.md from %s", safe_agents_path)
|
||||||
return content or None
|
return content or None
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue