Closes the two M4 P2s: LIMIT 100 safety cap on the per-run stage-I/O query; implements the previously-stubbed get_page() null-wpdb test. QA APPROVE; CI green.
Agent-Session: pipeline-p2-cleanup-merge
Reworks the board into Direction C Mission Brief: status-grouped run list + persistent inspector reusing M4 Stage I/O; stage-list-driven; preserves New Article + polling + filters; column-limit setting restored. QA APPROVE 1034e19; CI green.
Agent-Session: pipeline-board-m5-merge
Relocates Content/AI Models/Sources fields into the per-step Pipeline panels; adds a Global Content Context block; retires the 3 duplicate Settings tabs. Option keys unchanged (no migration). QA APPROVE for 80d8e5f; CI green.
Agent-Session: pipeline-settings-m2-merge
Board submenu now registers at admin_menu priority 11 (parent toplevel at 10)
so the page hook lands under prautoblogger_page_prautoblogger-board; $submenu
reordered defensively to keep Board the first item / top-level click target.
Enqueue gate now matches; board.css/board.js load for the first time on prod.
Regression test: BoardMenuRegistrationTest (fails on pre-fix main).
QA: APPROVE-W-P2 qa-reviews/prautoblogger/2026-06-12-6168520.md
Thread: convo/prautoblogger/threads/2026-06-pipeline-v2-phase2-admin/ seq 11-14
Agent-Session: cto-board-404-hotfix-merge-20260612
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
R1: move phpcs:ignore out of SQL string in class-analysis-prompts.php:81
(same pattern as v0.18.2 cost-reporter fix). GA4 self-improvement loop
has returned empty context on every pipeline run since v0.16.0 — this
restores get_performance_context() to the LLM. Sibling occurrence also
fixed in class-post-assembler.php:112.
R2(a): update_generation_stage() now renews STATUS_TTL on every stage call
so the transient outlasts long LLM calls during background runs.
R2(b): on_ajax_generation_status() detects lock-held-but-transient-gone
when lock age > STATUS_TTL (= Hostinger background-process kill).
Marks stuck run failed, releases lock, returns status:error with
'infrastructure timeout' message. Daily reaper remains the backstop.
R3: when transient absent but lock held within TTL, return status:running
(with started_at from lock) instead of status:idle.
Executor split: class-executor.php was 351 lines (>300). AJAX generation
handlers extracted to new class-generation-status-poller.php (260 lines);
executor now 226 lines. Public hook wiring unchanged via delegation.
Generation_Lock gains get_acquired_at() for R2b/R3 lock-age checks.
Tests: AnalysisPromptsTest (regression SQL + behavioral context shaping),
GenerationStatusPollerTest (R2a TTL renewal, R2b abort, R3 running,
idle path).
Closes: R1 (analysis-prompts SQL), R2 (manual-run resilience), R3 (honest status)
Version: 0.18.3
Agent-Session: prab-v0183-20260612
1. Cost-reporter SQL: phpcs:ignore annotations were embedded inside two SQL
string literals (get_daily_spend, get_spend_by_stage), causing MariaDB to
reject both queries and break the Metrics & Costs admin page. Moved annotations
above the prepare() calls. Regression tests added to CostReporterTest.
2. Collector failure observability: catch block in collect_from_all_sources() now
logs structured meta (model slug, HTTP status parsed from exception message,
first 200 chars of error body) so outage incidents are diagnosable post-hoc.
3. run_stages.agent_role back-write: Pipeline_Runner, Article_Worker, and
Content_Generator were calling Run_Stage_State::start() with agent_role=''.
All start() call sites now pass Stage_Display_Map::default_agent_role(stage).
Role written at INSERT only; ON DUPLICATE KEY UPDATE does not include
agent_role — idempotency-key semantics on resume are unchanged.
4. Runware float deprecation: normalize_seed() applied % to a float
(microtime(true) * 1000), triggering PHP 8 deprecation on every image
generation. Fixed with (int) round(...) before the modulo operator.
Refs: convo/prautoblogger/threads/2026-06-pipeline-v2-phase1/25-cto-v0182-maintenance.md
Agent-Session: prab-v0182-maintenance-20260612
Reasoning models at high effort could spend the entire max_tokens budget
on thinking and return zero visible content with finish_reason=length;
the empty article flowed writer -> editor (reject) -> empty draft post,
with the cost booked as success (2026-06-11 incident: prod run acf24029,
draft post 921; diagnosis: convo pipeline-v2-phase1 seq 12).
- Empty-completion guard at the provider seam (new
OpenRouter_Completion_Guard): empty/whitespace content is a failure;
one retry with reasoning disabled (per-call override) when
finish_reason=length or reasoning was active, then the stage fails.
- finish_reason=length always warning-logged (model, stage, tokens).
- Failed/retried attempts booked to generation_log with
response_status=error + real token burn; run_decisions verdict rows
(retry_reasoning_disabled / failed_empty_completion) for v0.18.0 runs.
- Writer-path guard in Content_Generator::execute_stage and
belt-and-braces empty check in Publisher::create_post.
- Reasoning budget sanity: reasoning.max_tokens cap + completion
headroom via new prautoblogger_reasoning_max_tokens setting (default
constant 2048, 0 = legacy uncapped effort mode); cap replaces effort
when active; governor reservations use the effective ceiling.
- Body assembly moved to Request_Builder::build_body (300-line cap).
- Tests: guard verdict matrix, builder budget shaping, writer/publisher
guards, full provider retry path.
Agent-Session: prab-empty-draft-guard-20260611
* Commit 1: editorial image prompt + style-template setting
Pivot the image pipeline from the single-panel comic style to a text-free
editorial scientific illustration, and replace the Style Suffix setting with
an editable Style Template setting. Commit 1 of the in-plugin editorial image
pipeline (no composer yet; pipeline otherwise unchanged).
- New constant PRAUTOBLOGGER_DEFAULT_IMAGE_STYLE_TEMPLATE (brief §7 editorial
template with the single {{ topic_summary }} token).
- New setting prautoblogger_image_style_template (textarea) replaces the
Style Suffix field; single-token validation on save (brief A5); old
prautoblogger_image_style_suffix mirrored to _deprecated for one cycle and
not deleted (one-time migration prautoblogger_migrated_style_template_v0160).
- REWRITER_SYSTEM_PROMPT now emits a 1-2 sentence editorial topic/mechanism
summary as the SCENE (no comic gag), keeping the CAPTION line for the
unchanged HTML-caption-below-image path; scene/caption parsing contract
preserved.
- New PRAutoBlogger_Image_Template_Filler substitutes the scene into the
template's {{ topic_summary }} slot across all three entry points; strips
control chars + clamps length (A5); degrades safely on missing token or
empty summary so a blank/token-only prompt is never sent to the provider
(A5/A6).
- Version bump 0.15.1 -> 0.16.0 + CHANGELOG + ARCHITECTURE.md updates.
Agent-Session: image-editorial-commit1
* style: auto-fix PHPCS violations via phpcbf
---------
Co-authored-by: peptiderepo <peptiderepo@users.noreply.github.com>
Replace hardcoded model registry with live-sync system.
New PRAutoBlogger_Runware_Model_Catalog class fetches the Runware model
catalog daily, caches in WP options (24h TTL), and falls back to the
hardcoded 15-model list if the API is unavailable. Sync Now button
in PRAdmin for on-demand refresh. Eliminates the drift that caused
silent model fallback bugs (v0.13.8, v0.14.0).
All Runware model selections except schnell and dev were silently falling
back to runware:100@1 because COST_PER_IMAGE only had 2 entries while the
image model registry was expanded to 15 models in v0.13.8.
Fix: add all 15 model IDs to COST_PER_IMAGE and DEFAULT_STEPS.
applySort() always read input_price_per_m for price sorting, but image
models carry cost_per_image instead — input_price_per_m is undefined on
them, so every image model got an effective price of 0 and the sort was a
no-op.
Fix: detect image models via cost_per_image !== undefined and use that
field when present; fall back to input_price_per_m for text models.
Files changed:
- assets/js/model-picker.js — applySort price branch
- prautoblogger.php — version bump 0.13.8 → 0.13.9
- CHANGELOG.md — release notes
35% title + 255px fixed PRAB cols left ~50px per auto column.
Replace with a balanced budget across all columns so Author,
Categories, Tags, and Date all get enough room to render horizontally:
title 22%, author 6%, categories 7%, tags 9%, date 8%,
writing_model/image_model 85px each, cost 50px, peptide_topics 75px
table-layout: fixed ignores min-width — the WP posts list table uses
fixed layout so min-width: 80px had no effect. Changed to width: 80px
which is honoured under fixed-layout tables.
Two bugs in class-post-list-columns.php:
1. Cost always showed $0.00: a PHP '// phpcs:ignore' comment was
placed inside the SQL string literal, causing MariaDB syntax error
on every render_cost_cell() query. Moved comment to the line above
wpdb->prepare() where it belongs.
2. Peptide Topics column header compressed to near-zero width by the
three fixed-width PRAB columns (Writing Model + Image Model + Cost =
255px). Added min-width: 80px to .column-taxonomy-peptide_topic so
the header renders horizontally.
Root cause: .ab-mp-price and .ab-mp-ctx were siblings in .ab-mp-row-meta
with price first. Description text is variable-length, so the meta div
grew/shrank per row, shifting the price left/right.
Fix:
- Move price to last child in .ab-mp-row-meta so its right edge is
always pinned to the row's fixed right edge
- Add flex-shrink: 0 to .ab-mp-price so it never compresses
- Cap .ab-mp-ctx at max-width 200px with text-overflow: ellipsis
- Swap column header order (Context, then Price) to match new DOM order
.ab-mp-col-price was missing min-width and right-alignment even though
.ab-mp-price had both. The header sat left while values sat right,
so they didn't track the same column edge. Added min-width: 90px and
justify-content: flex-end to match.
- Add .ab-mp-col-headers bar between search and list with three
clickable column headers: Model (sorts by name), Price in/out
(sorts by input_price_per_m), Context (sorts by context_length)
- Track sortState at module level so preference persists across
open/close; clicking same column toggles asc/desc
- Deprecated models always sink to bottom regardless of sort column
- Add CSS for .ab-mp-col-headers, .ab-mp-col-header, .ab-mp-sort-arrow,
.ab-mp-col-active; widths mirror existing row flex layout so columns
visually align with data
Bumps version 0.13.1 → 0.13.2
Add min-width: 90px and text-align: right to .ab-mp-price so prices
like $0.0006/image and $0.0800/image stack on a consistent right edge
instead of floating at uneven offsets.
class-autoloader.php listed services/ but not services/opik/. All four Opik classes live in that subdirectory. Composer classmap covered it (tests passed); WP runtime autoloader would fatal in production on first Opik class reference. Adds services/opik/ to the scan list. Bumps to v0.12.3.
Opik requires version 7 UUIDs. wp_generate_uuid4() was producing v4
which the API rejected with 422. Replaced both call sites in
class-opik-trace-context.php with generate_uuid7(), a private static
method implementing RFC 9562 §5.7.
Fixes: smoke test 422 {"errors":["Trace id must be a version 7 UUID"]}
File-level sniffs like WordPress.Files.FileName are evaluated at the file level,
not at code level. They require phpcs:ignore directives to be placed within the
file-level docblock (/** ... */), not in code comments.
Moved all 81 phpcs:ignore pragmas from code comments to the file-level docblocks.
This applies to:
- 79 class files with class-naming convention ignores
- prautoblogger.php with strict-types docblock ignore
- uninstall.php with strict-types docblock ignore
- PRAUTOBLOGGER_VERSION constant now matches header (0.10.1)
- CHANGELOG.md updated to accurately reflect Round 3 work:
* OpenRouter test encryption fix (real class round-trip)
* 137 PHPCS violations resolved with targeted ignores + reasons
* Clear accounting of which categories of violations and why ignored
- Added phpcs:ignore for class file naming convention (79 violations)
WordPress.Files.FileName.InvalidClassFileName is a known architectural
issue — class files use short names without prautoblogger- prefix
- Added phpcs:ignore for ->prepare() table interpolation (56 violations)
WordPress.DB.PreparedSQL.InterpolatedNotPrepared: dynamic table names
(prab_generation_logs, prab_cost_logs) require interpolation; ->prepare()
does not support table name placeholders, only column values
- Fixed file-level docblock positioning (2 violations)
prautoblogger.php and uninstall.php: moved declare(strict_types=1) before
file docblock per PHP best practices
Bump version: 0.10.0 → 0.10.1
Updated CHANGELOG.md with Fixed/Changed entries:
- Missing post_type_exists() stub in BaseTestCase
- PHPCS autofix of 1,362 violations across 75 files
- CI gate flipped to strict mode
Updated ARCHITECTURE.md with ADR #20 documenting the test infra
and PHPCS compliance improvements.
Run phpcbf --standard=WordPress-Core across includes/, prautoblogger.php,
and uninstall.php. Fixed 1,362 formatting violations in 75 files:
- Short array syntax: [] → array()
- Line breaking for long function calls
- Consistent indentation
- Function call parameter alignment
No logic changes; purely mechanical formatting.
- prautoblogger.php: plugin header Version + PRAUTOBLOGGER_VERSION
- CHANGELOG.md: Removed/Changed/Note/Cost impact/Migration sections
- ARCHITECTURE.md:
- drop 4 CF provider files from the file tree
- drop 2 CF credential options from the wp_options table
- drop CF Workers AI row from the External API Integrations table
- flip Phase 3 placeholder from CF Workers AI registry to Runware
- supersede ADR #16 with a one-line history note pointing at v0.10.0
- update ADR #17 tail to mention the removal
readme.txt stable tag is stale (0.2.2) and clearly not maintained
inline with real releases — leaving alone in this PR; fix belongs in
a dedicated release-process cleanup.
Wires out the Cloudflare Workers AI image provider across the plugin:
- class-image-pipeline.php: drop 'cloudflare' dispatch branch; Runware
becomes the unrecognised-provider fallback
- class-image-model-registry.php: remove flux-1-schnell/cloudflare row;
update provider-enum docblocks (runware|openrouter only)
- class-settings-fields-extended.php: remove three CF fields
(cloudflare_ai_token, cloudflare_account_id, cf_image_via_gateway);
drop Cloudflare mention from model-picker + NSFW retry descriptions
- class-admin-page.php: remove prautoblogger_cloudflare_ai_token from
the encrypted-options list
- interface-image-provider.php: retarget preamble @see at Runware +
OpenRouter; update get_provider_name() example
- class-image-nsfw-blocked.php: generalise preamble (Runware +
OpenRouter can raise this)
Also cleans stale CF Workers AI mentions in:
class-ajax-handlers.php, interface-model-registry.php,
class-image-nsfw-retry.php, class-open-router-image-pricing.php,
prautoblogger.php.
The Cloudflare AI Gateway path (in class-open-router-config.php,
class-settings-fields.php 'prautoblogger_ai_gateway_base_url',
class-open-router-request-builder.php cache headers) is intentionally
untouched — it fronts OpenRouter and is unrelated to the CF Workers AI
image provider.