Fix shell launch restart loop with persistent interactive shell#49
Merged
Conversation
Update the PS1 prompt in the sandbox shell template so the terminal shows actor@sandbox instead of apify@sandbox.
- /shell?launch=<cmd> now runs in a persistent interactive shell that echoes the command and surfaces a non-zero exit, instead of a bash -c that exits and makes ttyd respawn it in a restart loop. - Claude: wrap the command with --dangerously-skip-permissions (settings bypass mode shows a blocking confirmation dialog); pre-accept onboarding. - Codex: ~/.codex/config.toml with approval_policy=never + danger-full-access. - OpenCode: permission "allow" so nothing prompts. - OpenClaw: open both YOLO policy layers (tools.exec + exec-approvals.json). - Point the wrapper actors' launch URLs at ?launch= so they get the fix.
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.
Summary
Fixes a restart loop when launching commands via the
?launch=parameter by wrapping the command in a persistent interactive shell. Previously, commands would exit immediately after completion, causing ttyd to respawn the process repeatedly. Now the shell stays alive after command execution, keeping output visible on screen.Key Changes
Shell launch wrapper redesign: Replaced simple command execution with a multi-step wrapper that:
Simplified launch parameter syntax: Updated actor.json templates to use the cleaner
?launch=<cmd>form instead of manually constructing?arg=-c&arg=...parametersTool auto-approval configuration:
--dangerously-skip-permissionsflagShell environment improvements:
OpenCode configuration: Simplified permission model from granular per-tool settings to a single "allow" policy
Implementation Details
The new
buildLaunchCommand()function constructs a bash command string that:/app/sandbox_bashrcto set up environment and tool wrappers$prompt prefix for visibility|| echo "[command exited with status $?]"to surface failuresThis approach prevents the restart loop while maintaining a seamless user experience where commands appear to run interactively and any errors remain visible.
https://claude.ai/code/session_01Fr9fjpNTprHnrU5JbUnrmp