Skip to content

Comments

Replace campaign fusion with first-class dispatch-only workers#11087

Merged
mnkiefer merged 8 commits intomainfrom
copilot/make-campaign-workers-first-class
Jan 21, 2026
Merged

Replace campaign fusion with first-class dispatch-only workers#11087
mnkiefer merged 8 commits intomainfrom
copilot/make-campaign-workers-first-class

Conversation

Copy link
Contributor

Copilot AI commented Jan 21, 2026

Campaign Worker Refactoring - Make Workers First-Class Campaign Workers

Summary

Successfully implemented the campaign worker refactoring per the problem statement. The fusion approach has been completely removed and replaced with comprehensive documentation for first-class campaign workers.

Completed Tasks

  • Explore repository structure and understand campaign architecture
  • Understand current fusion approach and how it's used
  • Identify worker workflow structure and input contracts
  • Remove fusion approach (deleted workflow_fusion.go, tests, and docs)
  • Create comprehensive campaign worker documentation
  • Update worker workflow documentation for dispatch-only pattern
  • Update orchestrator generation documentation
  • Add idempotency guidance to campaign documentation
  • Update campaign specs/templates
  • Run validation (formatting, linting all passed)
  • Verify documentation completeness
  • Fix invalid documentation links

Changes Implemented

1. Removed Fusion Approach ✅

Deleted files:

  • pkg/campaign/workflow_fusion.go - Fusion implementation
  • pkg/campaign/workflow_fusion_test.go - Fusion tests
  • docs/campaign-worker-fusion.md - Fusion documentation

No remaining fusion references in codebase.

2. Created Comprehensive Worker Documentation ✅

New file: docs/campaign-workers.md (375 lines)

Complete guide covering:

  • First-class worker pattern principles
  • Standardized input contract (campaign_id, payload)
  • 4 idempotency implementation patterns:
    1. Branch-based idempotency
    2. PR title-based idempotency
    3. Cursor-based tracking
    4. Issue title-based idempotency
  • Worker template with full example
  • Testing guidelines
  • Best practices
  • Migration guide from fusion approach

3. Updated Campaign Architecture Documentation ✅

Updated: specs/campaigns-files.md (+350 lines)

Added comprehensive Campaign Workers section:

  • Worker design principles (dispatch-only, standardized contract, idempotent, orchestration-agnostic)
  • Worker workflow template
  • Idempotency requirements and patterns
  • Worker discovery mechanisms
  • Example security fix worker
  • Best practices

4. Updated Campaign Examples ✅

Updated: docs/src/content/docs/examples/campaigns.md

Changes:

  • Removed all fusion references
  • Updated to dispatch-only pattern requirements
  • Clarified worker ownership model
  • Updated folder organization guidance
  • Added idempotency requirements section
  • Fixed invalid documentation links

5. Updated Orchestrator Instructions ✅

Updated: .github/aw/execute-agentic-campaign-workflow.md

Changes:

  • Workers now dispatch-only with standardized inputs
  • Updated worker creation template
  • Added testing requirements
  • Documented orchestration guidelines (input construction, idempotency, failure handling)
  • Explained key differences from fusion approach
  • Added section on migration from fusion

6. Fixed Documentation Links ✅

Fixed in this commit:

  • docs/campaign-workers.md: Corrected paths to Campaign Examples and Safe Outputs documentation
  • docs/src/content/docs/examples/campaigns.md: Removed invalid link to campaign-workers (file not in docs site structure)

Key Implementation Details

Worker Pattern Requirements

  1. Dispatch-only triggers

    on:
      workflow_dispatch:
        inputs:
          campaign_id:
            description: 'Campaign identifier'
            required: true
            type: string
          payload:
            description: 'JSON payload with work item details'
            required: true
            type: string
  2. Idempotency via deterministic keys

    Format: campaign-{campaign_id}-{repository}-{work_item_id}
    
  3. Labeling for discovery

    Label format: campaign:{campaign_id}
    

Idempotency Patterns Documented

  1. Branch-based: Deterministic branch names prevent duplicate PRs
  2. PR title-based: Key in PR title enables duplicate detection
  3. Cursor-based: Track processed items in repo-memory
  4. Issue title-based: Key in issue title for deduplication

Benefits Over Fusion

  • Unambiguous ownership: Workers are explicitly orchestrated, not autonomous
  • No duplicate execution: Eliminates trigger precedence confusion
  • Explicit orchestration: Policy kept in orchestrator, not scattered in workers
  • Simple, deterministic units: Workers are stateless, focused, testable
  • Prevents "original triggers vs orchestrator" problem: No conflicting triggers

Testing & Validation

  • ✅ All campaign package tests pass
  • ✅ Code formatting validated
  • ✅ JavaScript linting passed
  • ✅ No remaining fusion references in codebase
  • ✅ Documentation is comprehensive and complete
  • ✅ All documentation links verified

Documentation Structure

docs/
├── campaign-workers.md          # Complete worker pattern guide
└── src/content/docs/
    ├── examples/
    │   └── campaigns.md         # Dispatch-only examples
    ├── guides/
    │   └── campaigns/           # Campaign setup guides
    └── reference/
        └── safe-outputs.md      # Safe outputs reference

specs/
└── campaigns-files.md           # Worker architecture section

.github/aw/
└── execute-agentic-campaign-workflow.md  # Orchestration instructions

Conclusion

This implementation fully addresses all requirements from the problem statement:

  1. Workers are dispatch-only - No schedule/push/pull_request triggers
  2. Standardized input contract - campaign_id + payload (JSON)
  3. Idempotency built-in - 4 patterns documented with examples
  4. Fusion discarded - Completely removed from codebase
  5. Orchestration explicit - Policy stays in orchestrator, not workers

The campaign system now has first-class workers with clear contracts, idempotent behavior, and explicit orchestration - solving the duplicate execution problem and making ownership unambiguous.

Original prompt

For campaigns, make workers first-class “campaign workers” and keep orchestration concerns explicit, rather than relying on fusion as a permanent crutch.

  1. Make worker workflows dispatch-only entrypoints
    Update the source worker workflows so they are designed to be run by an orchestrator:
    on: workflow_dispatch as the primary/only trigger (for campaign-owned execution)
    no schedule/push/pull_request triggers for those workers
    This makes ownership unambiguous and avoids the “original triggers vs orchestrator” duplicate-execution problem entirely.

  2. Standardize a stable input contract across all workers
    Adopt a small shared schema so the orchestrator can drive any worker consistently:
    campaign_id (string)
    payload (string; JSON)
    Workers parse payload and do their job. This avoids per-worker bespoke input evolution and avoids coupling to github.event.* shapes.

  3. Build idempotency into workers (or a shared library pattern)
    To prevent duplicate PRs/issues over repeated orchestrator runs, enforce a convention:
    compute a deterministic work item key (per target repo + task)
    use it in branch names / PR titles / issue titles
    check for existing PR/issue with that key + tracker label before creating
    if exists: skip or update
    This is the real long-term fix for “duplicate work items”; fusion and trigger changes don’t solve this alone.

  4. Discard fusion approach

  5. Encode orchestration policy in the orchestrator (not in each worker)
    Sequential vs parallel is an orchestration concern. Keep it in the orchestrator generator/logic, and have workers be simple, deterministic units.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 3 commits January 21, 2026 20:34
Co-authored-by: mnkiefer <8320933+mnkiefer@users.noreply.github.com>
Co-authored-by: mnkiefer <8320933+mnkiefer@users.noreply.github.com>
Co-authored-by: mnkiefer <8320933+mnkiefer@users.noreply.github.com>
Copilot AI changed the title [WIP] Update workers to be first-class campaign workers Replace campaign fusion with first-class dispatch-only workers Jan 21, 2026
Copilot AI requested a review from mnkiefer January 21, 2026 20:49
@mnkiefer mnkiefer marked this pull request as ready for review January 21, 2026 20:58
@mnkiefer
Copy link
Contributor

@copilot Remove invalid link from docs

Co-authored-by: mnkiefer <8320933+mnkiefer@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jan 21, 2026

@copilot Remove invalid link from docs

Fixed invalid links in documentation. Changes in commit 46dcaab:

docs/campaign-workers.md:

  • Fixed path to Campaign Examples (removed extra ./docs/ prefix)
  • Fixed path to Safe Outputs (changed from guides/ to reference/)

docs/src/content/docs/examples/campaigns.md:

  • Removed invalid link to /gh-aw/campaign-workers/ (file not in docs site structure)

All remaining links have been verified to point to existing files.

Copilot AI requested a review from mnkiefer January 21, 2026 21:41
@mnkiefer mnkiefer merged commit 811568c into main Jan 21, 2026
84 checks passed
@mnkiefer mnkiefer deleted the copilot/make-campaign-workers-first-class branch January 21, 2026 21:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants