#6292·opensre

[BUG] Failed CI repairs are persisted as successful scheduler runs

Author: Devesh36Created Sep 17, 2026Updated Sep 17, 2026

Problem

ci_repair_loop.supervisor.finish_run() creates a TaskReport without specifying its work outcome.

TaskReport defaults to WorkStatus.SUCCEEDED, regardless of the repair's terminal status. Failed, timed-out, and cancelled repairs therefore produce a successful work outcome.

When report delivery succeeds, the scheduler persists the run as successful and execute_task() returns True, even though the report describes a failed repair.

Reproduction

  1. Create a terminal RepairRun with status=RepairStatus.FAILED.
  2. Generate its report through finish_run().
  3. Execute a scheduled task returning that report, with successful delivery.
  4. Inspect the persisted scheduler run.

Observed:

  • Repair status: failed
  • Scheduler run status: success
  • Scheduler work status: succeeded
  • execute_task() result: True

The report text and structured execution outcome contradict each other.

Expected behavior

The report's work outcome reflects the terminal repair status. Successfully delivering a failure report does not make the repair successful.

Suggested fix

Map RepairStatus to an explicit work outcome when constructing the terminal TaskReport. Keep delivery status independent from repair success.

Acceptance criteria

  • Failed, timed-out, and cancelled repairs do not receive a succeeded work outcome.
  • Successful repairs retain a succeeded work outcome.
  • Scheduler history preserves the repair outcome even when delivery succeeds.
  • Regression coverage exercises terminal report generation through scheduler persistence.

Affected code

integrations/github/tools/ci_repair_loop/supervisor.py

  • finish_run()

infrastructure/scheduling/scheduler/types.py

  • TaskReport

infrastructure/scheduling/scheduler/executor.py

  • _execute_claimed_task()