{"record":{"id":"a2b0c4e04c9a8046","repo":"JuliusBrussee/caveman","slug":"session-value-promotion-artifact-has-no-actions","errorCode":null,"errorMessage":"session-value promotion artifact has no actions","messagePattern":"session-value promotion artifact has no actions","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"proxy/routing/session_value.go","lineNumber":29,"sourceCode":"\t\"strings\"\n\t\"time\"\n)\n\nconst (\n\tSessionValueArtifactSchema               = \"caveman.router.session-value-policy.v1\"\n\tSessionValueStateSchema                  = \"router-state-metadata-v1\"\n\tSessionValueRouterVersion                = \"session-value-v1\"\n\tSessionValuePromotionMinEffectiveSamples = 100\n\tSessionValuePromotionMaxCalibrationError = 0.10\n\tSessionValuePromotionMaxBrierScore       = 0.25\n)\n\n// ValidateSessionValuePromotionEvidence applies evidence floors beyond\n// structural artifact validity. Runtime may evaluate a structurally valid\n// shadow artifact; traffic promotion requires calibrated sample floors.\nfunc ValidateSessionValuePromotionEvidence(artifact SessionValuePolicyArtifact) error {\n\tif len(artifact.Actions) == 0 {\n\t\treturn errors.New(\"session-value promotion artifact has no actions\")\n\t}\n\tfor _, action := range artifact.Actions {\n\t\tif action.RewardEffectiveSampleSize < SessionValuePromotionMinEffectiveSamples ||\n\t\t\taction.CostEffectiveSampleSize < SessionValuePromotionMinEffectiveSamples ||\n\t\t\taction.QualityCalibrationError > SessionValuePromotionMaxCalibrationError ||\n\t\t\taction.RewardBrierScore > SessionValuePromotionMaxBrierScore {\n\t\t\treturn fmt.Errorf(\"session-value action %s lacks promotion evidence\", action.ActionID)\n\t\t}\n\t}\n\treturn nil\n}\n\nvar sessionValueFeatureVocabulary = map[string]struct{}{\n\t\"turn_index\": {}, \"user_turns\": {}, \"subagent_turns\": {}, \"tool_calls\": {},\n\t\"corrective_turns\": {}, \"input_tokens_estimate\": {}, \"tools_count\": {},\n\t\"stream\": {}, \"json_mode\": {}, \"vision\": {}, \"audio\": {},\n\t\"cache_read_tokens\": {}, \"cache_write_tokens\": {}, \"uncached_tokens\": {},\n\t\"cache_age_ms\": {}, \"spent_session_usd\": {}, \"budget_remaining_usd\": {},","sourceCodeStart":11,"sourceCodeEnd":47,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/766dce6b1394ebb56a3090748d5a0240a5aefb36/proxy/routing/session_value.go#L11-L47","documentation":"ValidateSessionValuePromotionEvidence is the gate from shadow evaluation to live traffic routing. Beyond structural artifact validity it requires per-action evidence floors: at least 100 reward and cost effective samples, quality calibration error <= 0.10, and reward Brier score <= 0.25. An artifact whose Actions slice is empty has nothing promotable and fails immediately with this error before any floor is even evaluated.","triggerScenarios":"Running the promotion check against a shadow-stage artifact generated before any candidate logged outcomes (Actions empty), or against an artifact whose action list was dropped/filtered during generation. Structurally valid artifacts with zero actions are exactly what shadow mode can produce early on.","commonSituations":"Promotion pipeline invoked too early after enabling session-value shadow mode; an artifact generator bug that omits the actions array; promoting the wrong artifact stage (pre-training template instead of trained policy).","solutions":["Keep the artifact in shadow mode until its Actions are non-empty and each clears the floors (>= 100 effective samples, calibration error <= 0.10, Brier <= 0.25).","Regenerate the artifact from the outcome store after shadow traffic has accumulated.","If actions should already exist, debug the artifact generation step that produced an empty list before re-running promotion."],"exampleFix":"// before\nif err := routing.ValidateSessionValuePromotionEvidence(artifact); err != nil {\n\treturn err // aborts promotion on an early shadow artifact\n}\n\n// after\nif len(artifact.Actions) == 0 {\n\treturn fmt.Errorf(\"artifact still in shadow collection: no actions to promote\")\n}\nif err := routing.ValidateSessionValuePromotionEvidence(artifact); err != nil {\n\treturn err\n}","handlingStrategy":"validation","validationCode":"// Before promotion: require actions to exist, and pre-check the floors yourself\n// so operators get a clear 'still shadow' signal instead of a validation error.\nif len(artifact.Actions) == 0 {\n\treturn keepInShadow(artifact) // nothing promotable yet\n}\nfor _, a := range artifact.Actions {\n\tif a.RewardEffectiveSampleSize < routing.SessionValuePromotionMinEffectiveSamples ||\n\t\ta.CostEffectiveSampleSize < routing.SessionValuePromotionMinEffectiveSamples ||\n\t\ta.QualityCalibrationError > routing.SessionValuePromotionMaxCalibrationError ||\n\t\ta.RewardBrierScore > routing.SessionValuePromotionMaxBrierScore {\n\t\treturn keepInShadow(artifact)\n\t}\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Model promotion as a two-stage gate: structural validation first, evidence floors second — and skip promotion while Actions is empty.","Monitor effective-sample counts during shadow mode so you know when promotion becomes possible.","Never hand-craft promotion artifacts; always generate them from the outcome store."],"tags":["routing","promotion","evidence","ml-policy"],"backgroundTag":"insufficient-samples-for-promotion","analyzedSha":"766dce6b1394ebb56a3090748d5a0240a5aefb36","analyzedAt":"2026-08-18T03:14:35.516Z","contentChangedAt":"2026-08-18T03:14:35.516Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}