Forward sandbox into agent builder backend
All checks were successful
build / build (push) Successful in 4s

This commit is contained in:
robert
2026-06-03 21:51:30 -03:00
parent 74c99643b4
commit bc8de5a7ae
3 changed files with 60 additions and 4 deletions

View File

@@ -27,6 +27,7 @@ class BuilderContext:
settings: Settings | None = None
project_prefix: str | None = None
workspace: Any | None = None
sandbox: Any | None = None
grant_token: str | None = None
# LLM creds forwarded by the orchestrator according to this agent's Card.
# The builder accepts caller-selected creds and falls back to platform
@@ -368,7 +369,12 @@ def _build_project_backend(ctx: BuilderContext, *, settings: Settings) -> Any |
except Exception: # noqa: BLE001
return _with_builder_skills(StateBackend())
return _with_builder_skills(
_workspace_backend_with_grep_compat(WorkspaceBackend, ctx.workspace),
_workspace_backend_with_grep_compat(
WorkspaceBackend,
ctx.workspace,
sandbox=ctx.sandbox,
default_image=settings.image,
),
artifacts_root=f"/{prefix}/{_BUILDER_ARTIFACT_DIR}",
)
try:
@@ -404,12 +410,21 @@ def _build_project_backend(ctx: BuilderContext, *, settings: Settings) -> Any |
)
)
return _with_builder_skills(
_workspace_backend_with_grep_compat(WorkspaceBackend, workspace),
_workspace_backend_with_grep_compat(
WorkspaceBackend,
workspace,
sandbox=ctx.sandbox,
default_image=settings.image,
),
artifacts_root=f"/{prefix}/{_BUILDER_ARTIFACT_DIR}",
)
def _workspace_backend_with_grep_compat(workspace_backend_cls: Any, workspace: Any) -> Any:
def _workspace_backend_with_grep_compat(
workspace_backend_cls: Any,
workspace: Any,
**backend_kwargs: Any,
) -> Any:
"""Patch older a2a-pack WorkspaceBackend grep glob behavior.
Older ``WorkspaceBackend.grep`` only matched ``glob`` against the full
@@ -436,7 +451,7 @@ def _workspace_backend_with_grep_compat(workspace_backend_cls: Any, workspace: A
return result
return super().grep(pattern, path=path, glob=scoped_glob)
return BuilderWorkspaceBackend(workspace)
return BuilderWorkspaceBackend(workspace, **backend_kwargs)
def _with_builder_skills(default_backend: Any, *, artifacts_root: str = "/") -> Any: