fix: Jev legs no longer take stage headlines

Merged
BE
2mo ago
+115-50

Summary

  • foldAuxTokens let a Jev leg claim the bucket Model/Provider — the UI labeled a mostly-LLM stage jev-1.13.0.
  • Non-Jev legs now take the headline from a Jev holder; Jev labels a bucket only when it did all the work.
  • Same rule applied to the MergeStageTokenEntry SQL merge and the recordIntentTokens/recordConventionTokens restamps.

Test plan

  • TestFoldAuxTokens_MixedBucketSemantics updated: non-Jev leg auto-promotes over Jev headline; Jev cannot steal it back
  • go build ./... && go vet ./... && go test ./internal/pipeline/ ./internal/store/... green

Summary by cubic

Jev legs no longer take stage headline labels when a bucket also carries LLM spend; Jev labels a bucket only when it did all the work.

  • Non-Jev legs now take the headline from a Jev holder across foldAuxTokens, the MergeStageTokenEntry SQL merge, and the recordIntentTokens/recordConventionTokens restamps.
  • The SQL merge only promotes the incoming model when the entry carries model-bearing spend, matching the zero-spend early return in foldAuxTokens.
  • Updates TestFoldAuxTokens_MixedBucketSemantics to cover auto-promotion, prevent Jev from reclaiming the headline, and check Provider alongside Model.