Skip to content

Route selected worker commands through the host runner - #204

Open
demrom wants to merge 24 commits into
holzschu:masterfrom
demrom:preparation/host-policy-313
Open

demrom wants to merge 24 commits into
holzschu:masterfrom
demrom:preparation/host-policy-313

Conversation

@demrom

@demrom demrom commented Oct 24, 2026

Copy link
Copy Markdown
Contributor

An SSH shell running in an extension can select a command whose memory needs exceed that extension's budget. Let the application opt those commands into its existing host runner with ASHELL_HOST_COMMANDS.

The policy applies only inside a worker and excludes stock SSH clients, which still require isolated workers. Missing or busy host execution returns status 125. Host commands run under Dash with its foreground input lease. If host cancellation is rejected, the proxy asks that foreground command to stop, closes input and drains output until the host reports completion. It retries until an interrupt is accepted or the host command completes. Cooked commands that reach pthread cancellation points return 130 and release the host slot. This cannot forcibly stop an uncooperative CPU loop or a raw command that ignores EOF: it retains the only host slot until completion or app restart. Strict POSIX spawn keeps its extension-only admission rules. This requires #202 exporting ios_interruptpid, ios_system#201 and #203; the server companion supplies the host-runner API.

Codex owns its terminal input like Vim, so it belongs in the existing interactive command list. The socket relay preserves CR and Ctrl-D before host execution. The application companion keeps this mode in the owning pane; its runtime hook leaves other sessions on the existing UI callbacks. Stopping the local terminal's interactive mode must not change the remote pane's raw input or interrupt result. The public Simulator consumer passed a local /status command with delayed CR and two interrupts followed by same-shell recovery.

On Simulator, the application companion's tests/host-cancellation.m consumer calls ios_interruptpid, drains 2 MiB after rejected host cancellation and requires command and host status 7. Its tests/pane-interrupt.m consumer also passes after the local embedding UI stops interactive mode while its remote raw reader remains active.

Dash restores the saved interactive mode after external commands, pipeline errors and exec; the socket consumer also checks a raw reader followed by a cooked sleep interrupted with status 130 and same-shell recovery.

On Simulator, the application companion scopes both input mode and foreground-PID exchange to the pane context. Its cooked-isolation consumer keeps an unrelated local Dash running while interrupting the remote sleep: remote status 130 and recovery pass, and the local Dash finishes with status 0.

Native Codex ran on the iPhone in both Vim/Codex orders with separate fresh credential-free homes, answered delayed /status for the local fixture provider and returned to the same shell after double Ctrl-C. The TUI checks used a server-only prompt and skipped the user profile.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant