30 KiB
作成
LocalTicketBackend によって作成されました。
Intake summary
Marked ready by yoi ticket state.
State changed
Marked ready by yoi ticket state.
State changed
Ticket を workspace-panel が queued にしました。
Decision
Routing decision: blocked_by_dependency_or_missing_authority
Reason:
- Dashboard Queue 後に Ticket / relations / orchestration plan / workspace state を確認した。
- 本 Ticket は
00001KW55B32Y(worker-runtimeにWorker実行Backend境界を追加する) にdepends_onrelation を持つ。 00001KW55B32Yは本 routing pass で accepted されinprogressになった。- Adapter は execution backend boundary に接続する必要があるため、boundary の shape が review/merge/done になる前に開始しない。
Evidence checked:
- Ticket body: adapter placement/dependency boundary、Profile/config/authority resolution、input/run lifecycle、protocol event bridge、Non-goals。
- Relations: outgoing
depends_on -> 00001KW55B32Y; incoming dependent00001KW55B33H。 - Orchestration plan: blocker record
orch-plan-20260627-190816-1を追加。 - Workspace state:
00001KW55B32Yis inprogress; current worktree clean before implementation side effects.
Next action:
- 本 Ticket は queued のまま待機。
00001KW55B32Yが reviewer approve / merge / validation / done になった後に再 routing する。
Decision
Routing decision:
Queue continuation was explicitly requested. The upstream boundary Ticket 00001KW55B32Y is closed after merge and validation, so this Ticket is now unblocked and accepted for implementation.
Plan:
- Create child implementation worktree:
/home/hare/Projects/yoi/.worktree/00001KW55B33B-worker-runtime-worker-adapter
- Branch:
work/00001KW55B33B-worker-runtime-worker-adapter
- Route implementation to a sibling Coder Worker with focused write scope.
- Route read-only review to a sibling Reviewer Worker after implementation.
- Orchestrator retains merge, final validation, Ticket completion, child worktree/branch cleanup, and role Pod shutdown.
Review/implementation focus:
- choose adapter placement without introducing crate dependency cycles, and record the rationale
- connect embedded
worker-runtimeexecution backend to existingworkercrate execution - preserve Profile/config bundle and authority resolution boundaries
- dispatch input to real Worker run lifecycle, not providerless/fake responses
- bridge
protocol::Eventto Runtime observation bus / Backend WS - return typed diagnostics/rejections for missing config/provider/busy/unsupported operations
- do not expose raw handles, sockets, credentials, session paths, or manifest paths to Browser-facing APIs
- leave
00001KW55B33Hqueued until this adapter is merged/validated
Operational note:
StopPodmust be called serially during cleanup; do not use parallel StopPod calls.
State changed
Queue continuation requested by user. Upstream dependency 00001KW55B32Y is closed with merge and validation complete, and this Ticket has no remaining blockers. Accepting implementation before child worktree / role Pod side effects.
Implementation report
Implementation kickoff:
- Worktree created:
/home/hare/Projects/yoi/.worktree/00001KW55B33B-worker-runtime-worker-adapter - Branch:
work/00001KW55B33B-worker-runtime-worker-adapter - Coder Worker spawned:
yoi-coder-00001KW55B33B-worker-adapter
Scope notes:
- Coder write scope is limited to
crates/worker-runtime/**,crates/worker/**,crates/workspace-server/**, rootCargo.toml,Cargo.lock, andpackage.nixif dependency/package changes are needed. - Coder is instructed not to modify Ticket records and not to operate in root/orchestration worktrees.
Implementation focus:
- adapter placement without crate dependency cycles, with rationale reported back
- connect
worker-runtimeexecution backend boundary to existingworkercrate run lifecycle - bridge existing
protocol::Eventto Runtime observation bus / Backend WS - preserve typed diagnostics for missing config/provider/secret and busy/unsupported operations
- avoid fake/providerless responses and Browser-facing raw handle/path/credential/session leaks
- leave downstream Workspace Companion real execution Ticket
00001KW55B33Hqueued until this adapter is merged/validated
Implementation report
Implementation report:
実装完了。マージ / close / cleanup は未実施。
Commit:
18526ee36264610048f48b07b5db50ce86852fd2 feat: connect runtime worker execution adapter
Adapter 配置方針:
workercrate 側にruntime-adapterfeature 付きで配置。- 理由:
worker-runtimeは Runtime 境界 / 投影 / Backend trait を持つ下位境界として保ち、実 Worker 実装への依存を持たせない。workercrate は既存のWorkerController/WorkerHandle/Method::Runlifecycle を直接扱えるため、fake/canned 応答を挟まずに adapter を組める。workspace-serverがworker = { features = ["runtime-adapter"] }を有効化して embedded Runtime に接続する形にし、crate dependency cycle を避けた。
変更概要:
worker crate
crates/worker/src/runtime_adapter.rsを追加。WorkerRuntimeExecutionBackendを追加し、worker_runtime::execution::WorkerExecutionBackendを実装。- Runtime worker 作成時に
WorkerControllerを spawn し、内部にのみ realWorkerHandleを保持。 - Runtime input は
Method::Run { input: vec![Segment::text(...)] }へ変換して既存 Worker run lifecycle に投入。 - Worker の
protocol::Eventbroadcast を購読し、WorkerExecutionContext::publish_protocol_event経由で Runtime observation bus へ橋渡し。 - Provider/profile/config 不足などは spawn/create 時の typed error/rejection として返し、fake assistant text は生成しない。
- v0 double-run policy として queue は持たず、adapter 側 atomic busy flag + Worker status で二重 input を typed busy rejection。
- stop/cancel は既存
Method::Shutdown/Method::Cancelへ接続。 - Focused test を追加し、fake deterministic LLM client で Runtime input -> real Worker run lifecycle -> assistant output ->
protocol::Event-> Runtime transcript projection の流れを検証。
worker-runtime
observe_worker_eventで受けた realprotocol::Eventから transcript projection を更新。TextDone-> Assistant transcriptError-> System transcriptToolResult-> System transcript
- observation bus には既存
protocol::Eventをそのまま保持し、subset output model は追加していない。
workspace-server
- embedded Runtime 作成時に
WorkerRuntimeExecutionBackendを接続。 EmbeddedWorkerRuntime::new_memory_with_execution_backendを追加。- Browser/API-facing projection に raw
worker::Workerhandle / raw execution handle / socket path / session path / credential / secret ref / manifest path は出していない。
package/dependency
workerに optionalworker-runtimedependency +runtime-adapterfeature を追加。workspace-serverがworkerのruntime-adapterfeature を有効化。Cargo.lockとpackage.nixのcargoHashを更新。
Validation:
cargo fmt --all: successcargo fmt --all --check: successcargo test -p worker --features runtime-adapter runtime_adapter: successcargo test -p worker-runtime --features ws-server: successcargo test -p worker-runtime --features "ws-server fs-store": successcargo test -p yoi-workspace-server: successcargo check -p yoi: successgit diff --check: successnix build .#yoi --no-link: success
Residual risks / review focus:
- Runtime worker profile 解決は production adapter が通常の Worker profile 解決を使う。workspace-server 起動直後に fake 応答へ fallback せず、profile/provider/config 不足は typed error になる。この挙動が downstream
00001KW55B33Hの Companion UX 設計と合っているか確認が必要。 - Transcript projection は現時点で
TextDone/Error/ToolResultを投影。より細かい tool-call lifecycle や thinking block の Browser projection が必要なら downstream で拡張対象。 - Adapter は v0 non-queue policy。二重 input は busy rejection で、background queue/scheduler は実装していない。
workspace-serverがworkerを feature 付きで依存するため、crate layering と public API leak が意図通りかを重点 review してほしい。
Implementation report
Review kickoff:
Reviewer Worker spawned for 00001KW55B33B implementation.
- Reviewer Worker:
yoi-reviewer-00001KW55B33B-worker-adapter - Review target commit:
18526ee36264610048f48b07b5db50ce86852fd2 feat: connect runtime worker execution adapter - Review mode: read-only implementation worktree review
Review focus:
- crate layering /
runtime-adapterfeature dependency cycle risk - production Profile/config/authority resolution and typed failure mode
- protocol event bridge into Runtime observation bus / Backend WS
- transcript projection consistency for real Worker run output
- no fake/providerless fallback
- busy / stop / cancel lifecycle semantics
- Browser-facing non-leak of worker handles, raw execution handles, sockets, session paths, credentials, secret refs, and raw manifest paths
- no downstream Workspace Companion bootstrap/UX scope creep
Review: request changes
request_changes
読取専用で差分・主要実装を確認した。crate layering 自体は概ね意図通りで、worker crate 側の runtime-adapter feature に adapter を置き、worker-runtime が worker に依存しない形は保たれている。また fake/providerless の canned response は見当たらない。
ただし、Ticket 受け入れ条件に対して以下が blocker。
Blockers
-
workspace-server の embedded Worker input API がまだ adapter に接続されていない
workspace-server/src/server.rs:101-113で adapter は embedded Runtime に install されている。- しかし browser/backend registry 側の
EmbeddedWorkerRuntime::send_inputはhosts.rs:1275-1285で固定 reject のまま。 - projection も
hosts.rs:1008-1010でcan_accept_input: false,can_stop: falseのまま。 - そのため Ticket 要件の「Backend Worker input API からの user input を
Method::Run相当に渡す」「Runtime / Backend / Web Console が正規経路を共有する」「embedded Worker への user input が実 Worker run に渡る」を満たしていない。
-
production profile resolution に builtin 二重 prefix の不整合がある
- workspace-server の Ticket role mapping は
hosts.rs:1920-1924でProfileSelector::Builtin("builtin:coder")のように値へbuiltin:を含めている。 - adapter 側は
worker/src/runtime_adapter.rs:133-140でBuiltin(name)を常にformat!("builtin:{name}")しているため、内部的にbuiltin:builtin:coderになる。 manifest::ProfileSelector::parse_cliはbuiltin:builtin:coderを source=builtin, name=builtin:coderと解釈するため、通常の builtincoder解決に失敗する。Ticket role Worker の実 spawn path で破綻する可能性が高く、Profile/config resolution の受け入れ条件を満たさない。
- workspace-server の Ticket role mapping は
-
run_state/status projection が実 run lifecycle と整合していない
send_methodは input のMethod::Run送信成功時もWorkerExecutionRunState::Idleを返している(worker/src/runtime_adapter.rs:300-313,445-455)。- Runtime 側はその
Idleを input accepted 後の execution status として保存する(worker-runtime/src/runtime.rs:369-373)。 - bridge は
protocol::Eventを observation bus に流しているが、Worker の running/completed/errored/cancelled status を Runtime execution status に反映していない。 - Ticket 要件の「run started / completed / errored / cancelled を Runtime Worker status と transcript projection に反映」「busy/double-run lifecycle semantics」の観点で不足。
確認済み
worker-runtime->workerの依存逆流は見当たらず、adapter placement の方向性は良い。protocol::Eventbridge はpublish_protocol_eventを使って observation bus に流す実装になっている。can_stream_events/can_read_bounded_transcriptの public flag 復活は見当たらない。- downstream
00001KW55B33Hの Companion UX 完成まで踏み込む scope creep は見当たらない。 - Ticket 更新・merge・cleanup・ファイル変更・テスト実行はしていない。Static review のみ。
Implementation report
Change-response implementation report:
Reviewer blockers を修正済み。マージ / close / cleanup は未実施。
Fix commit:
9069b035e0a93f83c702e206d3d15b2b683a8c19 fix: connect embedded runtime input lifecycle
既存実装 commit:
18526ee36264610048f48b07b5db50ce86852fd2 feat: connect runtime worker execution adapter
修正内容
1. workspace-server embedded Worker input API を adapter に接続
EmbeddedWorkerRuntime::send_input の固定 reject を撤去し、execution backend 接続済みの場合は worker_runtime::Runtime::send_input に委譲するようにした。
あわせて:
EmbeddedWorkerRuntimeにexecution_enabledを追加。new_memory_with_execution_backend(...)で backend 接続済み runtime として扱う。- Worker projection の capability を backend 接続状態に合わせて更新:
can_accept_inputcan_stop
stop_worker/cancel_workerも embedded Runtime lifecycle API に委譲。workspace-server側の focused test を追加し、fake execution backend で embedded Runtime spawn / workspace-server host API 経由 input / backend dispatch /protocol::Event/ transcript projection / capability/status projection を検証。
2. builtin profile selector double-prefix bug 修正
worker/src/runtime_adapter.rs の ProfileSelector::Builtin 変換を修正。
Builtin("coder")->builtin:coderBuiltin("builtin:coder")->builtin:coder
builtin:builtin:coder にならないことを focused unit test で追加確認。
3. run_state / status projection を real run lifecycle に合わせて修正
send_method が常に Idle を返していた点を修正。
Method::Runaccepted ->WorkerExecutionRunState::BusyMethod::Shutdownaccepted ->StoppedMethod::Cancelaccepted ->Idle
さらに worker-runtime 側で bridged protocol::Event を execution status に投影するようにした。
対応イベント:
Status { Running }->BusyStatus { Idle }->IdleStatus { Paused }->BusySnapshot { status }-> status に応じてBusy/IdleRunEnd { Finished | RolledBack }->IdleRunEnd { Paused }->BusyRunEnd { LimitReached }->ErroredError->Errored
これにより Backend/Web projection の status は execution run_state を反映する。
Validation
実行済み・成功:
cargo fmt --allcargo fmt --all --checkcargo test -p worker --features runtime-adapter runtime_adaptercargo test -p worker-runtime --features ws-servercargo test -p worker-runtime --features "ws-server fs-store"cargo test -p yoi-workspace-servercargo check -p yoigit diff --checknix build .#yoi --no-link
補足:
cargo test -p yoi-workspace-serverでは既存 warning:field next_sequence is never read- 新規失敗や未解決の validation failure はない。
残リスク / review focus
workspace-serverの embedded Worker capability は backend 接続時にcan_accept_input/can_stopが true になる。実 provider/profile 不足時は fake 応答ではなく typed rejection/error になるため、下流 Companion UX 側でその表示/導線を確認する必要がある。- Runtime execution status projection は主要 lifecycle event に対応したが、より細かい paused/cancelled 表示語彙を Browser projection で増やす場合は別 Ticket 範囲。
- v0 policy は引き続き queue なし。Busy 中 input は typed busy rejection。
Review: request changes
request_changes
静的レビューのみ実施。対象 worktree の HEAD は 9069b035041d17e7c52a454a7563cc5f0b7e1f61 として確認。先回報告の full SHA suffix には差異があるため、以後この full SHA を正とする。
先回の blocker のうち、input delegate / builtin prefix normalization / protocol event -> execution status projection は概ね修正されている。
ただし、元の invariant に対してまだ blocker がある。
Blocker
spawn 時の provider/profile/config/setup 失敗が Browser-facing spawn API では Accepted 扱いになり、typed rejection/diagnostic になっていない。
根拠:
- 実 Worker 作成時の profile/provider/session setup 失敗は adapter で
WorkerExecutionSpawnResult::Erroredになる。worker/src/runtime_adapter.rs:161-194worker/src/runtime_adapter.rs:365-371
- しかし
worker-runtime::Runtime::create_workerは spawnRejected/ErroredをErrにせず、Ok(WorkerDetail)に execution status として記録するだけ。worker-runtime/src/runtime.rs:278-280worker-runtime/src/runtime.rs:417-446
- workspace-server 側は
create_workerがOk(detail)なら常にWorkerOperationState::Acceptedとして返し、execution failure の diagnostic/rejection を browser-facing result に出していない。workspace-server/src/hosts.rs:1204-1222
- さらに projection の
can_accept_inputはrun_state != Busyだけを見るため、spawnErrored/Rejectedでも status がRunningのままなら input 可能に見える。workspace-server/src/hosts.rs:962-970
このため、missing provider/config/secret/setup が「typed diagnostic/rejection」ではなく「spawn accepted だが内部 execution errored」という中途半端な projection になり、Ticket の受け入れ条件を満たしていない。
spawn execution failure は、少なくとも browser-facing API で sanitized diagnostic/rejection として扱うか、capability を false にして明確な failure projection を返す必要がある。
Implementation report
Change-response implementation report:
Reviewer blocker を修正済み。Ticket ファイル変更、merge、close、cleanup は未実施。
Current HEAD:
7e29ff5ec99dcc748fa5a511cda5bae31fec124b fix: reject embedded spawn execution failures
Prior fix commit:
9069b035041d17e7c52a454a7563cc5f0b7e1f61 fix: connect embedded runtime input lifecycle
修正内容
Spawn-time execution failure を Browser-facing API で Rejected として返す
worker-runtime::Runtime::create_worker は spawn backend の Rejected/Errored を Ok(WorkerDetail) 内の execution status として保持する設計のままなので、workspace-server 側で detail.execution.last_result を検査するようにした。
対象:
crates/workspace-server/src/hosts.rs
変更:
- embedded Runtime spawn 後に execution spawn failure を検出。
WorkerExecutionOutcome::{Rejected, Errored, Unsupported, Busy}の場合:- Browser-facing
WorkerSpawnResult.state = Rejected acceptance_evidence = []- sanitized diagnostic を返す
- worker projection は残すが、capability は失敗状態として false にする
- Browser-facing
sanitized diagnostic 例:
- code:
embedded_worker_execution_spawn_errored - message:
Embedded Worker execution spawn was errored during setup; check runtime configuration
Failed execution state で capability が true にならないよう修正
can_accept_input / can_stop 判定を run_state != Busy からより厳密に変更。
can_accept_input は以下すべてを満たす場合のみ true:
- execution backend が接続済み
- worker status が
Running - execution backend kind が
Connected - run_state が
Idle - last_result が
Rejected/Errored/Unsupportedではない
can_stop も spawn rejected/errored/unconnected 系では false。
Focused tests
workspace-server に spawn execution failure の focused test を追加。
検証内容:
- fake failing execution backend が spawn
Erroredを返す - Browser-facing spawn result が
Rejected - diagnostic が sanitized され、fake 内部 path を漏らさない
- projected worker status が
errored can_accept_input == falsecan_stop == false
既存 server API projection test も、real backend setup failure が Browser-facing projection で sanitized rejection として出る前提に調整。
Validation
実行済み・成功:
cargo fmt --allcargo fmt --all --checkcargo test -p worker --features runtime-adapter runtime_adaptercargo test -p worker-runtime --features ws-servercargo test -p worker-runtime --features "ws-server fs-store"cargo test -p yoi-workspace-servercargo check -p yoigit diff --checknix build .#yoi --no-link
補足:
cargo test -p yoi-workspace-serverでは既存 warning:field next_sequence is never readnix buildは dirty tree warning を出したが build 自体は成功。
残リスク / review focus
worker-runtime::Runtime::create_worker自体は引き続き spawn execution failure をOk(WorkerDetail)に記録する設計。今回の修正は Browser-facingworkspace-serverprojection で typed rejection/diagnostic として露出する対応。- diagnostic は sanitized のため、具体的な provider/config/secret path 等は Browser-facing API には出さない。詳細原因の調査導線が必要なら、別途 backend/admin 向け diagnostics 設計が必要。
- Companion status は環境の profile/provider setup 可否により
ready/errorのどちらも取り得るため、既存テストはその環境差を許容する形に調整。
Review: approve
approve
読取専用で再レビューした。前回 blocker は解消されている。
確認した点:
workspace-serverの embedded spawn 後にdetail.execution.last_resultを検査し、Rejected / Errored / Unsupported / Busyを browser-facingWorkerSpawnResult.state = Rejectedとして返すようになっている。- spawn execution failure の diagnostic は sanitized な固定文言・code で返され、内部 path / handle / credential / secret ref の露出は見当たらない。
can_accept_inputは backend 接続・WorkerRunning・backend kindConnected・run_state == Idle・last_result failure でないことを要求しており、spawn failure 後の入力可能 projection は塞がれている。can_stopも rejected / errored / unconnected failure state では false になる。- 先回指摘の embedded input API delegate、builtin profile double-prefix、protocol event -> runtime execution status projection も修正済み。
- crate layering は
worker側 feature adapter ->worker-runtimeboundary の向きで、worker-runtimeがworkerに依存する逆流は見当たらない。 - fake/providerless fallback、public capability flag 復活、下流 Ticket
00001KW55B33Hscope creep は見当たらない。
検証は指示通り read-only の静的確認のみで、テスト実行やファイル変更はしていない。
Implementation report
Merge / validation report:
Implementation branch was integrated into the orchestration branch after reviewer approval.
Integrated commits:
18526ee36264610048f48b07b5db50ce86852fd2 feat: connect runtime worker execution adapter9069b035041d17e7c52a454a7563cc5f0b7e1f61 fix: connect embedded runtime input lifecycle7e29ff5ec99dcc748fa5a511cda5bae31fec124b fix: reject embedded spawn execution failures
Merge commit:
c3ed223d merge: worker runtime worker adapter
Validation in orchestration worktree:
cargo fmt --all --check: successcargo test -p worker --features runtime-adapter runtime_adapter: successcargo test -p worker-runtime --features ws-server: successcargo test -p worker-runtime --features "ws-server fs-store": successcargo test -p yoi-workspace-server: successcargo check -p yoi: successgit diff --check: successnix build .#yoi --no-link: success
Known non-blocking warning:
cargo test -p yoi-workspace-serverreports existing warningfield next_sequence is never readincrates/workspace-server/src/companion.rs.
Outcome:
- Embedded Runtime now installs a
workercrate execution adapter viaworker/runtime-adapterfeature without makingworker-runtimedepend onworker. - Backend input path delegates to the Runtime execution backend and reaches real Worker run lifecycle.
protocol::Eventoutput bridges to Runtime observation / transcript projection.- Browser-facing spawn failure is reported as sanitized rejected diagnostic, not accepted fake output.
- Failed/unconnected execution states are not projected as input-capable.
- No public
can_stream_events/can_read_bounded_transcriptcapability flags were revived.
State changed
Reviewer approval後に implementation branch を orchestration branch へ merge し、要求された validation が成功したため done に遷移する。
Validation:
cargo fmt --all --check: successcargo test -p worker --features runtime-adapter runtime_adapter: successcargo test -p worker-runtime --features ws-server: successcargo test -p worker-runtime --features "ws-server fs-store": successcargo test -p yoi-workspace-server: successcargo check -p yoi: successgit diff --check: successnix build .#yoi --no-link: success
State changed
Ticket を closed にしました。
完了
embedded worker-runtime を既存 worker crate の実行 lifecycle に接続する adapter を実装し、reviewer approval 後に orchestration branch へ merge した。
実装内容:
workercrate にruntime-adapterfeature とWorkerRuntimeExecutionBackendadapter を追加。worker-runtimeはworkerに依存しない下位境界のまま維持し、crate dependency cycle を回避。- embedded Runtime 作成時に
workspace-serverが adapter を install。 - Backend Worker input API から embedded Runtime execution backend に委譲し、既存 Worker run lifecycle (
Method::Run) に接続。 - Worker の
protocol::Eventを Runtime observation bus / transcript projection に bridge。 - builtin profile selector double-prefix を修正。
- run_state/status projection を実 Worker lifecycle event に合わせて更新。
- spawn execution failure は Browser-facing API で sanitized
Rejecteddiagnostic として扱い、failed/unconnected 状態を input-capable に見せない。 - fake/providerless/canned assistant response は導入していない。
- Browser-facing API に raw worker handle / execution handle / socket / session path / credential / secret ref / raw manifest path を出していない。
can_stream_events/can_read_bounded_transcriptpublic capability は復活させていない。
Integrated commits:
18526ee36264610048f48b07b5db50ce86852fd2 feat: connect runtime worker execution adapter9069b035041d17e7c52a454a7563cc5f0b7e1f61 fix: connect embedded runtime input lifecycle7e29ff5ec99dcc748fa5a511cda5bae31fec124b fix: reject embedded spawn execution failures- merge:
c3ed223d merge: worker runtime worker adapter
Validation:
cargo fmt --all --check: successcargo test -p worker --features runtime-adapter runtime_adapter: successcargo test -p worker-runtime --features ws-server: successcargo test -p worker-runtime --features "ws-server fs-store": successcargo test -p yoi-workspace-server: successcargo check -p yoi: successgit diff --check: successnix build .#yoi --no-link: success
Known non-blocking warning:
cargo test -p yoi-workspace-serverreports existing warningfield next_sequence is never readincrates/workspace-server/src/companion.rs.
Cleanup は child implementation worktree / branch と related role Pods のみを対象に実施する。