ticket: split backend runtime registry integration

This commit is contained in:
2026-06-26 01:30:43 +09:00
parent 30363e5ed9
commit d6c240af35
12 changed files with 347 additions and 58 deletions
@@ -4,34 +4,10 @@
{
"ticket_id": "00001KVZKSV6C",
"kind": "depends_on",
"target": "00001KVZKST83",
"note": "Standalone remote Runtime should have FS persistence available before Backend integration.",
"target": "00001KVZBCQH4",
"note": "Backend RuntimeRegistry foundation should use worker-runtime core domain types.",
"author": "yoi ticket",
"at": "2026-06-25T14:47:43Z"
},
{
"ticket_id": "00001KVZKSV6C",
"kind": "depends_on",
"target": "00001KVZKSTE2",
"note": "Backend remote Runtime routing needs the REST command API.",
"author": "yoi ticket",
"at": "2026-06-25T14:47:43Z"
},
{
"ticket_id": "00001KVZKSV6C",
"kind": "depends_on",
"target": "00001KVZKSTJT",
"note": "Backend event proxy/observation needs the Runtime event stream API.",
"author": "yoi ticket",
"at": "2026-06-25T14:47:43Z"
},
{
"ticket_id": "00001KVZKSV6C",
"kind": "related",
"target": "00001KVZQHPNY",
"note": "Backend RuntimeRegistry integration will eventually coordinate config bundle sync for remote runtimes, but v0 can use builtin/default fallback.",
"author": "yoi ticket",
"at": "2026-06-25T15:51:07Z"
"at": "2026-06-25T16:30:00Z"
}
]
}
+62 -28
View File
@@ -1,51 +1,85 @@
---
title: 'Backend RuntimeRegistryをworker-runtimeへ接続する'
state: 'planning'
title: 'Backend RuntimeRegistryの基盤をworker-runtime向けに整理する'
state: 'ready'
created_at: '2026-06-25T14:44:03Z'
updated_at: '2026-06-25T15:51:07Z'
updated_at: '2026-06-25T16:30:31Z'
assignee: null
---
## 背景
Workspace Backend は複数 Runtime を束ねる `RuntimeRegistry` を持つ。Registry は Worker を実行する主体ではなく、embedded Runtime と remote Runtime process を同じ logical operation で扱うための集約境界である。`worker-runtime` core / REST command server / event stream server が揃ったら、Backend は embedded Runtime には direct lib call、remote Runtime には HTTP client / event stream client で接続できるようにする必要がある。
Workspace Backend は複数 Runtime を束ねる `RuntimeRegistry` を持つ。Registry は Worker を実行する主体ではなく、embedded Runtime と remote Runtime process、既存 local Worker compatibility adapter を同じ Backend-facing API から参照・routing するための集約境界である。
この Ticket Workspace backend の既存 local Pod metadata projection 寄りの Runtime/Worker handling を、`worker-runtime` の embedded/remote Runtime handles に接続する。
この Ticket は embedded Runtime 実装や remote HTTP client 実装を含めない。先に Backend 側の Registry 構造、runtime identity、capability/status projection、Browser-facing API の authority 境界を `worker-runtime` の domain model に合わせて整理する。
## 要件
- `worker-runtime``http-client` feature または Backend-local remote Runtime client を追加する。
- Backend RuntimeRegistry は少なくとも以下の handle を扱える。
- embedded Runtime handle
- remote HTTP Runtime client handle
- existing local Pod compatibility adapter は必要なら別 branch として残す
- Backend API は Browser から Runtime endpoint / credential / socket path / session path を受け取らない
- Browser-facing API は `runtime_id + worker_id` を authority とする
- Backend は Runtime config / endpoint / token secret ref / capability cache を管理する
- Backend は Runtime の command API を proxy し、policy / visibility / audit / typed error mapping を挟む
- Backend は Runtime event stream を購読または proxy できる形にする
- Existing `/api/workers` / `/api/hosts` / runtime list behavior を new Runtime model へ段階移行する
- Local Pod metadata reader は正規 Runtime ではなく compatibility adapter として扱う。
### Registry responsibility
- Backend `RuntimeRegistry` Runtime を実行しない
- Backend `RuntimeRegistry` は以下を扱う集約境界とする
- Runtime lookup
- Runtime summary / capability / status projection
- Runtime-scoped Worker identity の routing key
- Browser-facing API への safe projection
- workspace visibility / policy / audit hook point
- Runtime internal store / allocation registry と Backend `RuntimeRegistry` を混同しない
- Worker metadata persistence や live allocation authority は Runtime 側の責務とし、Backend Registry は直接所有しない
### Runtime identity / handle model
- Backend-facing Runtime identity は `runtime_id` を authority とする。
- Worker authority は `runtime_id + worker_id` とする。
- UI 表示用 `display_ref` は authority にしない。
- Registry は将来以下の runtime source を扱える shape にする。
- embedded `worker_runtime::Runtime`
- remote Runtime process client。
- existing local Worker/Pod compatibility adapter。
- この Ticket では embedded / remote 実 handle の実装は後続に残す。
- Existing local metadata projection は必要なら compatibility source として残すが、正規 Runtime authority として扱わない。
### Backend API boundary
- Browser-facing API は Runtime endpoint / token / socket path / session path / local metadata path を受け取らない。
- Browser-facing API は `runtime_id + worker_id` を authority として扱える shape にする。
- Existing `/api/workers` / `/api/hosts` / runtime list behavior は、新 Registry model へ段階移行できるよう整理する。
- v0 では既存 API の behavior を維持しつつ、内部 model を RuntimeRegistry に寄せてよい。
- New runtime-scoped endpoints を足すか、既存 endpoints を拡張するかは実装時に決めてよいが、ticket内で選んだ方針を記録する。
### Implementation target
- 主な対象は `crates/workspace-server/src/hosts.rs``crates/workspace-server/src/server.rs` とする。
- 既存 `WorkerRuntimeRegistry` / `LocalPodRuntime` / `LocalRuntimeBridge` 相当を、Backend Registry foundation と local compatibility source の境界に整理する。
- `LocalPodRuntime` という名前が正規 Runtime 実装に見える場合は、`LocalPodCompatibilitySource` / `LocalWorkerCompatibilityAdapter` 相当の名前へ寄せる。
- 既存 local metadata reader の behavior は維持してよいが、Runtime authority ではなく compatibility projection として diagnostics / implementation kind に表す。
- 既存 `/api/hosts` / `/api/workers` / `/api/hosts/{host_id}/workers` の outward behavior は原則維持する。
- runtime-scoped endpoint を新設する場合は、既存 endpoint を壊さず追加する。
- この Ticket では Worker create / send input / remote HTTP call / embedded direct call の実処理は実装しない。後続 handle が差し込める型・routing境界までに留める。
### Error / diagnostics
- Unknown runtime、unknown worker、runtime unavailable、operation unsupported、worker not visible を typed に分けられるようにする。
- Compatibility local source 由来の stale metadata / invalid metadata は diagnostic として扱い、Runtime authority を歪めない。
## Non-goals
- `worker-runtime` core crate implementation
- REST command server implementation
- Event stream server implementation。
- Embedded `worker_runtime::Runtime` の登録・routing 実装
- Remote HTTP Runtime client 実装
- REST command server / event stream server implementation。
- Backend internal Companion Web Console completion。
- Dynamic Runtime registration。
- Full auth / permission model。
- Removing local Pod compatibility path。
- Removing local compatibility path。
## 受け入れ条件
- Workspace backend can register an embedded `worker_runtime::Runtime`.
- Workspace backend can register a remote Runtime client from config-like data.
- Backend RuntimeRegistry routes list/detail/input/transcript/event operations to embedded or remote Runtime handles.
- Browser-facing API does not expose Runtime credentials, raw endpoint authority, socket path, or session path.
- Existing worker list/detail endpoints continue to work or are explicitly replaced with new runtime-scoped endpoints.
- Local Pod metadata projection is clearly marked as compatibility adapter, not the Runtime authority.
- Focused workspace-server tests cover embedded Runtime and mocked remote Runtime routing.
- Workspace backend `worker-runtime` domain model と整合した `RuntimeRegistry` 基盤がある。
- Registry は Runtime identity / Worker routing key / capability / status projection を扱える。
- Registry の責務が Runtime internal store/allocation と code/docs/tests 上で分離されている。
- Browser-facing API が Runtime endpoint / token / socket path / session path を authority として受け取らない。
- Existing local Worker/Pod metadata projection は compatibility source として明示されている。
- Embedded/remote runtime 実装は後続 Ticket で追加できる handle boundary がある。
- Focused workspace-server tests cover Registry identity/projection/error mapping and local compatibility source behavior.
- `cargo test -p yoi-workspace-server` が通る。
- `cargo check -p yoi` が通る。
- `git diff --check` が通る。
+37
View File
@@ -4,4 +4,41 @@
LocalTicketBackend によって作成されました。
---
<!-- event: decision author: hare at: 2026-06-25T16:27:28Z -->
## Decision
Decision update: split Backend Runtime work into three implementation tickets.
1. 00001KVZKSV6C Backend RuntimeRegistryの基盤をworker-runtime向けに整理する
- Registry identity/projection/error boundary only.
- No embedded Runtime handle implementation.
- No remote Runtime client implementation.
2. 00001KVZSGT0Q Backend RuntimeRegistryにembedded worker-runtimeを接続する
- Direct lib-call integration for backend-internal Runtime.
3. 00001KVZSGT14 Backend RuntimeRegistryにremote worker-runtime processを接続する
- HTTP/event-stream client integration for remote Runtime processes.
Companion Web Console depends on embedded integration, not remote integration.
---
<!-- event: intake_summary author: hare at: 2026-06-25T16:30:31Z -->
## Intake summary
Marked ready by `yoi ticket state`.
---
<!-- event: state_changed author: "yoi ticket" at: 2026-06-25T16:30:31Z from: planning to: ready reason: cli_state field: state -->
## State changed
Marked ready by `yoi ticket state`.
---