A few NFCs for config querying and crash replaying.

 * Return a failure instead of check on the serailized config querying status, because bad query status is not a bug in Centipede.
 * Pick runner mode over the path of replaying in current process, which invokes the Centipede controller - we should not invoke the controller in the runner mode.

PiperOrigin-RevId: 933058037
diff --git a/centipede/centipede_interface.cc b/centipede/centipede_interface.cc
index 386e922..0a3917c 100644
--- a/centipede/centipede_interface.cc
+++ b/centipede/centipede_interface.cc
@@ -775,7 +775,11 @@
     }();
     Environment updated_env = env;
     if (updated_env.fuzztest_corpus_database.empty()) {
-      FUZZTEST_CHECK_OK(serialized_target_config.status());
+      if (!serialized_target_config.ok()) {
+        FUZZTEST_LOG(ERROR) << "Failed to get the serialized target config: "
+                            << serialized_target_config.status();
+        return EXIT_FAILURE;
+      }
       if (!serialized_target_config->empty()) {
         const auto target_config =
             fuzztest::internal::Configuration::Deserialize(
diff --git a/fuzztest/internal/centipede_adaptor.cc b/fuzztest/internal/centipede_adaptor.cc
index bc505a6..bfd67dc 100644
--- a/fuzztest/internal/centipede_adaptor.cc
+++ b/fuzztest/internal/centipede_adaptor.cc
@@ -390,6 +390,8 @@
 
 int RunCentipede(const Environment& env,
                  const std::optional<std::string>& centipede_command) {
+  FUZZTEST_CHECK(!IsCentipedeRunner())
+      << "Unexpected RunCentipede() in runner mode.";
   if (Runtime::instance().termination_requested()) {
     absl::FPrintF(GetStderr(),
                   "Not running Centipede due to termination requested - "
@@ -908,11 +910,6 @@
           CentipedeSetFailureDescription(std::string{crash_type}.c_str());
         });
   }
-  if (!configuration.corpus_database.empty() &&
-      configuration.crashing_input_to_reproduce.has_value() &&
-      configuration.replay_in_single_process) {
-    return ReplayCrashInSingleProcess(configuration);
-  }
   if (runner_mode) {
     std::optional<int> result;
     fuzzer_impl_.fixture_driver_->RunFuzzTest([&, this]() {
@@ -928,7 +925,13 @@
     FUZZTEST_CHECK(result.has_value())
         << "No result is set for running fuzz test";
     return *result == EXIT_SUCCESS;
-  } else if (is_running_property_function_in_this_process) {
+  }
+  if (!configuration.corpus_database.empty() &&
+      configuration.crashing_input_to_reproduce.has_value() &&
+      configuration.replay_in_single_process) {
+    return ReplayCrashInSingleProcess(configuration);
+  }
+  if (is_running_property_function_in_this_process) {
     // If `is_running_property_function_in_this_process` holds at this point. We
     // assume it is for `ReplayInputsIfAvailable` to handle `FUZZTEST_REPLAY`
     // and `FUZZTEST_MINIMIZE_REPRODUCER`, which Centipede does not support.