fix: document STATUS_TTL/API_TIMEOUT/MAX_RETRIES safety invariant (v0.18.3)

Add comment at the PRAUTOBLOGGER_MAX_RETRIES + PRAUTOBLOGGER_API_TIMEOUT_SECONDS
constant definitions documenting the dependency:

  API_TIMEOUT_SECONDS × MAX_RETRIES (540s) must stay < STATUS_TTL (600s)

Current product: 180s × 3 = 540s — 60s margin. Prevents constant-drift
regression: raising either constant without checking the inequality could cause
a fully-retrying LLM call to exhaust the status-transient TTL within a single
stage, triggering a false orphan-run abort (R2b path in poller).

Agent-Session: prab-v0183-20260612
This commit is contained in:
peptiderepo
2026-06-12 03:51:43 +00:00
committed by peptiderepo
parent 952344ff5f
commit dd1c38b6cf

View File

@@ -42,6 +42,11 @@ define( 'PRAUTOBLOGGER_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
define( 'PRAUTOBLOGGER_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
define( 'PRAUTOBLOGGER_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
// API and retry limits — named constants instead of magic numbers.
// SAFETY INVARIANT: API_TIMEOUT_SECONDS × MAX_RETRIES must stay < STATUS_TTL (600s,
// defined in PRAutoBlogger_Generation_Status_Poller). The current product
// (180s × 3 = 540s) leaves a 60s margin. If either constant is raised, verify the
// inequality still holds — otherwise a fully-retrying LLM call can exhaust the
// status transient TTL within a single stage and trigger a false orphan-run abort.
define( 'PRAUTOBLOGGER_MAX_RETRIES', 3 );
// Pipeline v2 Phase 1 (v0.18.0) defaults. Both are SETTINGS-backed at every
// read site (prautoblogger_per_run_cost_ceiling_usd /