From cefb398437f4c7a6d80d89d9d49276e36b3e5ccc Mon Sep 17 00:00:00 2001 From: PJ Date: Sat, 18 Apr 2026 02:29:16 +0700 Subject: [PATCH] feat(verifier): retry NextAction up to 16x so gated generators eventually fire --- internal/verifier/worker.go | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/internal/verifier/worker.go b/internal/verifier/worker.go index 8ad6a2e..f55018c 100644 --- a/internal/verifier/worker.go +++ b/internal/verifier/worker.go @@ -113,12 +113,25 @@ func (v *Verifier) EvaluateProperties() map[string]ltl.Verdict { } // NextAction resolves the root action generator into a single Action. -// Returns ErrNoAction when the generator yields nothing actionable. +// Returns ErrNoAction when no branch of the generator produces one after a +// small number of retries. Retrying avoids wedging when most branches of a +// weighted generator produce no action on the current screen (e.g. a gated +// login-phone generator when the app is already past login). func (v *Verifier) NextAction() (Action, error) { if v.actionGenerator == nil { return Action{}, ErrNoAction } - return v.resolveGenerator(v.actionGenerator) + const maxRetries = 16 + for range maxRetries { + action, err := v.resolveGenerator(v.actionGenerator) + if err == nil { + return action, nil + } + if !errors.Is(err, ErrNoAction) { + return Action{}, err + } + } + return Action{}, ErrNoAction } var ErrNoAction = errors.New("verifier: no action available")