bisect-kit: handle too much skip properly

BUG=b:127452142
TEST=unittest

Change-Id: Id56c150204d3b3463fdf29917cb2bed4b0e9ee4e
Reviewed-on: https://chromium-review.googlesource.com/1516893
Commit-Ready: Kuang-che Wu <kcwu@chromium.org>
Tested-by: Kuang-che Wu <kcwu@chromium.org>
Reviewed-by: Chi-Ngai Wan <cnwan@google.com>
diff --git a/bisect_kit/cli.py b/bisect_kit/cli.py
index b13f7f1..97d4e52 100644
--- a/bisect_kit/cli.py
+++ b/bisect_kit/cli.py
@@ -493,21 +493,13 @@
         logger.info('rev=%s status => %s', rev, self._format_status(status))
         force = False
 
-        self._add_sample(rev, status, values=values)
+        self.states.add_sample(idx, status, values=values)
         self.states.save()
 
         # Bail out if bisection range is unlikely true.
         self.strategy.check_verification_range()
 
-        if status == 'skip':
-          current_state = self.states.get(idx)
-          if current_state['skip'] > (
-              current_state['old'] + current_state['new'] + 1) * 5:
-            raise errors.UnableToProceed(
-                'something wrong, '
-                'unable to evalulate rev=%r (skip) %d times' %
-                (rev, current_state['skip']))
-
+        self.strategy.update(idx, status)
         self.strategy.show_summary()
 
         if step == 'switch' and status == 'skip':
@@ -529,7 +521,7 @@
       self.states.save()
       raise
     finally:
-      if rev:
+      if rev and sum(self.strategy.prob) > 0:
         # progress so far
         old_idx, new_idx = self.strategy.get_range()
         self.states.add_history(