Skip to content

armgit / E2B

Public Imported from GitHub
0

Open-source, secure environment with real-world tools for enterprise-grade agents.

Fix initial smol dev run

Tomas Valentadb014bfbea5e
diff --git a/api-service/agent/smol_agent.py b/api-service/agent/smol_agent.py
index c5fd1bd4a..240b83de8 100644
--- a/api-service/agent/smol_agent.py
+++ b/api-service/agent/smol_agent.py
@@ -64,7 +64,9 @@ class SmolAgent(AgentBase):
git_app_email: str = instructions["GitHubAppEmail"]
commit_message: str = instructions["CommitMessage"]
- repo_address = f"https://{access_token}@github.com/{owner}/{repo}.git"
+ repo_address = (
+ f"https://{git_app_name}:{access_token}@github.com/{owner}/{repo}.git"
+ )
# TODO: Apply the file rewrite when the agent was invoked via PR code comment
file: str | None = instructions.get("File", None)
@@ -86,6 +88,15 @@ class SmolAgent(AgentBase):
branch=branch,
)
+ # await playground.write_file("/repo/test", "..>")
+ # await playground.push_repo(
+ # rootdir=rootdir,
+ # repo_address=repo_address,
+ # commit_message=commit_message,
+ # git_email=git_app_email,
+ # git_name=git_app_name,
+ # )
+
async def clean_dir():
extensions_to_skip = [
".png",
@@ -99,7 +110,7 @@ class SmolAgent(AgentBase):
".tiff",
] # Add more extensions if needed
- files = await playground.get_filenames(rootdir, [])
+ files = await playground.get_filenames(rootdir, [".git"])
for file in files:
_, extension = os.path.splitext(file.name)
if extension not in extensions_to_skip:
@@ -191,7 +202,7 @@ class SmolAgent(AgentBase):
shared_dependencies: str | None = None
try:
shared_dependencies = await playground.read_file(
- "shared_dependencies.md"
+ os.path.join(rootdir, "shared_dependencies.md")
)
except NotFoundException:
pass
@@ -203,7 +214,7 @@ class SmolAgent(AgentBase):
shared_dependencies=shared_dependencies,
prompt=user_prompt,
)
- await playground.write_file(filename, filecode)
+ await playground.write_file(os.path.join(rootdir, filename), filecode)
else:
await clean_dir()
@@ -228,7 +239,7 @@ class SmolAgent(AgentBase):
print(shared_dependencies)
# write shared dependencies as a md file inside the generated directory
await playground.write_file(
- "shared_dependencies.md",
+ os.path.join(rootdir, "shared_dependencies.md"),
shared_dependencies,
)
@@ -246,7 +257,7 @@ class SmolAgent(AgentBase):
generated_files = await asyncio.gather(*tasks)
for name, content in generated_files:
- await playground.write_file(name, content)
+ await playground.write_file(os.path.join(rootdir, name), content)
await playground.push_repo(
rootdir=rootdir,
diff --git a/api-service/session/playground/base.py b/api-service/session/playground/base.py
index 96650e014..92cfe2d68 100644
--- a/api-service/session/playground/base.py
+++ b/api-service/session/playground/base.py
@@ -1,5 +1,4 @@
import math
-import uuid
from typing import Any, List
from asyncio import sleep
@@ -52,7 +51,7 @@ class Playground(Session):
):
await self.make_dir(rootdir)
res = await self.run_command(
- f"git clone --single-branch --depth 1 --branch {branch} {repo_address} {rootdir}",
+ f"git clone --depth 1 --branch {branch} {repo_address} {rootdir}",
rootdir="/",
)
print("Repo clone result", res)
@@ -67,7 +66,8 @@ class Playground(Session):
):
res = await self.run_command(
(
- f"git config --global user.email {git_email} && "
+ f"cd {rootdir} && "
+ f'git config --global user.email "{git_email}" && '
f'git config --global user.name "{git_name}" && '
f"git config --global push.autoSetupRemote true && "
f"git add . && "
diff --git a/github/pullRequest.ts b/github/pullRequest.ts
index 3ee3cecf5..a72daba9f 100644
--- a/github/pullRequest.ts
+++ b/github/pullRequest.ts
@@ -242,10 +242,10 @@ export async function getGHAppInfo({
}) {
const result = await client.apps.getAuthenticated()
const id = result.data.id
- const name = result.data.slug || result.data.name
+ const name = `${result.data.slug}[bot]`
return {
name,
- email: `${id}+${name}[bot]@users.noreply.github.com`
+ email: `${id}+${name}@users.noreply.github.com`
}
}
diff --git a/pages/agent/smol-developer/setup.tsx b/pages/agent/smol-developer/setup.tsx
index c541e2230..5aa5ed0aa 100644
--- a/pages/agent/smol-developer/setup.tsx
+++ b/pages/agent/smol-developer/setup.tsx
@@ -86,7 +86,7 @@ function Repo() {
const sessionCtx = useSessionContext()
const [selectedRepo, setSelectedRepo] = useState<RepoSetup>()
const [initialPrompt, setInitialPrompt] = useState<string>('create chrome extension')
- const [openAIAPIKey, setOpenAIAPIKey] = useState<string>('..')
+ const [openAIAPIKey, setOpenAIAPIKey] = useState<string>('')
async function signOut() {
await supabaseClient.auth.signOut()