feat(rpc): a loopless session-worker runtime with no agent loop and no transcript (RT10)
Summary
Adds a session-worker runtime with only the agent loop removed: packages/coding-agent/src/modes/rpc/runtime-factory-loopless.ts.
createLooplessRuntimeFactory(configuration, local)(profile)builds, from the same launch configuration ascreateCliRuntimeFactory, the same cwd-bound services: settings, project trust decided without a UI (as an RPC worker does today), model registry, extensions and their flags.- It then builds the built-in and extension tools through
bootstrapRuntime()/buildToolRegistry()(#5222) on a runner without a session (#5223, made runnable for the built-in tools by #5433). - The
LooplessRuntimeit returns runs one tool call at a time (execute), lists its tools (definitions) and closes (dispose). - It binds no agent loop (an extension that tries to start a turn is refused), makes no provider request and writes no transcript.
Stacked on #5433 (base branch feat/rt10-pre-sessionless-tools); retarget to main once it merges. Part of #5413.
Inertness
Nothing in the product selects this runtime yet, so merging changes no behavior:
runtime-factory-loopless.tsis a new module with no production importer. Its first callers are the loopless worker kind (its own PR, stacked on this one) and the mode flag that boots a tool-execution-only process; that mode stays disabled until the gate that enables it.- No RPC worker, host, protocol, CLI flag or setting changes. The default
--mode rpcworker still builds its runtime throughcreateCliRuntimeFactory.
Deferred to S29
Deferred obligation: loopless/remote execution must run the extensions' tool_call/tool_result handlers, permission checks included, before any untrusted call reaches LooplessRuntime.execute() (hand-local handlers locally; a two-sided extension's handlers forwarded to the process that owns the session). Recorded on #5413. Until then execute() refuses every call unless the runtime was built with a grant from the closed allowlist in src/modes/rpc/loopless-execute-grant.ts (only the in-process test harness), fail-closed; test/hand/loopless-execute-guard.test.ts pins it.
Tests (run on a Linux host at the exact head)
test/hand/loopless-worker.test.ts: serves the built-in and the configured extension's tools; runs a built-in call (read) in the runtime's cwd; runsecho({value:42})through an extension tool; refuses an extension that tries to start a turn (no loop bound); refuses an unknown tool before anything runs.test/hand/no-transcript.test.ts: two tool calls see no session manager in their context, and no.jsonlfile exists under the agent dir or the cwd.- RED at the base branch (factory absent): both files fail.
- Owner suites green:
test/characterization/worker-cap.test.ts(X4),test/characterization/rpc-method-surface.test.ts,test/runtime/{bootstrap-registry,context-split,sessionless-builtin-tools}.test.ts.bun run checkgreen.
KILL
None: no durable write and no ToolHost state transition. The runtime reuses the existing tool dispatcher (tool-child kills stay with KILL-CHILD).
Dead code
None made dead.
Summary by cubic
Adds a loopless session-worker runtime that serves the same built-in and extension tools as a full session, but runs one tool call at a time with no agent loop, no model binding, and no transcript. Nothing selects this runtime yet, so product behavior is unchanged.
- Builds from the same launch configuration as the CLI runtime, sharing settings, UI-less project trust, model registry, and extension loading; applies the CLI's tool filters (
--tools,--no-tools,--exclude-tools) and reports extension-load warnings as diagnostics. - Schema-validates each call's arguments before the tool runs and returns invalid arguments or failing tools as an
isErrorresult; tools run on the runtime's own tool child so--tool-runtime childworks. - Refuses extension tools that try to start a turn or access a session manager, and unknown tool names are rejected before anything runs.
- Until the executor that will call this runtime runs the extensions'
tool_call/tool_resulthandlers (permission checks among them),executerefuses every call unless the runtime was built with a grant only the in-process test harness can obtain, failing closed. - New tests cover tool serving, filters, validation, the execute guard, loop refusal, and the absence of session files after tool calls.