Skip to content

[V2] Batch resume: Handle file conflicts from previous runs via orchestration escalation #297

Description

@frankbria

Problem

When retrying failed tasks or resuming a batch, individual coding agents fail with "File already exists" errors because previous runs created files that the agent's plan expects to create.

Current behavior: Agent fails immediately with executor error, no recovery attempted.

Expected behavior: Agent should escalate to orchestration layer which has context about:

  • What files exist from previous runs
  • Whether those files should be overwritten or edited instead of created
  • The overall state of the workspace

Root Cause

The individual coding agents don't have awareness of the workspace state from previous runs. They generate plans assuming a clean slate. When they encounter existing files, they fail rather than adapting.

Proposed Solution

  1. Orchestration-level handling: When an agent encounters "File already exists", it should escalate to the main orchestrator rather than failing outright.

  2. Orchestrator context: The orchestrator should:

    • Track which files were created/modified by previous runs
    • Provide this context to agents on retry
    • Instruct agents to use "edit" operations instead of "create" for existing files
  3. Tactical pattern: Add "File already exists" to the supervisor's tactical patterns so it can intervene and provide guidance.

Example Error

[DIAG] Agent FAILED - analyzing for supervisor intervention
[DIAG] Last step result: status=ExecutionStatus.FAILED, error=File already exists: src/task_tracker/exceptions.py
[DIAG] Matched tactical patterns: []  # <-- Should match a pattern here
[DIAG] No supervisor intervention - error_msg empty=False, no pattern match=True

Acceptance Criteria

  • "File already exists" errors trigger supervisor intervention
  • Supervisor provides agent with list of existing files from previous runs
  • Agent adjusts plan to use edit operations for existing files
  • Batch resume successfully continues where previous run left off

Labels

enhancement, agent-system, batch-execution

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