Skip to content

Implement Run Execution Management (ISSUE-005)#5

Open
proboscis wants to merge 1 commit intomainfrom
issue/ISSUE-005/run-20251228-153247
Open

Implement Run Execution Management (ISSUE-005)#5
proboscis wants to merge 1 commit intomainfrom
issue/ISSUE-005/run-20251228-153247

Conversation

@proboscis
Copy link
Owner

Summary

  • Adds execution management features to runbox for observing and controlling running jobs
  • Extends Run struct with status, runtime, session_ref, log_ref, timeline, exit_code, and pid fields
  • Implements new CLI commands: ps, logs, stop, attach, _on-exit
  • Enhances runbox run with --runtime flag for background, tmux, zellij, or foreground execution
  • Maintains backward compatibility with existing JSON format

Key Features

Run Structure Extensions

  • RunStatus: Pending, Running, Exited, Failed, Killed
  • Runtime: Background (bg), Tmux, Zellij, Foreground
  • LogRef: Path to log file for stdout/stderr capture
  • Timeline: created_at, started_at, ended_at timestamps

New CLI Commands

Command Description
runbox ps [--status <status>] List running/recent runs
runbox logs <run_id> Show run logs
runbox logs -f <run_id> Follow log output
runbox stop <run_id> Stop a running run
runbox attach <run_id> Attach to tmux/zellij session

Enhanced runbox run

runbox run -t <template> --runtime bg      # Background process
runbox run -t <template> --runtime tmux    # Tmux session
runbox run -t <template> --runtime zellij  # Zellij session
runbox run -t <template> --runtime foreground  # Blocking execution

References

  • Issue: ISSUE-005

Test plan

  • All existing tests pass
  • New Run struct tests for lifecycle management
  • Backward compatibility test for old JSON format
  • Manual testing of tmux/zellij integration
  • Manual testing of background execution

🤖 Generated with Claude Code

Add execution management features to runbox for observing and controlling
running jobs while maintaining reproducibility (code_state) as the core.

Changes:
- Extend Run struct with status, runtime, session_ref, log_ref, timeline,
  exit_code, and pid fields
- Add RunStatus enum (Pending, Running, Exited, Failed, Killed)
- Add Runtime enum (Background, Tmux, Zellij, Foreground)
- Add LogRef struct for log file references
- Add Timeline struct for tracking run lifecycle timestamps
- Implement atomic save/update methods in Storage
- Add logs directory to storage

New CLI commands:
- `runbox ps` - List running and recent runs with status filtering
- `runbox logs <run_id>` - Show run logs
- `runbox logs -f <run_id>` - Follow log output (tail -f style)
- `runbox stop <run_id>` - Stop a running run
- `runbox attach <run_id>` - Attach to tmux/zellij session
- `runbox _on-exit <run_id> <exit_code>` - Internal exit callback

Enhanced `runbox run` command:
- Add --runtime flag (bg, tmux, zellij, foreground)
- Capture stdout/stderr to log files
- Track process lifecycle with status updates
- Support tmux session management with shared session + window pattern
- Support zellij session management

All changes maintain backward compatibility with existing JSON format.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
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