Report and isolate game loading failures (#8604)

This commit is contained in:
2026-07-15 11:35:19 -07:00
committed by GitHub
parent 67dbf928d6
commit 7adc38fe12
@@ -846,7 +846,13 @@ class GamesManager(
case scala.util.Success(inputStream) =>
ProtoParser.parse[RunningGames](inputStream)(using RunningGames) match {
case None =>
SimpleTimedLogger.printLogger.logLine("Failed to parse games.e0es")
val exception = new EagleInternalException("Failed to parse games.e0es")
SimpleTimedLogger.printLogger.logLine(exception.getMessage)
Sentry.withScope { scope =>
scope.setTag("component", "running_games_index_loading")
scope.setTag("storage_file", "games.e0es")
Sentry.captureException(exception): Unit
}
Vector.empty
case Some(runningGames) =>
@@ -1037,6 +1043,12 @@ class GamesManager(
ensureGameLoadedUnsafe(gameId)
catch {
case ex: Exception =>
// A controller is published before text initialization so load-time LLM work can resolve the game. Remove and
// close it if any later initialization step fails; otherwise subsequent requests could observe a partial load.
try unloadGame(gameId): Unit
catch {
case cleanupException: Exception => ex.addSuppressed(cleanupException)
}
// Log loudly to stderr
System.err.println(s"!!! CRITICAL: Failed to load game ${gameId.toHexString}: $ex")
ex.printStackTrace(System.err)
@@ -1044,9 +1056,14 @@ class GamesManager(
s"!!! CRITICAL: Exception loading game ${gameId.toHexString}: $ex"
)
// Send to Sentry for monitoring
Sentry.captureException(ex)
Sentry.withScope { scope =>
scope.setTag("game_id", gameId.toHexString)
scope.setTag("component", "game_loading")
Sentry.captureException(ex): Unit
}
false
}
end try
}
private def requireGameLoadingOutsideManagerLock(): Unit =
@@ -1149,8 +1166,9 @@ class GamesManager(
controllerOpt match {
case None =>
SimpleTimedLogger.printLogger.logLine(s"Failed to load game ${gameId.toHexString} from storage")
false
throw new EagleInternalException(
s"Failed to load game history for ${gameId.toHexString} from storage"
)
case Some(loadedControllerWithResults) =>
// Add to in-memory map BEFORE text handling so isGameValid returns true