From 269ce4557f39a78a9f327e7a6647dbbeb57cbdea Mon Sep 17 00:00:00 2001 From: aran-yogesh Date: Wed, 11 Feb 2026 11:14:51 -0800 Subject: [PATCH] feat: add background execution guidance for long-running commands --- apps/agent/agent/prompt.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/apps/agent/agent/prompt.py b/apps/agent/agent/prompt.py index 6b44afcf..dd79a5f5 100644 --- a/apps/agent/agent/prompt.py +++ b/apps/agent/agent/prompt.py @@ -20,6 +20,33 @@ All code execution and file operations happen in this sandbox environment. Do **not** run dependency installation commands (e.g. `uv run poe install-deps`, `npm install`, `yarn install`) in this environment. They are not supported in the sandbox and will fail or behave unexpectedly. Assume dependencies are already available or skip setup steps that install them. +### Running Long Commands + +For long-running commands (e.g., builds, extensive test suites, migrations), you MUST run them in the background to avoid network timeouts: + +1. **Redirect output to a log file**: Append output using `> /tmp/command.log 2>&1 &` +2. **Run in background**: End the command with `&` to run it asynchronously +3. **Check periodically**: Use `ps`, `jobs`, or check if the process is still running +4. **Read the logs**: Use `tail -n 50 /tmp/command.log` to check progress + +**Example:** +```bash +# Start a long-running build in the background +make build > /tmp/build.log 2>&1 & +BUILD_PID=$! + +# Check if it's still running +ps -p $BUILD_PID + +# Check the logs +tail -n 50 /tmp/build.log + +# Wait for completion (if needed) +wait $BUILD_PID && echo "Build completed" || echo "Build failed" +``` + +This approach prevents command loss due to network errors and allows you to track progress. + ### Committing Changes and Opening Pull Requests