From 66bd62b69bc873ea4e1f51f8ef936f4de07e02a5 Mon Sep 17 00:00:00 2001 From: aran-yogesh Date: Mon, 23 Feb 2026 13:13:54 -0800 Subject: [PATCH] feat: add AGENTS.md support and fix repo cloning --- apps/agent/agent/server.py | 8 +++----- apps/agent/agent/utils/agents_md.py | 6 ++++++ 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/apps/agent/agent/server.py b/apps/agent/agent/server.py index 37007cc8..1dad6586 100644 --- a/apps/agent/agent/server.py +++ b/apps/agent/agent/server.py @@ -137,11 +137,10 @@ async def _clone_or_pull_repo_in_sandbox( # noqa: PLR0915 logger.exception("Failed to restore clean remote URL") raise - logger.info("Repo updated at %s", repo_dir) - return repo_dir - - + logger.info("Repo updated at %s", 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) try: 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") if 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): logger.info("No thread_id or not for execution, returning agent without sandbox") diff --git a/apps/agent/agent/utils/agents_md.py b/apps/agent/agent/utils/agents_md.py index 3d7ef45b..715de9f9 100644 --- a/apps/agent/agent/utils/agents_md.py +++ b/apps/agent/agent/utils/agents_md.py @@ -3,10 +3,13 @@ from __future__ import annotations import asyncio +import logging import shlex from deepagents.backends.protocol import SandboxBackendProtocol +logger = logging.getLogger(__name__) + async def read_agents_md_in_sandbox( sandbox_backend: SandboxBackendProtocol, @@ -24,7 +27,10 @@ async def read_agents_md_in_sandbox( f"test -f {safe_agents_path} && cat {safe_agents_path}", ) if result.exit_code != 0: + logger.debug("AGENTS.md not found at %s", safe_agents_path) return None content = result.output or "" content = content.strip() + if content: + logger.info("Loaded AGENTS.md from %s", safe_agents_path) return content or None