JuliusBrussee/caveman · error

session-value artifact must require turn_index

Error message

session-value artifact must require turn_index

What it means

Among the feature specs, turn_index must be marked Required: true. The evaluator treats turn_index as always-present session metadata; an artifact that marks it optional would change missing-value semantics for every downstream model, so validation rejects it.

Source

Thrown at proxy/routing/session_value.go:199

		return errors.New("session-value artifact outside validity window")
	}
	if artifact.RollbackParentHash != "" && (!validSHA256Ref(artifact.RollbackParentHash) || artifact.RollbackParentHash == artifact.ArtifactHash) {
		return errors.New("session-value artifact rollback lineage invalid")
	}
	if !finite(artifact.QualityUncertaintyZ) || artifact.QualityUncertaintyZ <= 0 || artifact.QualityUncertaintyZ > 5 ||
		!finite(artifact.MaxInversePropensity) || artifact.MaxInversePropensity < 1 || artifact.MaxInversePropensity > 100 {
		return errors.New("session-value artifact confidence policy invalid")
	}
	featureNames := SessionValueFeatureNames()
	if len(artifact.FeatureSpecs) != len(featureNames) || len(artifact.Actions) == 0 {
		return errors.New("session-value artifact has no features or actions")
	}
	for i, spec := range artifact.FeatureSpecs {
		if spec.Name != featureNames[i] || (i > 0 && artifact.FeatureSpecs[i-1].Name >= spec.Name) {
			return errors.New("session-value artifact feature vocabulary or order invalid")
		}
		if spec.Name == "turn_index" && !spec.Required {
			return errors.New("session-value artifact must require turn_index")
		}
		if !finite(spec.Mean) || !finite(spec.Scale) || spec.Scale <= 0 || !finite(spec.Min) || !finite(spec.Max) || spec.Min < 0 || spec.Max < spec.Min {
			return fmt.Errorf("session-value feature %q bounds invalid", spec.Name)
		}
	}
	seenActions := map[string]struct{}{}
	artifactPool := make([]Candidate, 0, len(artifact.Actions))
	for i, action := range artifact.Actions {
		wantID := CandidateActionID(Candidate{Provider: action.Provider, Model: action.Model, Effort: action.Effort})
		if wantID == "" || action.ActionID != wantID || (i > 0 && artifact.Actions[i-1].ActionID >= action.ActionID) {
			return errors.New("session-value artifact action identity or order invalid")
		}
		if _, duplicate := seenActions[action.ActionID]; duplicate {
			return errors.New("session-value artifact duplicate action")
		}
		seenActions[action.ActionID] = struct{}{}
		artifactPool = append(artifactPool, Candidate{Provider: action.Provider, Model: action.Model, Effort: action.Effort})
		if !finite(action.RewardEffectiveSampleSize) || action.RewardEffectiveSampleSize <= 0 ||

View on GitHub (pinned to 766dce6b13)

Solutions

  1. Set Required: true on the turn_index spec during artifact generation.
  2. Add a trainer-side check that exactly the intended features are Required, with turn_index among them.
  3. Re-seal the artifact after fixing the flag so ArtifactHash covers the correction.

Example fix

// before
{"name": "turn_index", "required": false}

// after
{"name": "turn_index", "required": true}
Defensive patterns

Strategy: validation

Validate before calling

// Before validation: turn_index must exist and be Required.
func turnIndexRequired(specs []routing.SessionValueFeatureSpec) bool {
	for _, spec := range specs {
		if spec.Name == "turn_index" {
			return spec.Required
		}
	}
	return false
}

Prevention

When it happens

Trigger: A trainer that marks no feature as Required (the Go bool zero value false survives JSON round-trips); hand-editing the required flag off; a schema migration that drops the 'required' JSON key so it unmarshals as false.

Common situations: Generators that never set Required on any spec; feature-schema refactors that lose per-feature flags; copy-transform pipelines that rebuild structs field-by-field and skip booleans.

Related errors


AI-assisted analysis of JuliusBrussee/caveman@766dce6b13 (2026-08-18). Data as JSON: /api/errors/4c6c72624ae4aacf. Report an issue: GitHub.