ticket: plan runtime connection negotiation

This commit is contained in:
Keisuke Hirata 2026-07-03 00:29:58 +09:00
parent fee175fc72
commit 578ea261a4
No known key found for this signature in database
2 changed files with 79 additions and 13 deletions

View File

@ -2,7 +2,7 @@
title: 'Workspace Backend Runtime接続の管理画面と永続configを追加する' title: 'Workspace Backend Runtime接続の管理画面と永続configを追加する'
state: 'planning' state: 'planning'
created_at: '2026-07-02T13:54:52Z' created_at: '2026-07-02T13:54:52Z'
updated_at: '2026-07-02T14:00:49Z' updated_at: '2026-07-02T14:55:21Z'
assignee: null assignee: null
--- ---
@ -19,7 +19,7 @@ Workspace Backend は embedded Runtime を process 内に持ち、remote Runtime
- Workspace Browser から Runtime connection を確認・追加・削除できるようにする。 - Workspace Browser から Runtime connection を確認・追加・削除できるようにする。
- Runtime connection config を `.yoi/workspace-backend.local.toml` に永続化する。 - Runtime connection config を `.yoi/workspace-backend.local.toml` に永続化する。
- raw token 値、Runtime internal store path、socket path、event cursor などを保存・表示しない。 - raw token 値、Runtime internal store path、socket path、event cursor などを保存・表示しない。
- RuntimeRegistry の live state と config の境界を明確にする。 - RuntimeRegistry の live state、persisted config、connection check / negotiation result の境界を明確にする。
- 手動 Worker 作成 UI が選択できる Runtime 候補の基盤を作る。 - 手動 Worker 作成 UI が選択できる Runtime 候補の基盤を作る。
## 依存関係 ## 依存関係
@ -43,6 +43,10 @@ Workspace Backend は embedded Runtime を process 内に持ち、remote Runtime
- `ServerConfig.remote_runtime_sources` を経由して `RuntimeRegistry` に登録される。 - `ServerConfig.remote_runtime_sources` を経由して `RuntimeRegistry` に登録される。
- 現状は起動時登録だけで、UI/API からの追加・削除は無い。 - 現状は起動時登録だけで、UI/API からの追加・削除は無い。
- `token_ref` は schema にあるが secret resolution は未実装なので、v0 では fail closed か未対応表示にする。 - `token_ref` は schema にあるが secret resolution は未実装なので、v0 では fail closed か未対応表示にする。
- 現状は明示的な negotiation / handshake は無い。
- Backend は remote Runtime 操作時に `GET /v1/runtime`、`GET /v1/workers` などを呼び、失敗時は diagnostic を返す。
- `GET /v1/runtime` が事実上の疎通確認になっているが、protocol version、API compatibility、spawn/input/event stream support を接続時に合意する仕組みではない。
- Runtime connection management の `test` は、この現状を踏まえて endpoint reachability だけでなく lightweight negotiation / compatibility check として設計する。
## Config schema ## Config schema
@ -129,11 +133,55 @@ v0 では `token_ref` は未対応でもよい。対応する場合も raw token
- embedded Runtime は削除不可。 - embedded Runtime は削除不可。
- 存在しない id は typed diagnostic。 - 存在しない id は typed diagnostic。
### TEST ### TEST / negotiation
- config を保存せず、endpoint に接続可能か確認する。 `test` は単なる ping ではなく、remote Runtime の lightweight negotiation / compatibility check として扱う。
- v0 では lightweight `GET /health` 相当または Runtime HTTP summary endpoint を使う。
- secret / token が必要な Runtime は v0 では未対応 diagnostic でもよい。 v0 の check:
1. endpoint の URL / scheme を validate する。
2. Backend-owned HTTP client で `GET /v1/runtime` を呼ぶ。
3. JSON response が `worker-runtime` の runtime summary として parse できるか確認する。
4. observed runtime id / display name / status / capabilities を読む。
5. Browser が必要とする操作に対して compatibility を判定する。
- list workers。
- observe worker detail。
- event websocket endpoint を構成できること。
- spawn worker support。
- input dispatch support。
- ConfigBundle availability check / sync support。
6. diagnostics を sanitized して返す。
現行 Runtime API に protocol version field が無い場合、fake version を作らない。代わりに次のように表現する。
```json
{
"protocol": {
"compatible": true,
"basis": "v1 runtime endpoint responded"
}
}
```
version / feature negotiation field が必要なら、この Ticket 内で既存 API を確認して追加するか、別 Ticket に分ける。
`test` の response は config persistence と分ける。
保存しないもの:
- observed capabilities。
- observed runtime status。
- checked_at。
- health result。
- diagnostics。
v0 ではこれらは API response / UI 表示だけに使う。保存が必要になった場合は Backend DB の observation / cache として扱い、`.yoi/workspace-backend.local.toml` には入れない。
Unsupported Runtime の扱い:
- `test` では `compatible=false` と typed diagnostic を返す。
- `POST` で保存前 check を必須にするかは実装時に決める。
- 保存を許す場合でも UI は `not_compatible` / `restart will not make this usable` などの diagnostic を表示する。
## Live反映方針 ## Live反映方針
@ -150,7 +198,7 @@ v0 は config persistence を優先し、live RuntimeRegistry への hot registe
理由: 理由:
- RuntimeRegistry の unregister は worker selection / observation / console subscription への影響がある。 - RuntimeRegistry の unregister は worker selection / observation / console subscription への影響がある。
- live health と persisted config を混ぜると責務が増える。 - live / negotiated runtime state と persisted config を混ぜると責務が増える。
- まずは永続 config 管理を作り、live反映は別 Ticket に分けられる。 - まずは永続 config 管理を作り、live反映は別 Ticket に分けられる。
## UI 設計 ## UI 設計
@ -169,7 +217,7 @@ Settings / Runtime Connections 画面を追加する。
- id - id
- display name - display name
- endpoint - endpoint
- persisted / active / restart required status - persisted / active / restart required / compatible status
- Test - Test
- Delete - Delete
@ -198,10 +246,10 @@ v0 は typed TOML serialize で comments が失われてもよいが、その場
- Runtime connection settings API を追加する。 - Runtime connection settings API を追加する。
- `.yoi/workspace-backend.local.toml``[[runtimes.remote]]` を read-modify-write できる。 - `.yoi/workspace-backend.local.toml``[[runtimes.remote]]` を read-modify-write できる。
- embedded Runtime は built-in connection として表示され、削除不可。 - embedded Runtime は built-in connection として表示され、削除不可。
- remote Runtime connection の add/delete/test ができる。 - remote Runtime connection の add/delete/test negotiation ができる。
- v0 では config 更新後 `restart_required = true` を返す。 - v0 では config 更新後 `restart_required = true` を返す。
- raw token 値を request / response / config file に持たない。 - raw token 値を request / response / config file に持たない。
- RuntimeRegistry live state と persisted config を混同しない。 - RuntimeRegistry live state、persisted config、negotiation result を混同しない。
- Settings / Runtime Connections UI を追加する。 - Settings / Runtime Connections UI を追加する。
- Manual Coding Worker 作成 UI で使う Runtime candidate 情報に接続できる projection を用意する。 - Manual Coding Worker 作成 UI で使う Runtime candidate 情報に接続できる projection を用意する。
@ -211,12 +259,13 @@ v0 は typed TOML serialize で comments が失われてもよいが、その場
- embedded Runtime が built-in / delete不可として表示される。 - embedded Runtime が built-in / delete不可として表示される。
- remote Runtime connection を追加でき、`.yoi/workspace-backend.local.toml` に保存される。 - remote Runtime connection を追加でき、`.yoi/workspace-backend.local.toml` に保存される。
- remote Runtime connection を削除でき、config から消える。 - remote Runtime connection を削除でき、config から消える。
- remote Runtime connection の test ができる、または v0 未対応条件では typed diagnostic が返る。 - remote Runtime connection の test negotiation ができ、compatibility / capabilities / diagnostics が sanitized response として返る。
- config 更新 response が `restart_required = true` を返す。 - config 更新 response が `restart_required = true` を返す。
- negotiation result / observed capabilities / health result を `.yoi/workspace-backend.local.toml` に保存しない。
- raw token 値を UI/API/config に保存・表示しない。 - raw token 値を UI/API/config に保存・表示しない。
- Runtime endpoint credential / socket path / session path / Runtime store path が Browser-facing API に漏れない。 - Runtime endpoint credential / socket path / session path / Runtime store path が Browser-facing API に漏れない。
- duplicate id / invalid endpoint / embedded delete attempt が typed diagnostic になる。 - duplicate id / invalid endpoint / incompatible runtime / embedded delete attempt が typed diagnostic になる。
- Focused tests が API list/add/delete/test、config persistence、sanitization、restart_required、UI render/submit path を確認する。 - Focused tests が API list/add/delete/test negotiation、config persistence、sanitization、restart_required、UI render/submit path を確認する。
- `cd web/workspace && deno task test` が通る。 - `cd web/workspace && deno task test` が通る。
- `cd web/workspace && deno task check` が通る。 - `cd web/workspace && deno task check` が通る。
- `cargo test -p yoi-workspace-server` が通る。 - `cargo test -p yoi-workspace-server` が通る。

View File

@ -35,4 +35,21 @@ Decision:
- Runtime connection 管理 Ticket 内で Settings shell 設計を同時に進めない。 - Runtime connection 管理 Ticket 内で Settings shell 設計を同時に進めない。
---
<!-- event: decision author: hare at: 2026-07-02T14:55:21Z -->
## Decision
Runtime connection management に negotiation / compatibility check を含める方針へ更新した。
Decision:
- 現状は明示的な negotiation / handshake は無く、`GET /v1/runtime` が事実上の疎通確認になっているだけ。
- Runtime connection `test` は単なる ping ではなく lightweight negotiation / compatibility check として扱う。
- v0 check は `GET /v1/runtime` の parse、observed runtime id/display/status/capabilities、worker list/detail、event websocket construction、spawn/input/config-bundle support などを確認する。
- 現行 API に protocol version が無い場合は fake version を作らず、`v1 runtime endpoint responded` のような compatibility basis として表現する。
- negotiation result / observed capabilities / health result / checked_at / diagnostics は persisted config に保存しない。必要になった場合は Backend DB の observation/cache として扱う。
- persisted config、RuntimeRegistry live state、negotiation result を混同しない。
--- ---