Skip to content

Repair undrainable cleanup child jobs during --drain #913

Description

@chubes4

Problem

workspace cleanup run --mode=emergency --drain can complete its parent and leave a pending cleanup child without a drainable Action Scheduler action. The command returns waiting_on_children; repeated exact datamachine drain --job-id=<child> calls report no_progress.

Observed on 2026-07-16: run cleanup-run-2386, child job 2388. cleanup resume already has repair logic for pending children without execute-step actions, but the --drain orchestration does not invoke it.

Expected

Before draining descendants, the cleanup drain path detects pending_without_drainable_action_job_ids, repairs their missing execute-step actions through the existing scheduler primitive, records repair evidence, and drains the repaired children.

Acceptance criteria

  • cleanup run --mode=emergency --drain repairs pending child jobs that lack drainable actions.
  • The repair is idempotent and does not duplicate valid actions.
  • Output reports repaired child IDs and final state.
  • Deterministic coverage reproduces a pending undrainable child and proves one command reaches terminal cleanup state.

AI assistance

  • AI assistance: Yes
  • Tool(s): OpenCode (openai/gpt-5.6-sol)
  • Used for: Diagnosing the live cleanup run and drafting this tracker.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions