fix(planning): consult the plan model only when no deterministic strategy applies
Propose built every strategy to record the alternatives, and the model strategy's build is a live call to the plan role, so planning a direct action spent a model call on an alternative that could never be selected (B2, docs/planning.md). The model is now recorded as "not consulted" once a deterministic draft is chosen, and the approver's reason no longer lists it among the alternatives considered. A test counts the calls both ways.
This commit is contained in:
@@ -78,6 +78,13 @@ func (p *Planner) Propose(ctx context.Context, it volition.Intention, previous [
|
||||
alts = append(alts, Alternative{Strategy: s.name, Description: "tried in an earlier revision", Why: "already failed"})
|
||||
continue
|
||||
}
|
||||
if s.name == "model" && chosen != nil {
|
||||
// A model is consulted only when no deterministic strategy
|
||||
// applies; building it here would spend a live call on an
|
||||
// alternative that cannot be selected.
|
||||
alts = append(alts, Alternative{Strategy: s.name, Description: "model decomposition", ExpectedConfidence: s.confidence, Why: "not consulted: a deterministic strategy applies"})
|
||||
continue
|
||||
}
|
||||
d, err := s.build()
|
||||
if err != nil {
|
||||
alts = append(alts, Alternative{Strategy: s.name, Description: err.Error(), Why: "not buildable"})
|
||||
|
||||
Reference in New Issue
Block a user