From 10c812d191721db1382a1260a147ef90088c3cae Mon Sep 17 00:00:00 2001 From: peptiderepo Date: Sun, 19 Apr 2026 23:17:13 +0700 Subject: [PATCH] fix: bump API timeout to 180s, surface raw response in error logs (v0.4.8) GLM 4.7 Flash was timing out at 120s on large analysis prompts. Parse failure errors now log the raw LLM response at error level (not debug) so the root cause is always visible. Co-Authored-By: Claude Opus 4.6 --- CHANGELOG.md | 10 ++++++++++ includes/core/class-chief-editor.php | 7 +++++-- includes/core/class-content-analyzer.php | 7 +++++-- prautoblogger.php | 6 +++--- 4 files changed, 23 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ae66ef6..a9fbb04 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,16 @@ All notable changes to PRAutoBlogger will be documented in this file. Format follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project uses [Semantic Versioning](https://semver.org/). +## [0.4.8] — 2026-04-19 + +### Fixed +- **GLM 4.7 Flash timeout during analysis.** The model was timing out at 120s on + large analysis prompts (especially with the new custom instructions). Bumped + API timeout from 120s to 180s. +- **Empty raw response in error logs.** Parse failure errors now include the raw + LLM response inline (first 500 chars) at error level, not debug level, so + the actual failure reason is always visible in the Activity Log. + ## [0.4.7] — 2026-04-19 ### Added diff --git a/includes/core/class-chief-editor.php b/includes/core/class-chief-editor.php index 0d741c3..d7c8d31 100755 --- a/includes/core/class-chief-editor.php +++ b/includes/core/class-chief-editor.php @@ -155,8 +155,11 @@ class PRAutoBlogger_Chief_Editor { $data = PRAutoBlogger_Json_Extractor::decode( $content ); if ( ! is_array( $data ) || ! isset( $data['verdict'] ) ) { - PRAutoBlogger_Logger::instance()->error( 'Chief editor response was not valid JSON. Defaulting to rejected.', 'editor' ); - PRAutoBlogger_Logger::instance()->debug( 'Raw editor response: ' . mb_substr( $content, 0, 500 ), 'editor' ); + PRAutoBlogger_Logger::instance()->error( + 'Chief editor response was not valid JSON. Defaulting to rejected. Raw (first 500 chars): ' + . mb_substr( $content, 0, 500 ), + 'editor' + ); return new PRAutoBlogger_Editorial_Review( [ 'verdict' => 'rejected', 'notes' => 'Editor response could not be parsed.', diff --git a/includes/core/class-content-analyzer.php b/includes/core/class-content-analyzer.php index 6abaf25..b09ade3 100755 --- a/includes/core/class-content-analyzer.php +++ b/includes/core/class-content-analyzer.php @@ -178,8 +178,11 @@ class PRAutoBlogger_Content_Analyzer { private function parse_analysis_response( string $content, array $source_items ): array { $data = PRAutoBlogger_Json_Extractor::decode( $content ); if ( ! isset( $data['patterns'] ) || ! is_array( $data['patterns'] ) ) { - PRAutoBlogger_Logger::instance()->error( 'Analysis response was not valid JSON or missing patterns key.', 'analyzer' ); - PRAutoBlogger_Logger::instance()->debug( 'Raw analysis response: ' . mb_substr( $content, 0, 500 ), 'analyzer' ); + PRAutoBlogger_Logger::instance()->error( + 'Analysis response was not valid JSON or missing patterns key. Raw (first 500 chars): ' + . mb_substr( $content, 0, 500 ), + 'analyzer' + ); return []; } diff --git a/prautoblogger.php b/prautoblogger.php index 04210dc..2ee55ed 100644 --- a/prautoblogger.php +++ b/prautoblogger.php @@ -8,7 +8,7 @@ declare(strict_types=1); * Plugin Name: PRAutoBlogger * Plugin URI: https://peptiderepo.com/prautoblogger * Description: Monitors social media for trending topics, generates SEO-friendly blog posts using AI, and publishes them on a daily schedule with full cost tracking and self-improvement metrics. - * Version: 0.4.7 + * Version: 0.4.8 * Requires at least: 6.0 * Requires PHP: 7.4 * Author: PeptideRepo @@ -35,7 +35,7 @@ if ( ! defined( 'ABSPATH' ) ) { | and limits without magic strings. */ -define( 'PRAUTOBLOGGER_VERSION', '0.4.7' ); +define( 'PRAUTOBLOGGER_VERSION', '0.4.8' ); define( 'PRAUTOBLOGGER_DB_VERSION', '1.1.0' ); define( 'PRAUTOBLOGGER_PLUGIN_FILE', __FILE__ ); define( 'PRAUTOBLOGGER_PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); @@ -45,7 +45,7 @@ define( 'PRAUTOBLOGGER_PLUGIN_BASENAME', plugin_basename( __FILE__ ) ); // API and retry limits — named constants instead of magic numbers. define( 'PRAUTOBLOGGER_MAX_RETRIES', 3 ); define( 'PRAUTOBLOGGER_RETRY_BASE_DELAY_SECONDS', 2 ); -define( 'PRAUTOBLOGGER_API_TIMEOUT_SECONDS', 120 ); +define( 'PRAUTOBLOGGER_API_TIMEOUT_SECONDS', 180 ); define( 'PRAUTOBLOGGER_CACHE_TTL_SECONDS', 3600 ); // Default models for OpenRouter (user can override in settings).