Repository navigation
isb 3.4.0: exec -it runs a command interactively, on a terminal - #73
Merged
Merged
Conversation
`isb stack exec -it NAME SERVICE -- CMD` (and app exec, instance exec) run the command on a pseudo-terminal in the replica, wired to the local terminal: raw keys out, output back, SIGWINCH resizes, the command's exit code returned, the terminal restored. It rides the daemon's terminal websocket, which now takes stack=/service= targets and a command (argv=, user=, cwd=, env=), admitted as the exec tool that runs it without a terminal. Works over the daemon's unix socket and over $ISB_URL with $ISB_TOKEN; refused when stdin is not a terminal. Not on MCP. Claude-Session: https://claude.ai/code/session_016AFG7KfrwCTBETjGfyW75K
Claude-Session: https://claude.ai/code/session_016AFG7KfrwCTBETjGfyW75K
Found end to end: resizing the window interrupted the websocket read (EINTR) and ended the session. Claude-Session: https://claude.ai/code/session_016AFG7KfrwCTBETjGfyW75K
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
isb stack exec -it NAME SERVICE -- CMD(andisb app exec -it,isb instance exec -it) run the command on a pseudo-terminal in the replica, wired to your terminal, asdocker exec -it/kubectl exec -itdo:isbexits with the command's status, and the local terminal is restored (also on SIGTERM/SIGHUP, which end the session and kill the command)-iis implied;-u,-w,-e,--replicawork as without-t;$TERMis passed along-nand--timeoutMotivating use:
isb --org ocai stack exec -it email stalwart -- stalwart-migrate prepare ..., or-it ... -- shfor debugging.How
It rides the daemon's existing terminal websocket (
/orgs/<org>/api/v1/terminal, the web UI's terminals), which now also takes:stack=NAME&service=SERVICEas a target (besideapp=andinstance=), replica picked asstack_execpicks itargv=(repeated, percent-encoded),user=,cwd=,env=KEY=VALUEA command session is admitted as the exec tool that runs it without a terminal (
stack_exec,app_exec,instance_exec), so--deny-toolsand token scopes apply exactly as for plainexec; a shell is stillsandbox_exec's. The terminal websocket now also accepts the daemon's unix socket without anOrigin(as the SSH websocket already did), so-itworks on the host as well as over$ISB_URL+$ISB_TOKEN. The client loop (server::terminal::attach) is generic and tested against the server's own bridge.MCP: deliberately left out. The
*_exectools run a command to completion and return its output; a terminal needs a person at a keyboard. Docs say so.Verification
scripts/check.shgreen in an isb sandbox (ratchet, fmt, clippy-D warnings, docs links, all unit tests). New tests: query round-trip of stack targets and commands (spaces,&,=, UTF-8), bad requests refused, admission per tool (--deny-tools stack_execrefuses-iton a stack), unix-socket Origin rule, and the client end against the real bridge (keys, resize, exit code, stop, refusal).isb ... exec -iton a real pty with a Python harness, against an alpine stack:stack exec -itandinstance exec -it; overISB_URL+ an org token with the socket hidden,stack exec -itstty size, resize to 50x150 seen by the guest, Ctrl-C interrupts the guest'ssleepwhile isb keeps running,exit 7returns 7, local termios identical before and after-u nobody -w /tmp -e 'FOO=bar baz'reach the command; exit 4 relayed; a bogus token is refused cleanly;-it </dev/nullis refused; plainstack execunchangedisb app exec -it(same daemon path as stacks, an app being the service of its own stack).https://claude.ai/code/session_016AFG7KfrwCTBETjGfyW75K