Skip to content

feat(foreman): opt-in coder escalation on capability-wall failures (#1108)#1128

Open
Defilan wants to merge 1 commit into
defilantech:mainfrom
Defilan:finalize/1108-escalate
Open

feat(foreman): opt-in coder escalation on capability-wall failures (#1108)#1128
Defilan wants to merge 1 commit into
defilantech:mainfrom
Defilan:finalize/1108-escalate

Conversation

@Defilan

@Defilan Defilan commented Jul 14, 2026

Copy link
Copy Markdown
Member

What

Adds Workload.spec.escalateOnFailure (default false). When set and escalationCoderAgentRef is configured, a terminal STUCK-LOOP-DETECTED, INCOMPLETE, or ERROR from the base coder also re-attempts the issue on the escalation coder — not just a capability NO-GO.

Why

Today escalation fires only on a capability NO-GO. The failure modes where a mid-size coder actually hits its ceiling (stuck-loop, model-decided INCOMPLETE, harness ERROR) leave the Workload dead with no usable branch, waiting for a human to hand-queue a retry on a bigger model. On a heterogeneous fleet (small fast coder + larger fallback), an unattended batch should keep making progress. (Live example: a batch run stuck-looped on one issue with no branch — exactly what this automates.)

How

  • Workload.spec.escalateOnFailure *bool on WorkloadSpec, default off preserves today's NO-GO-only behavior.
  • New shouldEscalateCoderOnFailure helper: true for STUCK-LOOP-DETECTED / ERROR (topOutcome strings) and INCOMPLETE (verdict); ALWAYS false for ALREADY-RESOLVED and NEEDS-VERIFICATION.
  • Wired into coderEscalationSteps: escalate on the existing NO-GO trigger OR (opt-in + failure trigger). Still gated on escalationCoderAgentRef != nil, so single-model fleets are unaffected. A distinct condition reason surfaces why the escalation fired.
  • No new AgenticTaskVerdict enum values (STUCK-LOOP/ERROR are outcome strings, not verdicts).

Testing

  • Pure controller-logic unit tests (no envtest): TestShouldEscalateCoderOnFailure plus TestCoderEscalationSteps_EscalateOnFailure_{True,False,NeverEscalate,Mixed}; existing NO-GO / off-when-unset cases still pass.
  • go build, go vet clean; make manifests && make generate && make foreman-chart-crds produce no drift.

Checklist

  • Unit tests (no envtest)
  • CRD regen (incl. make foreman-chart-crds) with no drift
  • DCO sign-off
  • Fixes #1108

AI assistance

Implemented via the Foreman agentic-coding harness (GO), then rebased onto current main, verified, and finalized by the author. Band-3 disclosure per the project's AI-assisted contribution policy.

Fixes #1108

…efilantech#1108)

Add Workload.spec.escalateOnFailure (default false, preserving today's
NO-GO-only escalation). When set and escalationCoderAgentRef is configured, a
terminal STUCK-LOOP-DETECTED, INCOMPLETE, or ERROR from the base coder also
re-attempts the issue on the escalation coder, so an unattended heterogeneous
fleet keeps making progress instead of stalling for a human. ALREADY-RESOLVED
and NEEDS-VERIFICATION never escalate; a distinct condition reason surfaces why
the escalation fired.

Fixes defilantech#1108

Signed-off-by: Christopher Maher <chris@mahercode.io>
@Defilan Defilan requested a review from joryirving July 14, 2026 23:39
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.

[FEATURE] Opt-in coder escalation on capability-wall failures (stuck-loop / INCOMPLETE / ERROR)

1 participant