allenai / allenai/asta-autodiscovery

Unify AD-job code execution onto the asta-sandbox backend registry

オープン
#55 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Python
スター
10
フォーク
2
平均マージ
1日 21時間
マージ済み PR(30日)
11

説明

### Context

Making the code-execution backend configurable (part of #34) surfaced an inconsistency in how the AD job runs generated code. The job's `--backend` flag has three values, but only one routes through `asta-sandbox`:

- `modal` → `asta_sandbox.backends.modal_ephemeral.ModalEphemeralExecutor` (asta-sandbox)
- `process` → the workspace's own `code_execution.ProcessIPythonBackend` (**not** asta-sandbox), wrapped by an ad-hoc `_ProcessBackendAdapter` in `packages/autodiscovery/src/autodiscovery/agents.py`
- `local` → autogen's `LocalCommandLineCodeExecutor` (**not** asta-sandbox)

`asta-sandbox` already ships equivalent backends: `inprocess`, `docker`, `modal_ephemeral`, `modal_kernel`. So today's `process`/`local` are parallel, one-off implementations of things the library provides (or could).

### Proposal

Route all code execution through the `asta-sandbox` backend registry so backend selection is uniform and the ad-hoc adapter goes away:

- Transplant `ProcessIPythonBackend` onto `asta_sandbox.SandboxBase` as a first-class local process backend (make `run_cell` async via `asyncio.to_thread`) and move it into the `asta-sandbox` library alongside `InProcessExecutor` and `ModalEphemeralExecutor`. This is already flagged by a `TODO` in `packages/code_execution/src/code_execution/process_backend.py`.
- Once it lives in the library, delete `_ProcessBackendAdapter` in `agents.py` and construct executors from a single `SandboxBase` factory keyed by the backend name.
- Consider mapping the job's `--backend` names onto the library's names (or adopting the library's names directly) so the vocabulary is shared.

### Why not now

This PR keeps the change small and low-risk: it makes the existing, working knob configurable (`CODE_EXECUTION_BACKEND`) without moving code between packages or changing the `asta-sandbox` public surface. The unification is a mechanical-but-cross-package refactor best done on its own.

### Acceptance

- The AD job's code execution is selected via a single `asta-sandbox` `SandboxBase` factory.
- `_ProcessBackendAdapter` is removed.
- No behavior change for existing `process`/`local`/`modal` runs.

Related: #34

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

調査の方向性

Start by reading packages/code_execution/src/code_execution/process_backend.py and packages/autodiscovery/src/autodiscovery/agents.py, then trace the AD job's --backend entry point and compare the asta-sandbox SandboxBase and existing executor implementations. Done means process, local, and modal all use one SandboxBase factory, _ProcessBackendAdapter is gone, and existing runs retain their behavior.

索引モデルが issue の本文から書いたものです。

評価

技術スタック
python
領域
backend, tooling
issue の種類
リファクタリング
難易度
4/5
見積もり時間
3〜5日
活発さ
静か
明瞭さ
おおむね明確
初心者へのやさしさ
45/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。