You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The owner contract lists 13 operations. The product catalog still has native hostPlatform and no execHost. All 13 remain to be delivered at this face. Product catalog. Resource contract.
exec is a Session part and depends on HostPlatform (typed, handle-based: ProcessTree, PtyProcessTree, temporary directories). The resource leaf can implement the same capability locally and expose data operations.
Scope
Data service execHost: start → task id, wait, kill, output (cursor, limit); persistent shell: shell, write, resize, read; cancellation.
Implement in the resource leaf, reusing HostPlatform locally; execution settings and sandbox are read and enforced on the node.
Wire exec foreground first, then background handoff and PTY.
Output is bounded and stored on the node; the control side reads a tail and pages, never raw streams.
Background task ownership: the branch keeps the fact; the leaf keeps the process.
Acceptance
A foreground command, a failing command, a cancelled command and a background command run on a remote resource leaf.
Sandbox settings are read on the node; a sandboxed command on the leaf cannot write outside its workspace.
Leaf offline fails only the call; a reconnect does not reload the Session.
The model-visible result unchanged: bounded preview, exit status, output path.
Notes
Depends on the resource leaf contract. See the research doc §3.1–§3.2 for the operation split.
rutis already exposes a service's public &self methods by name (#[rutis::service] + ctx.provide); a HostDispatch is generated by the framework, not written by business code. Scope is orthogonal to exposure: a service is served in the scope it is provided, and a leaf mounts part copies in the host's instances (research/remote-plugins §4.2), so a Session/branch service crosses a leaf just as a process service does.
The single process-scope execHost face in resource-faces.md §1/§3 is withdrawn. The corrected split:
Service
Scope
Operations
hostPlatform
process
info, and its own data methods; spawn/spawn_pty/build_process_spec stay #[service(skip)]
No ownership move, no HostPlatform rename, no HostFacts, no hand-written HostDispatch or plugin.d.ts. Cancellation uses the existing cancelled: CancelledFn callback (as toolHost.execute does).
The replacement PR updates resource-faces.md, service-faces.md and contracts/resource-owner-operations.md, and exposes hostPlatform.info with xtask types declarations. #1899 is closed.
The corrected implementation is #2002: hostPlatform exposes its own data methods (info, execShell, sandboxBackend, execRoot); the task and shell operations stay on toolHost, backgroundExec and sessionMethods.shell. The design docs are updated in that PR.
The separate execHost face is withdrawn (#1899). The process owner keeps its type, file, scope and dependencies; the methods external plugins use become data operations. This follows the dependency review: 16 plugins inject HostPlatform, so their calls must be service methods; the process/PTY state moves into HostPlatform so handles never cross.
Public methods (#[rutis::service] on the existing impl HostPlatform)
These become the internal implementation of spawn / shell / configured / confined.
Caller migration
WorkspaceTools / BackgroundExec: spawn / wait / output / kill / settle; the branch keeps the task record.
ShellSession: shell / write / resize / output / kill; the PTY stays in HostPlatform.
Hooks: configured.
Modality (OCR): confined.
Permission, PromptSources, Skills, FileAccess: info() / existing data methods.
MCP: childPath, or stays local if the path helper is not needed across nodes.
Invariants
Type name HostPlatform, file host_platform.rs, plugin, scope and dependencies unchanged.
No separate face object, no hand-written HostDispatch, no hand-written plugin.d.ts; #[rutis::service] and #[service(skip)], with xtask types generating the declarations.
Process, PTY, output files and the task table are owned by HostPlatform; handles never cross.
Cancellation uses the existing cancelled: CancelledFn parameter; no cancel operation and no callId.
Open points
childPath: string vs OS path; non-UTF-8 semantics.
removeOutputDirectory: error code when the path is outside execRoot.
tail / retainOutput: keep only if the current callers need them.
Shell protocol: ShellSession's marker/occupancy loop needs the output-delivery design (poll output vs an internal stream) before the PTY move.
The structural step has landed on #2002 (cbe4b75172): the service block is the originalimpl HostPlatform; execShell, sandboxBackend, execRoot and info are served from it; spawn, spawn_with_stdin, with_execution_settings, with_toolchain_source and prepare_isolated_process are #[service(skip)]. No new file and no new service object.
Changed in place vs added
Existing method
Change
spawn(spec) -> ProcessTree
data spawn(request) -> {taskId, outputPath}; the handle method becomes internal spawn_tree
spawn_pty(spec, size) -> PtyProcessTree
data spawn_pty(request) -> {taskId, outputPath} (Stage 2)
spawn_with_stdin(spec, stdin)
data spawn_with_stdin(request) -> result (Stage 3)
spawn_confined(spec, confinement)
data spawn_confined(request) -> result (Stage 3)
remove_exec_directory(&Path)
remove_output_directory(PathBuf) (Stage 4)
Added method
Why it cannot be an existing one
wait / kill / output / settle
these operations are on the ProcessTree handle, not on HostPlatform; once spawn returns a task id, the owner needs them by id
write / resize
the same, for the PtyProcessTree handle (Stage 2)
info
home/os/arch/timezone/platformRoots are fields, not methods
No configured/confined names: Stages 3 changes spawn_with_stdin/spawn_confined in place. tail/retainOutput only if the callers need them.
Staging
Stage 1 (now).HostPlatform owns the command task table and output files. spawn returns a task id; wait/kill/output/settle work by id. WorkspaceTools/BackgroundExec migrate; info consumers use the service. No new file.
Stage 2. PTY ownership (spawn_pty -> task id, write/resize) and ShellSession; first decide the branch shell protocol's output delivery (poll output vs an owner-side stream).
Stage 3.spawn_with_stdin/spawn_confined request/reply shapes; Hooks and OCR.
Stage 4.remove_output_directory, childPath, and tail/retainOutput if needed.
Stage 1 scope
~8–10 files, ~+900/−400: host_platform.rs (task fields and methods), workspace_tools/exec.rs, workspace_tools/background.rs, workspace_tools/mod.rs, shell_input.rs (spawn_tree), app-server/src/lib.rs (commandFiles), tests. No new file.
Open
childPath should probably stay local to the App Server's MCP stdio child, not the remote node.
info() resolves the exec shell; callers that only need home/os can read the captured fields.
wait now answers WaitReply with a WaitStatus union, optional exitCode/signal/failureNote, duration, output path, byte count and bounded preview. xtask types generates WaitReply/WaitStatus; the TS signature is wait(request: WaitRequest): Promise<WaitReply> (commit 8b17b575d9 on Serve hostPlatform's data methods; withdraw the execHost face #2002).
Stage 1 command task operations are in: spawn returns a task id; wait/kill/settle/output/retainOutput/tail work by id; WorkspaceTools/BackgroundExec use the owner's task; info, execShell, persistentShell, sandboxBackend, execRoot are served from the original impl HostPlatform. No new file.
Next: Stage 2 (shell/PTY). Decision for this stage: the branch shell protocol stays in ShellSession and runs where the shell owner runs; start_shell hands it an in-process output stream, while the public shell/write/resize/output operations serve foreign callers by task id. A control-side ShellSession against a remote owner is not part of this stage.
Stage 1 (b6ed380f2c, 8b17b575d9): command task table and output file on HostPlatform; spawn returns a task id; wait/kill/settle/output/retainOutput/tail by id; typed WaitReply/WaitStatus; info, execShell, persistentShell, sandboxBackend, execRoot. WorkspaceTools/BackgroundExec migrated.
Stage 2 (aabb04d4ba): PTY and shell task on HostPlatform; shell/write/resize; output/wait/kill/settle serve shell tasks; ShellSession runs its marker protocol over the owner's task.
Stage 3 (07fd907d2e): spawnWithStdin and spawnConfined are the data methods Hooks and OCR call; the low-level cores are *_process and stay off the service; SystemServices is data.
Stage 4 (cab9102422): removeOutputDirectory and childPath are data methods; SessionFiles and MCP keep the in-process binding.
No new file: the shell module is inline in host_platform.rs; the service block is the original impl HostPlatform. The catalog and branch-services.d.ts are generated.
Verification: host_platform_flow 24, hooks_flow 69, local_execution 42; xtask check; clippy; runtime/plugin-sdk.test.mjs 2. One combined run of host_platform_flow reported an uncaptured failure, and an immediate rerun passed 24/24; watch CI for a repeat.
Remaining follow-ups (not blocking): the shell output path is the owner's capture; a control-side ShellSession against a remote owner is not part of Stage 2; childPath is a lossy string binding for non-UTF-8 paths.
2026-11-12, 0c74bdf45a ("docs: define resource leaf data faces (docs: define resource leaf data faces #1397)"): the execHost design says wait.timeoutMs "reaching it kills the tree". This is the design source; it also contradicted §3's rule that cancelling a read changes nothing.
2026-11-21, 285941f0c1 ("Keep command processes on the execution host and expose start, wait, kill and settle"): CommandTask::wait implements it by cancelling the command's timeout token.
Fixed in 2d1e643d39: wait timeout answers WaitStatus::Running and leaves the task alive; a command's own spawn.timeoutMs still terminates it; kill is explicit. Test a_wait_timeout_leaves_the_command_running.
This was not a requirement from the current work; it was inherited from the old design and never re-checked against the cancellation rule.
Decision: keep the data face and fix the design; do not revert the shell work.
Root cause of the 1 MiB reset: the owner owns the byte stream, but the marker/occupancy state machine is still in ShellSession. The bounded event queue is therefore being used as a lossless protocol stream; when it drops chunks, the parser resets and kills a healthy shell. ShellState and parse_shell_job are prefix/line scans, not the real parser. The fix is to move the marker/occupancy state and job registration to the owner, so output pages may be lossy while protocol state/events stay reliable.
Order:
P1 correctness first:
shell starts through start_shell without arc(); the minimal execution assembly must work.
removeOutputDirectory: reject ./.., canonicalize the target/deepest ancestor, compare with the canonical root, do not follow symlinks; SessionFiles defers to this authority.
spawnConfined maps ConfinedError::InvalidPath to HostPlatformError::InvalidPath { path, reason }; run the modality suite.
unify the sandbox_backend doc comment so xtask types is host-independent.
shell log: create_new + 0600; remove it when the shell task settles; no unbounded leak.
background jobs: resolve the node-local pid while the PTY is alive and store it in ShellJob; kill uses that pid; settle job records even when kill fails.
spawn maps task_exists/invalid ids to the typed errors; task_exists becomes reachable.
wait type docs and the running preview flag.
Root parser/state:
move complete marker parsing and occupancy/background state into the owner;
expose reliable protocol events/state; output pages become a bounded display cache;
ShellSession no longer parses raw chunks; a lagging reader resynchronizes from state and never kills the shell;
job registration uses an owner reservation, not an unconditional scanner insert.
Contract/docs/PathBuf cleanup and tests: minimal execution, burst >1 MiB, echo/fake markers, background job at shell exit, traversal/symlink, non-UTF-8.
Verification must include cargo test --workspace --locked (the minimal execution assembly) and the modality suite, not only local_execution.
shell calls start_shell directly; the minimal execution assembly works again (minimal_execution 22 passed).
Background shell jobs resolve the node pid while the PTY is alive and store it in ShellJob; kill uses it after the shell is gone; job records settle even when kill fails. stop_background_task and shell_exit_kills_background_jobs pass.
removeOutputDirectory rejects ./.., canonicalizes the target/deepest ancestor against the canonical root, refuses symlinks, and SessionFiles defers to it.
spawnConfined maps ConfinedError::InvalidPath to HostPlatformError::InvalidPath { path, reason }; the modality OCR test passes.
sandbox_backend has one doc comment; xtask types is host-independent.
Shell logs are create_new, 0600, and removed with the shell task.
spawn preflights the output directory and log path and maps task_exists/invalid requests.
wait docs say running; the running preview flag is computed.
Still open (root): move the marker/occupancy parser and job reservation into the owner; make output pages a display cache and protocol state/events lossless; remove the reset-kill path; then PathBuf, settlement/owner docs and the PR description.
P1 corrections are in 1e1f8c79. Targeted evidence:
minimal_execution 22 passed (including stop_background_task and shell_exit_kills_background_jobs);
local_execution 42 passed;
host_platform_flow 26 passed;
hooks_flow 69 passed;
the modality OCR helper test passed;
clippy and xtask check passed.
cargo test --workspace --locked in this Linux environment is not a pass: transport_flow reports 338 failures with initialization timed out: AgentIndex Missing even when a single case is run alone, so the App Server suite cannot initialize here. This is not evidence for or against the execution changes; it needs separate environment/CI triage and is not claimed as passing.
The root work is still open: owner-side marker/occupancy parsing, reliable protocol state/events, and removing the read-path reset that kills a healthy shell.
Root stage: lossless delivery and owner-side marker state
1396403335:
The shell event page is now acknowledged by its cursor; the reader waits on a condvar when the 1 MiB queue is full instead of dropping chunks. A burst is backpressured, not reset; the shell stays alive.
ShellState is derived from full __DIM_START_/__DIM_END_ markers with cross-chunk line buffering; the echoed wrapper line no longer flips ready or sets lastCode.
parse_shell_job validates the full end marker and no longer accepts the echo; registration keeps the first record.
Evidence: host_platform_flow 27, minimal_execution 22, local_execution 42, hooks_flow 69; the new burst test serves >1 MiB without reset; clippy and xtask check pass.
Remaining root work:
ShellSession still owns the per-command capture/occupancy parser; the owner only owns the stream, the state hint and job registration. Moving the capture/occupancy state is the next structural step.
The reset branch in ShellSession still terminates the shell; with the ack it is unreachable for the sole reader, but it should be deleted, not kept as a kill path.
Job registration is still driven by the shell line, not an owner-issued reservation; zerob13's identity invariant remains open.
PathBuf across the face, owner/settlement docs and the PR description remain open.
Remaining: ShellSession still owns the per-command Capture/occupancy policy over the event stream; owner-issued job reservation; the reset branch that still terminates; PathBuf and owner/settlement docs.
The last structural piece is the per-command Capture/occupancy state in ShellSession: the owner now knows the stream and markers, but the command-to-marker-pair mapping is still control-side. Moving it needs a ShellWrite command id plus marker pair (or an equivalent start request) and a task-table entry for a shell command capture; that is the next shape decision.
ShellWrite can carry {command: {taskId, startMarker, endMarker}}.
The owner records the bounded output and exit code under that command id and serves output, wait and settle for it.
A foreground command capture test passes; plain shell writes pass command: None.
Next switch: ShellSession.start_command/execute should use this capture instead of its own Capture; then Capture/occupancy can leave ShellSession. Until that switch the owner capture is exercised only by the new test.
Evidence: host_platform_flow including the owner capture test, minimal_execution 22, local_execution 42; clippy and xtask check pass.
Attempted to move ShellSession.run_foreground/start_command to the owner command capture and rewrite interrupt/occupy_current to read output/wait by command id.
The minimal completion_markers_stay_out_of_captures case hangs: the owner command records the start line, but the foreground command's output/end never reaches run_foreground; the wait stays Running. Source-level attempts to follow the stream did not isolate whether the reader is blocked in the event/backpressure path or the active-command feed.
The half-switch is reverted; the tree is at a56c536f60 with the owner capture capability and the 28/22/42 test suites passing. The foreground switch remains the next task; it needs an isolated repro before another large edit.
Second foreground-switch attempt: marker skip fixed, hang remains
1fc4ecb071 fixes the owner command capture so a full marker line belonging to another command is skipped; the interleaved-marker owner capture test passes.
The ShellSession foreground switch was re-applied and still hangs in completion_markers_stay_out_of_captures. A simple foreground_echo_returns_output passes under the same switch, so the hang depends on the background/foreground interleaving or the event consumer, not the basic owner capture. The switch was reverted again; the last committed state is owner capture + marker skip, with the old ShellSession path.
Next investigation: instrument the completion_markers sequence at each command boundary and the event consumer, not just run_foreground.
Still from review, not in this move: PathBuf across the face, event-page limit, retainOutput for shell ids, settle on a running job, owner/settlement docs and the PR description.
The hostPlatform data face no longer carries PathBuf: HostInfo, ExecShellRuntime, SpawnRequest/Reply, WaitReply, ShellRequest, ConfinedRequest, SpawnWithStdinRequest and RemoveOutputDirectoryRequest use UTF-8 strings; the owner
converts at its boundary.
Removed the unused command_files config and FileStorage branch.
Removed the two-second PID_WAIT; a job kill waits on the reserved job's pid notification.
The job reservation/settle/kill semantics and the owner command capture remain as before.
Verification: host 28, minimal 22, local 42, hooks 69, OCR 1; clippy, xtask types and xtask check pass.
Activity
docs: define execHost, fsHost and store as data faces
docs: fix recognition, reset cursor and path resolution in the faces
docs: close the face gaps the review found
docs: close resource face contract gaps
docs: define resource leaf data faces (#1397)
eric8810 commentedon Nov 22, 2026
Design correction: no separate
execHostfacerutis already exposes a service's public
&selfmethods by name (#[rutis::service]+ctx.provide); aHostDispatchis generated by the framework, not written by business code. Scope is orthogonal to exposure: a service is served in the scope it is provided, and a leaf mounts part copies in the host's instances (research/remote-plugins §4.2), so a Session/branch service crosses a leaf just as a process service does.The single process-scope
execHostface inresource-faces.md§1/§3 is withdrawn. The corrected split:hostPlatforminfo, and its own data methods;spawn/spawn_pty/build_process_specstay#[service(skip)]toolHostexecuteremains the exec entrybackgroundExecoutput,outputPage,wait,stop;startstays skip (it takesExecProcess)sessionMethods.shellNo ownership move, no
HostPlatformrename, noHostFacts, no hand-writtenHostDispatchorplugin.d.ts. Cancellation uses the existingcancelled: CancelledFncallback (astoolHost.executedoes).The replacement PR updates
resource-faces.md,service-faces.mdandcontracts/resource-owner-operations.md, and exposeshostPlatform.infowithxtask typesdeclarations. #1899 is closed.eric8810 commentedon Nov 22, 2026
The corrected implementation is #2002:
hostPlatformexposes its own data methods (info,execShell,sandboxBackend,execRoot); the task and shell operations stay ontoolHost,backgroundExecandsessionMethods.shell. The design docs are updated in that PR.eric8810 commentedon Nov 22, 2026
Direction: data-shaped methods on
HostPlatformThe separate
execHostface is withdrawn (#1899). The process owner keeps its type, file, scope and dependencies; the methods external plugins use become data operations. This follows the dependency review: 16 plugins injectHostPlatform, so their calls must be service methods; the process/PTY state moves intoHostPlatformso handles never cross.Public methods (
#[rutis::service]on the existingimpl HostPlatform)info{}{os, arch, home, timezone?, execRoot, platformRoots, backend, execShell}spawn{taskId, command, cwd, workspace, roots, outputDir, timeoutMs?}{outputPath}wait{taskId, timeoutMs?}+cancelledcallback{status, exitCode?, signal?, durationMs, outputPath, outputBytes, outputTruncated, preview, previewTruncated, failureNote?}kill{taskId}{}settle{taskId}{}output{taskId, cursor?, limit?}or{outputPath, cursor?, limit?}{text, bytes, nextCursor?, truncated, retainedFrom, reset?}tail{taskId}{text, totalBytes, truncated}retainOutput{taskId}{outputPath}shell{taskId, cwd, workspace, roots, outputDir, cols, rows}{outputPath}write{taskId, data}(base64){}resize{taskId, cols, rows}{}configured{command, cwd, env?, stdin?, timeoutMs, limits}+cancelledcallback{status, exitCode?, signal?, durationMs, stdout, stderr, stdoutTruncated, stderrTruncated}confined{program, args, read, write, env?, timeoutMs, outputLimit, services}+cancelledcallback{status, stdout, stderr, confined, stdoutTruncated, stderrTruncated}execShell/persistentShellShellStatussandboxBackendSandboxBackendexecRootremoveOutputDirectory{path}{}childPath{directories, base}string?Internal,
#[service(skip)]current,with_execution_settings,with_toolchain_source,build_process_spec,prepare_isolated_process,spawn_pty,spawn_with_stdin,installed_toolchains.These become the internal implementation of
spawn/shell/configured/confined.Caller migration
WorkspaceTools/BackgroundExec:spawn/wait/output/kill/settle; the branch keeps the task record.ShellSession:shell/write/resize/output/kill; the PTY stays inHostPlatform.Hooks:configured.Modality(OCR):confined.Permission,PromptSources,Skills,FileAccess:info()/ existing data methods.childPath, or stays local if the path helper is not needed across nodes.Invariants
HostPlatform, filehost_platform.rs, plugin, scope and dependencies unchanged.HostDispatch, no hand-writtenplugin.d.ts;#[rutis::service]and#[service(skip)], withxtask typesgenerating the declarations.HostPlatform; handles never cross.cancelled: CancelledFnparameter; nocanceloperation and nocallId.Open points
childPath:stringvs OS path; non-UTF-8 semantics.removeOutputDirectory: error code when the path is outsideexecRoot.tail/retainOutput: keep only if the current callers need them.ShellSession's marker/occupancy loop needs the output-delivery design (polloutputvs an internal stream) before the PTY move.eric8810 commentedon Nov 22, 2026
Refined plan and staging
The structural step has landed on #2002 (
cbe4b75172): the service block is the originalimpl HostPlatform;execShell,sandboxBackend,execRootandinfoare served from it;spawn,spawn_with_stdin,with_execution_settings,with_toolchain_sourceandprepare_isolated_processare#[service(skip)]. No new file and no new service object.Changed in place vs added
spawn(spec) -> ProcessTreespawn(request) -> {taskId, outputPath}; the handle method becomes internalspawn_treespawn_pty(spec, size) -> PtyProcessTreespawn_pty(request) -> {taskId, outputPath}(Stage 2)spawn_with_stdin(spec, stdin)spawn_with_stdin(request) -> result(Stage 3)spawn_confined(spec, confinement)spawn_confined(request) -> result(Stage 3)remove_exec_directory(&Path)remove_output_directory(PathBuf)(Stage 4)wait/kill/output/settleProcessTreehandle, not onHostPlatform; oncespawnreturns a task id, the owner needs them by idwrite/resizePtyProcessTreehandle (Stage 2)infohome/os/arch/timezone/platformRootsare fields, not methodsNo
configured/confinednames: Stages 3 changesspawn_with_stdin/spawn_confinedin place.tail/retainOutputonly if the callers need them.Staging
HostPlatformowns the command task table and output files.spawnreturns a task id;wait/kill/output/settlework by id.WorkspaceTools/BackgroundExecmigrate;infoconsumers use the service. No new file.spawn_pty-> task id,write/resize) andShellSession; first decide the branch shell protocol's output delivery (polloutputvs an owner-side stream).spawn_with_stdin/spawn_confinedrequest/reply shapes; Hooks and OCR.remove_output_directory,childPath, andtail/retainOutputif needed.Stage 1 scope
~8–10 files, ~+900/−400:
host_platform.rs(task fields and methods),workspace_tools/exec.rs,workspace_tools/background.rs,workspace_tools/mod.rs,shell_input.rs(spawn_tree),app-server/src/lib.rs(commandFiles), tests. No new file.Open
childPathshould probably stay local to the App Server's MCP stdio child, not the remote node.info()resolves the exec shell; callers that only needhome/oscan read the captured fields.eric8810 commentedon Nov 22, 2026
Stage 1 complete;
waitis typedwaitnow answersWaitReplywith aWaitStatusunion, optionalexitCode/signal/failureNote, duration, output path, byte count and bounded preview.xtask typesgeneratesWaitReply/WaitStatus; the TS signature iswait(request: WaitRequest): Promise<WaitReply>(commit8b17b575d9on Serve hostPlatform's data methods; withdraw the execHost face #2002).spawnreturns a task id;wait/kill/settle/output/retainOutput/tailwork by id;WorkspaceTools/BackgroundExecuse the owner's task;info,execShell,persistentShell,sandboxBackend,execRootare served from the originalimpl HostPlatform. No new file.host_platform_flow20 passed;local_execution42 passed;xtask check; clippy.Next: Stage 2 (shell/PTY). Decision for this stage: the branch shell protocol stays in
ShellSessionand runs where the shell owner runs;start_shellhands it an in-process output stream, while the publicshell/write/resize/outputoperations serve foreign callers by task id. A control-sideShellSessionagainst a remote owner is not part of this stage.eric8810 commentedon Nov 22, 2026
Stages 1–4 delivered on #2002
b6ed380f2c,8b17b575d9): command task table and output file onHostPlatform;spawnreturns a task id;wait/kill/settle/output/retainOutput/tailby id; typedWaitReply/WaitStatus;info,execShell,persistentShell,sandboxBackend,execRoot.WorkspaceTools/BackgroundExecmigrated.aabb04d4ba): PTY and shell task onHostPlatform;shell/write/resize;output/wait/kill/settleserve shell tasks;ShellSessionruns its marker protocol over the owner's task.07fd907d2e):spawnWithStdinandspawnConfinedare the data methods Hooks and OCR call; the low-level cores are*_processand stay off the service;SystemServicesis data.cab9102422):removeOutputDirectoryandchildPathare data methods; SessionFiles and MCP keep the in-process binding.No new file: the shell module is inline in
host_platform.rs; the service block is the originalimpl HostPlatform. The catalog andbranch-services.d.tsare generated.Verification:
host_platform_flow24,hooks_flow69,local_execution42;xtask check; clippy;runtime/plugin-sdk.test.mjs2. One combined run ofhost_platform_flowreported an uncaptured failure, and an immediate rerun passed 24/24; watch CI for a repeat.Remaining follow-ups (not blocking): the shell output path is the owner's capture; a control-side
ShellSessionagainst a remote owner is not part of Stage 2;childPathis a lossy string binding for non-UTF-8 paths.6 remaining items
eric8810 commentedon Nov 22, 2026
Wait-timeout kill: origin and fix
0c74bdf45a("docs: define resource leaf data faces (docs: define resource leaf data faces #1397)"): theexecHostdesign sayswait.timeoutMs"reaching it kills the tree". This is the design source; it also contradicted §3's rule that cancelling a read changes nothing.285941f0c1("Keep command processes on the execution host and expose start, wait, kill and settle"):CommandTask::waitimplements it by cancelling the command'stimeouttoken.b6ed380f2c(Stage 1 of Serve hostPlatform's data methods; withdraw the execHost face #2002): the oldexec.rs/background.rswere copied, so the implementation came along.ShellTask::waitcopied the same pattern in Stage 2.2d1e643d39:waittimeout answersWaitStatus::Runningand leaves the task alive; a command's ownspawn.timeoutMsstill terminates it;killis explicit. Testa_wait_timeout_leaves_the_command_running.This was not a requirement from the current work; it was inherited from the old design and never re-checked against the cancellation rule.
eric8810 commentedon Nov 22, 2026
Correct the root, not by reverting
Decision: keep the data face and fix the design; do not revert the shell work.
Root cause of the 1 MiB reset: the owner owns the byte stream, but the marker/occupancy state machine is still in
ShellSession. The bounded event queue is therefore being used as a lossless protocol stream; when it drops chunks, the parser resets and kills a healthy shell.ShellStateandparse_shell_jobare prefix/line scans, not the real parser. The fix is to move the marker/occupancy state and job registration to the owner, so output pages may be lossy while protocol state/events stay reliable.Order:
shellstarts throughstart_shellwithoutarc(); the minimal execution assembly must work.removeOutputDirectory: reject./.., canonicalize the target/deepest ancestor, compare with the canonical root, do not follow symlinks; SessionFiles defers to this authority.spawnConfinedmapsConfinedError::InvalidPathtoHostPlatformError::InvalidPath { path, reason }; run the modality suite.sandbox_backenddoc comment soxtask typesis host-independent.create_new+ 0600; remove it when the shell task settles; no unbounded leak.ShellJob;killuses that pid; settle job records even when kill fails.spawnmapstask_exists/invalid ids to the typed errors;task_existsbecomes reachable.Verification must include
cargo test --workspace --locked(the minimal execution assembly) and the modality suite, not onlylocal_execution.eric8810 commentedon Nov 22, 2026
P1 corrections landed (
1e1f8c79)shellcallsstart_shelldirectly; the minimal execution assembly works again (minimal_execution22 passed).ShellJob;killuses it after the shell is gone; job records settle even when kill fails.stop_background_taskandshell_exit_kills_background_jobspass.removeOutputDirectoryrejects./.., canonicalizes the target/deepest ancestor against the canonical root, refuses symlinks, and SessionFiles defers to it.spawnConfinedmapsConfinedError::InvalidPathtoHostPlatformError::InvalidPath { path, reason }; the modality OCR test passes.sandbox_backendhas one doc comment;xtask typesis host-independent.create_new, 0600, and removed with the shell task.spawnpreflights the output directory and log path and mapstask_exists/invalid requests.waitdocs say running; the running preview flag is computed.Still open (root): move the marker/occupancy parser and job reservation into the owner; make output pages a display cache and protocol state/events lossless; remove the reset-kill path; then PathBuf, settlement/owner docs and the PR description.
eric8810 commentedon Nov 22, 2026
P1 correction status and full-suite note
P1 corrections are in
1e1f8c79. Targeted evidence:minimal_execution22 passed (includingstop_background_taskandshell_exit_kills_background_jobs);local_execution42 passed;host_platform_flow26 passed;hooks_flow69 passed;xtask checkpassed.cargo test --workspace --lockedin this Linux environment is not a pass:transport_flowreports 338 failures withinitialization timed out: AgentIndex Missingeven when a single case is run alone, so the App Server suite cannot initialize here. This is not evidence for or against the execution changes; it needs separate environment/CI triage and is not claimed as passing.The root work is still open: owner-side marker/occupancy parsing, reliable protocol state/events, and removing the read-path reset that kills a healthy shell.
eric8810 commentedon Nov 22, 2026
Root stage: lossless delivery and owner-side marker state
1396403335:ShellStateis derived from full__DIM_START_/__DIM_END_markers with cross-chunk line buffering; the echoed wrapper line no longer flipsreadyor setslastCode.parse_shell_jobvalidates the full end marker and no longer accepts the echo; registration keeps the first record.Evidence:
host_platform_flow27,minimal_execution22,local_execution42,hooks_flow69; the new burst test serves >1 MiB without reset; clippy andxtask checkpass.Remaining root work:
ShellSessionstill owns the per-command capture/occupancy parser; the owner only owns the stream, the state hint and job registration. Moving the capture/occupancy state is the next structural step.ShellSessionstill terminates the shell; with the ack it is unreachable for the sole reader, but it should be deleted, not kept as a kill path.PathBufacross the face, owner/settlement docs and the PR description remain open.eric8810 commentedon Nov 22, 2026
Owner now emits output and marker events
00b082b851:ShellEvent::Output { text }andShellEvent::Marker { line }.ShellSessionconsumes named events instead of splitting raw chunks; the full marker line is already recognized by the owner.ShellStateand job registration use the same full-marker recognition; the echo no longer matches.Evidence:
host_platform_flow27,minimal_execution22,local_execution42,hooks_flow69; burst >1 MiB backpressured; clippy andxtask checkpass.Remaining:
ShellSessionstill owns the per-commandCapture/occupancy policy over the event stream; owner-issued job reservation; the reset branch that still terminates;PathBufand owner/settlement docs.eric8810 commentedon Nov 22, 2026
Marker events and no read-path kill
00b082b851and524deae114:Outputand fullMarkerevents;ShellSessionconsumes named events, not raw chunks.ShellStateand job registration use the same full-marker recognition; the echo/partial marker does not match.killremains the only operation that ends the shell.Evidence:
host_platform_flow27,minimal_execution22,local_execution42,hooks_flow69; clippy andxtask checkpass.The last structural piece is the per-command
Capture/occupancy state inShellSession: the owner now knows the stream and markers, but the command-to-marker-pair mapping is still control-side. Moving it needs aShellWritecommand id plus marker pair (or an equivalent start request) and a task-table entry for a shell command capture; that is the next shape decision.eric8810 commentedon Nov 22, 2026
Owner command capture is available
17ec402af2plus thea56c536f60initializer fix:ShellWritecan carry{command: {taskId, startMarker, endMarker}}.output,waitandsettlefor it.command: None.Next switch:
ShellSession.start_command/executeshould use this capture instead of its ownCapture; thenCapture/occupancy can leaveShellSession. Until that switch the owner capture is exercised only by the new test.Evidence:
host_platform_flowincluding the owner capture test,minimal_execution22,local_execution42; clippy andxtask checkpass.eric8810 commentedon Nov 22, 2026
Foreground switch attempted; reverted on a hang
Attempted to move
ShellSession.run_foreground/start_commandto the owner command capture and rewriteinterrupt/occupy_currentto readoutput/waitby command id.The minimal
completion_markers_stay_out_of_capturescase hangs: the owner command records the start line, but the foreground command's output/end never reachesrun_foreground; the wait staysRunning. Source-level attempts to follow the stream did not isolate whether the reader is blocked in the event/backpressure path or the active-command feed.The half-switch is reverted; the tree is at
a56c536f60with the owner capture capability and the 28/22/42 test suites passing. The foreground switch remains the next task; it needs an isolated repro before another large edit.eric8810 commentedon Nov 22, 2026
Second foreground-switch attempt: marker skip fixed, hang remains
1fc4ecb071fixes the owner command capture so a full marker line belonging to another command is skipped; the interleaved-marker owner capture test passes.The
ShellSessionforeground switch was re-applied and still hangs incompletion_markers_stay_out_of_captures. A simpleforeground_echo_returns_outputpasses under the same switch, so the hang depends on the background/foreground interleaving or the event consumer, not the basic owner capture. The switch was reverted again; the last committed state is owner capture + marker skip, with the oldShellSessionpath.Next investigation: instrument the
completion_markerssequence at each command boundary and the event consumer, not justrun_foreground.eric8810 commentedon Nov 22, 2026
Shell capture and occupancy are now owner-owned
0bc566e7fdcompletes the move:ShellSessioncreates the command id and marker pair and sends them withwrite; the owner records output, exit code, the task log and the bounded tail.output/waitby command id.occupied_waitpages the owner's command output;handle_shell_exitandstopsettle the owner command.Capture,Inner.captureandadvance_occupyingare removed.writeis fixed withArc::ptr_eq.Evidence:
minimal_execution22,local_execution42,host_platform_flow28,hooks_flow69, OCR 1; clippy andxtask checkpass.Still from review, not in this move:
PathBufacross the face, event-pagelimit,retainOutputfor shell ids,settleon a running job, owner/settlement docs and the PR description.eric8810 commentedon Nov 23, 2026
Path data, dead config and pid wait are closed
aba6725310and7fd191ac77:hostPlatformdata face no longer carriesPathBuf:HostInfo,ExecShellRuntime,SpawnRequest/Reply,WaitReply,ShellRequest,ConfinedRequest,SpawnWithStdinRequestandRemoveOutputDirectoryRequestuse UTF-8 strings; the ownerconverts at its boundary.
command_filesconfig and FileStorage branch.PID_WAIT; a job kill waits on the reserved job's pid notification.Verification: host 28, minimal 22, local 42, hooks 69, OCR 1; clippy,
xtask typesandxtask checkpass.eric8810 commentedon Nov 23, 2026
Non-UTF-8 path boundary is explicit
984f6b59d1:hostPlatform.inforeturns an error if the home, exec root or a platform root is not UTF-8.exec_shell_unavailable.DIMCODE_HOME/DIM_PLUGIN_ROOT.Verification: host 28, minimal 22, local 42, hooks 69, OCR 1; clippy,
xtask typesandxtask checkpass.docs(host-platform): record the task-owner redesign