Fix submission
The controller consumes a build-scoped FixRequest. It reads every page of the build's observations, selects still-open issues whose opening build matches, and offers each registered executor all of its outstanding items in one Submit call. Different executors may choose different groupings. Their stable, queue-local registration IDs are part of the durable identity; an empty registry disables submission.
The executor returns per-item Submission values once the backend accepts work or the executor deliberately skips it. FixID identifies the backend request or run; it does not indicate repair completion or success. Multiple items and successive calls may share a fix ID. Each returned disposition is retained independently in issue_repair, keyed by queue, opening build, task, unit, and executor. Accepted submissions are retained even alongside an error. Omitted items remain pending; omitting items without an error violates the contract. Invalid, foreign, or duplicate submissions fail processing. One executor's error does not suppress another executor's submission.
Before calling an executor, the controller ensures a pending issue_repair row exists for every offered opening and executor. Empty FixID and SkipReason mean pending; a row's existence does not establish backend acceptance. Returned submissions update those fields after acceptance or a deliberate skip. Existing pending rows are offered again, while submitted and skipped rows restore history without resubmission.
IssueRepair.Metadata is an executor-owned map[string]string stored in the JSON metadata column. Executors read and update it through injected storage; it is absent from Submission. String values may contain serialized JSON, and nil and empty maps are equivalent. Storage uses versioned replacement snapshots: both metadata writers and the controller must preserve other fields and reload before reapplying an edit after ErrVersionMismatch. The controller reloads the latest row before recording a receipt, preserving metadata written during submission. Recorded submission outcomes are never replaced by conflicting receipts.
There is no controller-wide repair cap or batch identity. Executor calls can overlap; pending rows are not exclusive dispatch claims. Implementations must deduplicate by issue opening even after a lost response or a failed local write. Build-level limits belong to host adapters. The legacy build_issue.fix_id field is preserved but does not gate this controller.
Each durable disposition restores its request-history event before being skipped on replay, including after issue closure. Events retain build, task, unit, executor, and accepted fix ID or skip reason. A digest of the opening and executor identifies the occurrence. The legacy request-issue scalar fix field exposes the bytewise least accepted fix ID; complete associations remain in history and issue_repair. Repair submission does not establish issue recovery.
After retaining accepted submission history, normal processing publishes a fix.submitted hook with queue, opening_build_id, task_id, unit_id, and executor_id. Consumers resolve the accepted fix through IssueRepairStore.Get using the opening and executor; the opening build identifies its request. The event identifies backend acceptance, not completion or recovery. Its ID identifies one queue, opening build, task, unit, and executor; its timestamp comes from the retained fix_submitted request log. Publication failures propagate, and normal replay republishes the same event without calling the executor again, including after issue closure. Consumers must tolerate redelivery. Shared backend fix IDs still produce one event per opening and executor; consumers may group those associations. Pending, skipped, and abandoned submissions produce no hook.
Issue tracking publishes another nudge after each nonempty opening pass, so late issues are offered independently of earlier submissions. Queue redelivery rederives pending work and may offer a smaller list. Reopening in another build creates a new identity. A fix ID must reflect actual backend acceptance for every item carrying it; returning an old ID alone does not deliver new work.
The DLQ controller restores all available disposition history without submitting work or publishing hooks. If normal processing exhausts delivery retries before publishing a hook, history reconciliation alone does not deliver that notification. Pending rows and still-open items without repair rows retain fix_submission_abandoned with reason acceptance_unknown. Hosts register this reconciler with unlimited, always-retryable DLQ processing. Executor IDs must remain registered until outstanding history repair completes.