Skip to content

Add --label flag, list, and cleanup commands#44

Open
2metres wants to merge 1 commit intosimonw:mainfrom
2metres:claude/label-list-cleanup
Open

Add --label flag, list, and cleanup commands#44
2metres wants to merge 1 commit intosimonw:mainfrom
2metres:claude/label-list-cleanup

Conversation

@2metres
Copy link

@2metres 2metres commented Mar 18, 2026

Summary

Adds instance management features to help identify and clean up orphaned Chrome processes:

  • --label=NAME flag on rodney start — Tags a Chrome instance with an arbitrary label, persisted in state.json. Useful for AI agents (e.g. Claude Code) to tag instances with their session ID so orphans can be traced back to their owner.
  • rodney list — Scans all known state directories (~/.rodney, ./.rodney, RODNEY_HOME, /tmp/rodney-*) and shows each instance's PID, alive/dead status, and label.
  • rodney cleanup — Removes stale state.json files for dead Chrome processes. --all also stops live instances.
  • rodney status now shows the label if set.

Motivation

When multiple agents spawn headless Chrome instances via rodney, orphaned processes accumulate if sessions end without cleanup. The --label flag lets callers tag instances (e.g. rodney start --label="claude-9dc66b24"), and rodney list / rodney cleanup make it easy to find and remove orphans.

Example

rodney start --label="agent-abc123" rodney list # ~/.rodney pid=1234 alive label=agent-abc123 # After the agent dies without stopping rodney: rodney cleanup # Cleaned: ~/.rodney (pid=1234 label=agent-abc123)

Test plan

  • All existing tests pass
  • New tests for --label flag parsing (equals and space-separated forms)
  • New tests for State label serialization (present and omitted when empty)
  • New test for discoverInstances with RODNEY_HOME
  • Manual testing: start with label, verify status/list output, kill Chrome directly, verify cleanup removes stale state
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant