Skip to content

[FEATURE] Epic: Sliced Workloads: contract-pinned decomposition + reconcile in Foreman #1033

Description

@Defilan

Feature Description

Graduate the validated slicer/integrator into Foreman as Sliced Workloads: slice one hard issue into disjoint-file slices, dispatch each as a normal coder task, union the results, and reconcile the union against a pinned contract so cross-slice interface drift that a green build cannot see is caught.

This tracks the productization of the experiment that was validated end to end on #700 and #1001. In both, three disjoint slices built clean and green, yet the slices had drifted on shared identifiers (a dashboard querying metric names an exporter never emitted; a broken kube-state-metrics config). A deterministic pinned-identifier check caught the drift the build missed; an LLM sweep corroborated it.

v1 scope: detection + prevention. The reconcile step surfaces drift (fails the Workload, drift list in status) for a human to adjudicate. Automated repair is explicitly deferred to a follow-up (see Additional Context).

Problem Statement

As a fleet operator, I want to hand Foreman one multi-part issue and get a decomposed, interface-consistent PR back from local models, so that mid-size sovereign coders can complete work that they fail as a single whole.

Mid-size local models flunk whole issues but nail small slices. Decomposition works, and disjoint-file slices union cleanly, but the union is blind to semantic interface drift between slices. The pinned contract plus a reconcile pass is the fix. Today it only exists as throwaway scaffolding; it is not usable from Foreman.

Proposed Solution

llmkube slice <issue> runs a planner that emits a pinned SlicePlan (contract + shared_identifiers + disjoint slices), renders a Workload, and applies it. The controller runs the existing PipelineStep DAG with two new task kinds.

# rendered by `llmkube slice 1001`
apiVersion: foreman.llmkube.dev/v1alpha1
kind: Workload
spec:
  pipeline:
    - {name: crs-config, kind: issue-fix, ...}       # disjoint slice
    - {name: dashboard, kind: issue-fix, ...}         # disjoint slice
    - {name: alerts, kind: issue-fix, ...}            # disjoint slice
    - {name: integrate, kind: integrate, dependsOn: [crs-config, dashboard, alerts]}
    - {name: reconcile, kind: reconcile, dependsOn: [integrate]}   # pins in payload
  • integrate (new kind): union the disjoint slice branches onto the current base, push the integration branch, gate = build; fail on overlap / apply-conflict.
  • reconcile (new kind): run the pinned-identifier check + LLM sweep on the union against shared_identifiers.
  • Verdict semantics (validated): pinned-missing (authoritative) -> GATE-FAIL -> Workload review-failed; llm-flagged-only (advisory) -> GATE-PASS + status annotation, does not fail.

No new CRD: the pins ride in the reconcile step payload. The reconcile logic ports to Go under pkg/foreman/slicer/.

Task breakdown

  • 1. pkg/foreman/slicer/reconcile.go + tests: Go port of pinned_check (whole-token match) + llm_sweep (injected model client, degrade-open) + Reconcile. Pure library.
  • 2. pkg/foreman/slicer/integrate.go + tests: disjoint union onto base with overlap / apply-conflict guards.
  • 3. API: add integrate + reconcile to AgenticTaskKind + payload fields; make manifests + chart-crds.
  • 4. Executor wiring for the two kinds + reconcile verdict mapping.
  • 5. Controller rollup: reconcile verdict -> Workload review-failed.
  • 6. CLI llmkube slice (planner + SlicePlan + Workload render + --dry-run).
  • 7. e2e: fixture-repo sliced Workload (clean -> Succeeds; injected drift -> review-failed).

Alternatives Considered

  • Reconcile folded into the integrate step's gate rather than a separate kind: fewer kinds, but muddier verdicts. Chose two kinds.
  • A first-class SlicePlan CRD rather than pins-in-payload: more visible/reusable, more surface. Chose no-CRD for v1; promote if a second consumer appears.
  • Controller-side dynamic planning (apply a thin issue-ref Workload, controller plans + expands at runtime): fully hands-off, but requires runtime pipeline mutation. Deferred; v1 is CLI-driven.

Additional Context

Priority

  • High - Would significantly improve my workflow

Willingness to Contribute

  • Yes, I can submit a PR

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/foremanForeman: the agentic fleet orchestrator add-onenhancementNew feature or requestkind/featureNew feature or requestpriority/highHigh prioritysize/largeLarge effort (> 3 days)

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions