name: coding_harness
version: "1.0"
description: "Coding pipeline with adversarial review loop - Worker ↔ Verifier 对抗闭环"

stages:
  # 阶段 1：Developer 编写代码
  - name: develop
    agent: developer_agent
    action: implement_feature
    outputs:
      - code
      - test_files
    timeout_seconds: 600
    retry_count: 1

  # 阶段 2：Tester 运行测试
  - name: test
    agent: tester_agent
    action: run_tests
    depends_on:
      - develop
    inputs:
      code: "${develop.code}"
      test_files: "${develop.test_files}"
    outputs:
      - test_results
    timeout_seconds: 300
    retry_count: 2

  # 阶段 3：代码审查（对抗模式）
  # Worker (developer_agent) 产出 → Verifier (code_reviewer) 审查 → 不通过则打回修复
  - name: review
    agent: developer_agent
    action: fix_code_issues
    verifier: code_reviewer
    depends_on:
      - test
    max_adversarial_rounds: 3
    verifier_timeout_seconds: 120
    feedback_mode: "structured+natural"
    escalate_on_exhaust: human_approval
    inputs:
      code: "${develop.code}"
      test_results: "${test.test_results}"
    outputs:
      - final_code
      - review_report
    timeout_seconds: 900

  # 阶段 4：归档提交
  - name: archive
    agent: archiver_agent
    action: commit_and_push
    depends_on:
      - review
    inputs:
      code: "${review.final_code}"
    timeout_seconds: 120
    continue_on_failure: false

variables:
  target_branch: main
  require_approval: true
  commit_message_prefix: "feat"
