feat(archied): read-only run-scoped sandbox view over the harness contract (#1662)
* feat(archied): read-only run-scoped sandbox view over the harness contract Serve RunTarget: the daemon resolves a running task and attempt to its Kit container and follows its output, refusing a finished or unknown task with a stated reason. The dashboard adds a Sandbox tab behind the task log's read authority. Takeover stays out of scope until the sod1 authority is wired. * fix(archied): scope and close sandbox views correctly Forward harness activity into container output, bind containers and dashboard views to their attempt, enforce the asserted org, and report unavailable dependencies and interrupted streams accurately. Refs: archie-core-qi91, archie-core-252tj
This commit is contained in:
1 parent
59be81c7f6
commit
acec5d392d
29 files changed
+838
-139
No files matched your search
@@ -193,11 +193,51 @@ established egress phase differ.
|
||||
client's refused connection is gRPC's `Unavailable`. The dashboard's
|
||||
existing failure surface is the honest degrade; `/api/harness`'s `terminal`
|
||||
field means "a client is configured", not "the daemon can run a Kit".
|
||||
- **Run target.** Deferred (`archie-core-qi91`). `Open` answers `Unimplemented`
|
||||
for it in the setup slice. A finished or absent attempt will be `NotFound`,
|
||||
not `Unavailable`.
|
||||
- **Run target.** `RunTarget{task_id, attempt}` opens a read-only view of a
|
||||
running task's sandbox; it ships as the peek. The daemon resolves the pair
|
||||
itself, so the dashboard never learns a container name: the task store says
|
||||
whether the task is `running` and which attempt is current, and the Kit
|
||||
launcher names the container `kitrun.TaskContainer(task_id, attempt)` (one
|
||||
container per attempt, removed when the run ends; volumes remain task-scoped
|
||||
for retries). A finished or unknown task, a task that is not running, an
|
||||
attempt other than the running one, or a container that is gone is
|
||||
`NotFound` with the reason in the message; an unreachable task store or
|
||||
container engine is `Unavailable`. The view follows the container's stdout
|
||||
and stderr, including the harness output forwarded by the worker, carries
|
||||
no stdin and no exec, and
|
||||
ends when the task's container ends or the client leaves, so it confers no
|
||||
authority over the container. A read-only tail of the existing per-attempt
|
||||
logs was rejected: those refresh only on task state changes and are the
|
||||
daemon's account, not the sandbox's.
|
||||
Mid-stream failures are shown as a reason in the terminal before it closes.
|
||||
- **Authorisation.** The dashboard route `GET /api/tasks/{id}/sandbox` is
|
||||
decided as `read-logs` on the task before the handler runs, so a caller
|
||||
sees a sandbox exactly when they may read that task's log. The daemon
|
||||
checks that the task belongs to the asserted org before following output.
|
||||
- **Grants.** The view takes no grant of its own. The run's egress session
|
||||
(its proxy token, install then `EnterRuntime`) already belongs to the run
|
||||
and is revoked by `Launcher.Release` when the task ends; the view reads
|
||||
after that phase switch and dies with the container.
|
||||
- **Credentials.** The sandbox holds sentinels, never real credentials:
|
||||
API keys are `egress.Sentinel` (`credentials.go`), and an OAuth token set
|
||||
is sentinelised in the response and swapped back by the proxy only on a
|
||||
granted service's resource host in the matching phase (`oauth.go`,
|
||||
`injectOAuth`). The proxy runs in the daemon outside the container, so a
|
||||
shell in the container sees only sentinels.
|
||||
- **Takeover (interactive PTY into a running task) is out of scope for this
|
||||
bead.** It needs the dangerous-command authority (`archie-core-sod1`) to
|
||||
gate it, and that authority is not wired for it: the harness listener has
|
||||
no approval step; `ToolSetOptions.Approval` in `internal/agentexec/modelloop`
|
||||
is never set by a caller, so task runs never build approval-required tools;
|
||||
approvals reach a human only on the chat paths (dashboard ask, Telegram,
|
||||
Gateway). Takeover would also need an audit record naming the actor, task,
|
||||
attempt and open/close times, and revocation tied to task end (the exec is
|
||||
closed with the container). Those follow the setup session's shape
|
||||
(`harnesssession.Session`, `container.ExecPTY`) once the authority exists.
|
||||
- **Audit.** Opening and closing a session and a successful capture are
|
||||
recorded with the asserted org and profile.
|
||||
recorded with the asserted org and profile. A run view's open and close are
|
||||
logged with the task and attempt; it reads output only, so it has no
|
||||
takeover record.
|
||||
|
||||
Each session is the only interactive path into a harness container.
|
||||
|
||||
|
||||
Reference in new issue
Block a user