Skip to content

Conversation

@NathanFlurry
Copy link
Member

Summary

Adds a Process Manager API for spawning and managing background processes.

API Endpoints

  • POST /v1/process — Start a new process
  • GET /v1/process — List all processes
  • GET /v1/process/{id} — Get process details
  • POST /v1/process/{id}/stop — Stop (SIGTERM)
  • POST /v1/process/{id}/kill — Kill (SIGKILL)
  • DELETE /v1/process/{id} — Delete process + logs
  • GET /v1/process/{id}/logs — Read logs (with streaming support)

Features

  • Process lifecycle management (start, stop, kill, delete)
  • Log management with timestamps
  • State persistence to disk
  • SSE streaming for logs
  • Inspector UI integration with Processes tab

Inspector UI

  • Process list with status badges
  • Log viewer with stream selector
  • Action buttons for stop/kill/delete
  • Auto-refresh every 5 seconds

…ocesses

API Endpoints:
- POST /v1/process - Start a new process
- GET /v1/process - List all processes
- GET /v1/process/{id} - Get process details
- POST /v1/process/{id}/stop - Stop a process (SIGTERM)
- POST /v1/process/{id}/kill - Kill a process (SIGKILL)
- DELETE /v1/process/{id} - Delete a process and clean up logs
- GET /v1/process/{id}/logs - Read process logs (supports tail, follow via SSE)

Features:
- Log files written to ~/.local/share/sandbox-agent/processes/{id}/
  - stdout.log, stderr.log, combined.log
- Process state persisted to state.json for server restart survival
- Status tracking: starting, running, stopped (with exit_code), killed
- Real-time log streaming via SSE with follow=true query param
- Environment variables and working directory support

Cleanup rules:
- Process exits naturally → logs preserved
- DELETE endpoint → logs removed
Backend changes:
- Add timestamps to log lines: [2026-01-30T12:32:45.123Z] <line>
- stdout.log and stderr.log get timestamps per line
- combined.log includes [stdout]/[stderr] prefix after timestamp
- Add strip_timestamps query param to GET /process/{id}/logs
- Use time crate with RFC3339 format for timestamps

Frontend changes:
- Add Processes tab to inspector debug panel
- Show list of processes with status badges (running/stopped/killed)
- Click to expand and view logs
- Log viewer options:
  - Select stream: combined, stdout, stderr
  - Toggle strip_timestamps
  - Refresh logs button
- Action buttons: stop (SIGTERM), kill (SIGKILL), delete
- Auto-refresh process list every 5 seconds
@railway-app
Copy link

railway-app bot commented Jan 30, 2026

🚅 Deployed to the sandbox-agent-pr-42 environment in sandbox-agent

Service Status Web Updated (UTC)
website 😴 Sleeping (View Logs) Web Jan 30, 2026 at 9:13 pm
inspector 😴 Sleeping (View Logs) Web Jan 30, 2026 at 9:11 pm

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.

2 participants