From 0c6d6031286c2a28f25ee1573ad0e69d08fa7c3b Mon Sep 17 00:00:00 2001 From: Hare Date: Fri, 26 Jun 2026 13:22:34 +0900 Subject: [PATCH] ticket: accept websocket observation proxy --- .../artifacts/orchestration-plan.jsonl | 1 + .yoi/tickets/00001KVZKSTJT/item.md | 4 +- .yoi/tickets/00001KVZKSTJT/thread.md | 81 +++++++++++++++++++ 3 files changed, 84 insertions(+), 2 deletions(-) diff --git a/.yoi/tickets/00001KVZKSTJT/artifacts/orchestration-plan.jsonl b/.yoi/tickets/00001KVZKSTJT/artifacts/orchestration-plan.jsonl index 2ab3b48b..c4cd5539 100644 --- a/.yoi/tickets/00001KVZKSTJT/artifacts/orchestration-plan.jsonl +++ b/.yoi/tickets/00001KVZKSTJT/artifacts/orchestration-plan.jsonl @@ -1 +1,2 @@ {"id":"orch-plan-20260625-203613-1","ticket_id":"00001KVZKSTJT","kind":"blocked_by","related_ticket":"00001KVZKSTE2","note":"Queue routing checked. WebSocket observation proxy depends on REST command server `00001KVZKSTE2`, which has just been accepted and is now inprogress. Leave this Ticket queued until REST command API/process wrapper is reviewed/merged/done, so WS/proxy semantics build on stable command surface.","author":"yoi-orchestrator","at":"2026-06-25T20:36:13Z"} +{"id":"orch-plan-20260626-042150-2","ticket_id":"00001KVZKSTJT","kind":"accepted_plan","note":"Dependency REST command server `00001KVZKSTE2` は done。ユーザー指摘後に transport decision Ticket として再queuedされたため、WS/proxy semantics を本 Ticket で固定する。","accepted_plan":{"summary":"REST command server done 後の WebSocket observation proxy slice。Runtime process 側の worker-scoped observation stream と Backend proxy/client-facing stream boundary を実装する。REST command semantics や Web Console/TUI migration は扱わない。","branch":"work/00001KVZKSTJT-websocket-observation-proxy","worktree":"/home/hare/Projects/yoi/.worktree/00001KVZKSTJT-websocket-observation-proxy","role_plan":"Orchestrator が dedicated child worktree を作成し、coder Worker に `crates/worker-runtime` / `crates/workspace-server` と必要な Cargo/package files の write scope を委譲する。reviewer Worker は read-only で Runtime→Backend→Client proxy boundary、cursor/backlog semantics、Browser direct Runtime access exclusion、feature gating、REST/WS scope separation を確認する。merge/validation/done/cleanup は Orchestrator が行う。"},"author":"yoi-orchestrator","at":"2026-06-26T04:21:50Z"} diff --git a/.yoi/tickets/00001KVZKSTJT/item.md b/.yoi/tickets/00001KVZKSTJT/item.md index ee0b28d8..29eadd32 100644 --- a/.yoi/tickets/00001KVZKSTJT/item.md +++ b/.yoi/tickets/00001KVZKSTJT/item.md @@ -1,8 +1,8 @@ --- title: 'Runtime/Backend WebSocket observation proxyを実装する' -state: 'queued' +state: 'inprogress' created_at: '2026-06-25T14:44:02Z' -updated_at: '2026-06-25T20:36:24Z' +updated_at: '2026-06-26T04:22:27Z' assignee: null queued_by: 'workspace-panel' queued_at: '2026-06-25T20:34:20Z' diff --git a/.yoi/tickets/00001KVZKSTJT/thread.md b/.yoi/tickets/00001KVZKSTJT/thread.md index 915d2e30..7abb1510 100644 --- a/.yoi/tickets/00001KVZKSTJT/thread.md +++ b/.yoi/tickets/00001KVZKSTJT/thread.md @@ -173,3 +173,84 @@ Next action: - `00001KVZKSTE2` が review/merge/validation/done になった後に再 routing する。 --- + + + +## Decision + +Routing decision: implementation_ready + +Reason: +- `00001KVZKSTE2` REST command server は done。前回 blocker(REST process wrapper/API surface 未確定)は解消済み。 +- 本 Ticket はユーザー指摘後に `Runtime/Backend WebSocket observation proxy` として設計判断を反映し再queuedされた。Ticket thread には、Runtime WS は `protocol::Event` を observation payload として流し、Browser/future TUI は Runtime へ直接接続せず Backend-owned projection/proxy を見る、という binding decision が記録済み。 +- queued/inprogress 再確認時点で inprogress は 0 件。後続 remote/TUI/Web Console Tickets は本 Ticket に依存しているため、本 Ticket を次に受理する。 + +Evidence checked: +- Ticket body: `Runtime -> Backend -> Client` WebSocket observation proxy、Runtime worker-scoped WS、Backend Runtime WS client、Client-facing WS、cursor/backlog/permission seam、Non-goals。 +- Thread decisions: `protocol::Event` を payload authority とする、Runtime WS は command/mutation tunnel にしない、Backend projection/proxy seam を作る、full auth/redaction policy は後続。 +- Relations: outgoing dependencies `00001KVZBCQH4` core と `00001KVZKSTE2` REST server は done。incoming remote/Web Console/TUI Tickets は後続。 +- Orchestration plan: accepted plan `orch-plan-20260626-042150-2` を記録。 +- Workspace state: orchestration worktree clean; no inprogress Ticket. + +IntentPacket: + +Intent: +- Runtime process の worker-scoped WebSocket observation stream と、Backend-owned client-facing WebSocket proxy boundary を実装する。 + +Binding decisions / invariants: +- Runtime WS は Backend-facing internal observation API。Browser/future TUI は Runtime WS に直接接続しない。 +- Payload authority は `crates/protocol` の `protocol::Event`。Runtime WS 独自の parallel output model や variant allowlist/subset を作らない。 +- Runtime WS は command/mutation/user input を受け付けず、`protocol::Method` tunnel を作らない。 +- Backend client-facing WS は Backend-owned opaque cursor/envelope/diagnostic を持ち、Runtime endpoint/credential/socket/session path を Client に露出しない。 +- v0 は worker-scoped stream。runtime-wide stream、full auth/permission/redaction policy、Web Console UI、TUI migration、remote process lifecycle/discovery は Non-goals。 +- REST command semantics は既存 `http-server` implementation に委譲し、この Ticket で再実装しない。 + +Requirements / acceptance criteria: +- `worker-runtime` に optional `ws-server` feature がある。 +- Feature disabled でも core compile が通る。 +- Runtime process exposes `GET /v1/workers/{worker_id}/events/ws?cursor=...` style worker-scoped observation endpoint。 +- Runtime WS envelope includes Runtime-local opaque cursor/event id, worker id, and `protocol::Event` payload。 +- Connect sends initial `protocol::Event::Snapshot` projection, then forwards Worker event bus `protocol::Event` payloads。 +- Backend Runtime WS client consumes Runtime envelope and preserves `runtime_id + worker_id + runtime_cursor + protocol::Event` internally。 +- Backend exposes Client-facing worker observation WS keyed by `runtime_id + worker_id` with Backend-local opaque cursor/envelope。 +- Unknown/expired cursor, worker not found, runtime unavailable, upstream disconnect, malformed frame are typed diagnostics/errors。 +- Tests cover Runtime WS, Backend upstream client/proxy delivery, cursor resume/duplicate-safe IDs, diagnostics, and worker-scoped filtering. + +Implementation latitude: +- Exact Rust module split, WebSocket dependency, envelope structs, test fixtures, and Backend route shape may follow existing workspace-server/worker-runtime style。 +- Bounded backlog implementation can be in-memory v0, as long as cursor semantics and diagnostics are explicit. +- Permission seam can be pass-through default with types/hooks for later policy. + +Escalate if: +- Implementing this requires full auth/redaction policy, Web Console UI, TUI migration, remote process lifecycle/discovery, or Runtime command channel changes。 +- `protocol::Event` cannot be serialized/forwarded without changing protocol crate public semantics。 +- Backend Registry/Runtime handle shape from previous Tickets is insufficient and would require a broad redesign. + +Validation: +- `cargo fmt --all` +- `cargo test -p worker-runtime --features ws-server` +- `cargo test -p yoi-workspace-server` +- `cargo check -p yoi` +- `git diff --check` +- 可能なら `nix build .#yoi --no-link` + +Critical risks / reviewer focus: +- Accidentally creating a command/mutation tunnel over WS。 +- Leaking Runtime endpoint/token/socket/session path to Client-facing WS。 +- Creating a second output/event model instead of forwarding `protocol::Event` payload。 +- Feature gating/dependency leakage。 +- Cursor/backlog/diagnostic semantics being too vague for remote/TUI/Web Console follow-ups。 + +--- + + + +## State changed + +Routing decision: implementation_ready。 + +Dependency `00001KVZKSTE2` REST command server は done。Ticket body/thread、relations、workspace state、accepted plan を確認し、Runtime/Backend WebSocket observation proxy は unblocked と判断した。accepted plan と IntentPacket は thread / orchestration plan に記録済み。 + +これ以降、worktree creation / coder Worker routing などの implementation side effect に進める。 + +---