Skip to content

Workers

GitWire runs 9 background workers powered by BullMQ and Redis, plus a periodic reconciliation job.

Overview

WorkerQueueSource FilePurpose
Webhook Workerwebhook-eventsworkers/webhookWorker.jsRoute incoming webhooks
Triage Workertriageworkers/triageWorker.jsAI issue/PR classification
CI Heal Workerci-healingworkers/ciHealWorker.jsDiagnose and fix CI failures
Sync Workersyncworkers/syncWorker.jsGitHub data synchronization
Maintainer Workermaintainerworkers/maintainerWorker.jsStale scans, branch cleanup
Issue Fix Workerissue-fixworkers/issueFixWorker.jsissueFix/Autonomous code fixes (6-stage pipeline)
Phase 2 Workerphase2workers/phase2Worker.jsMerge queue, error recovery
Phase 3 Workerphase3workers/phase3Worker.jsFlaky tests, deps, policy
Phase 4 Workerphase4workers/phase4Worker.jsAI review, audit trail

Periodic Jobs (not separate workers)

JobScheduleSource FilePurpose
ReconciliationEvery 6 hoursworkers/reconciliationWorker.jsVerify actions still in effect on GitHub
Full SyncEvery 30 minworkers/syncWorker.jsPeriodic GitHub data refresh
Stale ScanEvery 6 hoursworkers/maintainerWorker.jsDetect stale issues/PRs
Branch CleanupDailyworkers/maintainerWorker.jsDelete merged branches
Policy ReconciliationNightlyworkers/phase3Worker.jsPolicy drift detection
Audit ExportNightly 01:00 UTCworkers/phase4Worker.jsAudit trail generation

Architecture

mermaid
graph LR
    WH["POST /webhooks/github"] --> HANDLERS["webhookHandlers/"]
    HANDLERS --> Q2["triage"]
    HANDLERS --> Q3["ci-healing"]
    HANDLERS --> Q4["sync"]
    HANDLERS --> Q5["issue-fix"]
    HANDLERS --> Q6["phase2"]
    HANDLERS --> Q7["phase3"]
    HANDLERS --> Q8["phase4"]
    HANDLERS --> CMDS["commentCommands/"]
    Q2 --> W2["Triage Worker"]
    Q3 --> W3["CI Heal Worker"]
    Q4 --> W4["Sync Worker"]
    Q5 --> W5["Issue Fix Pipeline"]
    Q6 --> W6["Phase 2 Worker"]
    Q7 --> W7["Phase 3 Worker"]
    Q8 --> W8["Phase 4 Worker"]

Queue Configuration

All queues use BullMQ with default settings:

SettingValue
Concurrency1 (per worker)
Attempts3
BackoffExponential
Remove on completeKeep last 100

Starting Workers

Workers start automatically with the main application (src/index.js). All workers run in the same gitwire-app container as the Express API server.

bash
# Check worker health
curl https://gitwire.yourdomain.com/health

The health endpoint lists all active workers and queue statuses.

Error Handling

All worker errors are logged via structured logging (logger.error). Failed jobs are retried up to 3 times with exponential backoff. Empty catches use logger.debug with context explaining why the error is non-critical.

Webhook Worker | Action Lifecycle

Last validated: v0.13.0

Released under the MIT License.