Skip to content

Babysit step 6 on Claude Code: say how to run watch-pr (background in the main session, bounded in a subagent) #232

Closed

Description

@tapabratadey

Problem

On Claude Code, the poteto-mode Babysit playbook does not say how to run the PR watcher. Agents either hold it in the foreground or wrap it in a babysit subagent that polls CI.

skills/poteto-mode/playbooks/babysit.md step 6 (identical in installed 1.4.1 and main at 9368993, 1.15.0):

On GitHub, run skills/poteto-mode/scripts/watch-pr/watch-pr --owner "$base_owner" --repo "$base_name" --pr "$pr" under the installed plugin. … The bare command polls until a terminal verdict, which is drive behavior. … Run drive and background under /loop in dynamic mode. Rearm the watcher after every push wave and every verdict you act on. Watcher output drives wakeups. Never add a second sleep loop.

watch-pr --timeout defaults to 0 ("deadline; 0 disables it") in scripts/watch-pr/cli.ts. On Claude Code that means:

Evidence

From one month of Claude Code transcripts on one machine (2026-09-19 to 10-19), where babysitting ran as one background subagent per PR:

  • 227 polling loops, 9.5 h. 9.3 h of that was inside subagents, almost all of them babysit subagents.
  • By what the loop waited for: the subagent's own test or build log marker (3.7 h), its own background task output file (2.9 h), and CI or GitHub checks (2.3 h).
  • The longest single babysit subagent spent 1.44 h polling.

Suggested text

Add to step 6, for Claude Code:

On Claude Code, run the watcher from the main session with Bash run_in_background: true and act on its exit notification. Inside a subagent, run it in the foreground with --timeout 570 and re-arm on timeout. Do not background it and then poll its output file.

Optionally, mention the same thing in references/codex-tools.md. Codex exec_command already returns with a session id, so it is unaffected.

Not verified

  • Whether /loop dynamic mode on Claude Code already re-arms a backgrounded watcher correctly. I did not test that path.

Activity

  1. ericlitman commented on Oct 21, 2026

    @ericlitman
    Owner

    Thanks for this, and for quoting the exact text. Both quotes check out on main at 9368993: step 6, and watch-pr's --timeout default of 0.

    Testing on Claude Code 2.1.304 changes two details of the suggested text:

    • A foreground Bash call that reaches its timeout moves to the background instead of stopping, and the default timeout is 2 minutes. So a foreground watcher also needs Bash timeout: 600000.
    • --timeout 570 can still overrun the 10-minute limit. watch-pr checks its deadline only before each sleep, and one sleep can last up to 300 s after a retry. We'll use --timeout 240 and rearm on TIMEOUT.

    On your "Not verified" question: /loop can't run inside any subagent, because subagents don't get ScheduleWakeup. So step 6's /loop line works only in the main session.

    We plan to fix this together with #233 in one PR: a Claude Code section in references/codex-tools.md that says how the main session and subagents wait, and one sentence in step 6 that points to it. We'll link the PR here.

  2. ericlitman commented on Oct 21, 2026

    @ericlitman
    Owner

    The fix is open as #239.

  3. added a commit that references this issue on Oct 21, 2026
  4. ericlitman commented on Oct 21, 2026

    @ericlitman
    Owner

    This shipped in Open Pstack 1.16.0 (https://github.com/ericlitman/open-pstack/releases/tag/v1.16.0) through #239. The lane agents no longer set background: true, and references/codex-tools.md has a "Waits on Claude Code" section that babysit step 6 points to. Thanks for the careful reports.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions