fix(phase2b): Authority hold-on-quorum-miss no longer crashes + pipeline_mode label (#184, v0.32.2)
Canary-found P1: hold with empty content (research quorum miss) recorded a HOLD decision without calling Publisher (no more empty-content RuntimeException → run held, not failed). Content-present holds unchanged. Authority posts now labelled pipeline_mode=authority. QA APPROVE f759d75; CI green (phpcs+phpunit VPS-verified). Agent-Session: prab-phase2b-holdfix-merge
This commit is contained in:
@@ -12,21 +12,21 @@ declare(strict_types=1);
|
||||
* beyond what the individual stage classes already require.
|
||||
*
|
||||
* Who triggers it: PRAutoBlogger_Authority_Pipeline (P2b.4).
|
||||
* Dependencies: All P2b.1–P2b.3 stage classes + Content_Generator,
|
||||
* Dependencies: All P2b.1-P2b.3 stage classes + Content_Generator,
|
||||
* Publisher, Image_Pipeline, Run_Stage_State, Audit_Writer.
|
||||
*
|
||||
* @see core/class-authority-pipeline.php — Orchestrator that calls these helpers.
|
||||
* @see ARCHITECTURE.md — Phase 2b data flow.
|
||||
* @see core/class-authority-pipeline.php -- Orchestrator that calls these helpers.
|
||||
* @see ARCHITECTURE.md -- Phase 2b data flow.
|
||||
*/
|
||||
class PRAutoBlogger_Authority_Pipeline_Stages {
|
||||
|
||||
/**
|
||||
* Run the research fan-out stage.
|
||||
*
|
||||
* @param string $run_id Pipeline run UUID.
|
||||
* @param string $item_key Article-scoped item key.
|
||||
* @param PRAutoBlogger_Article_Idea $idea The idea being researched.
|
||||
* @param PRAutoBlogger_Cost_Tracker $cost_tracker Pipeline cost tracker.
|
||||
* @param string $run_id Pipeline run UUID.
|
||||
* @param string $item_key Article-scoped item key.
|
||||
* @param PRAutoBlogger_Article_Idea $idea The idea being researched.
|
||||
* @param PRAutoBlogger_Cost_Tracker $cost_tracker Pipeline cost tracker.
|
||||
* @param PRAutoBlogger_Research_Fanout $fanout Fan-out instance.
|
||||
* @return array<int, array{sources: array, agent_role: string}> Per-agent results, or empty on quorum miss.
|
||||
*/
|
||||
@@ -37,7 +37,7 @@ class PRAutoBlogger_Authority_Pipeline_Stages {
|
||||
PRAutoBlogger_Cost_Tracker $cost_tracker,
|
||||
PRAutoBlogger_Research_Fanout $fanout
|
||||
): array {
|
||||
PRAutoBlogger_Pipeline_Status::broadcast( __( 'Authority: running specialist research fan-out…', 'prautoblogger' ) );
|
||||
PRAutoBlogger_Pipeline_Status::broadcast( __( 'Authority: running specialist research fan-out...', 'prautoblogger' ) );
|
||||
PRAutoBlogger_Run_Stage_State::start( $run_id, 'research', 'researcher', $item_key );
|
||||
$results = $fanout->dispatch( $run_id, $item_key, $idea, $cost_tracker );
|
||||
if ( ! empty( $results ) ) {
|
||||
@@ -51,10 +51,10 @@ class PRAutoBlogger_Authority_Pipeline_Stages {
|
||||
/**
|
||||
* Run the curate (Research_Judge) stage.
|
||||
*
|
||||
* @param string $run_id Pipeline run UUID.
|
||||
* @param string $item_key Article-scoped item key.
|
||||
* @param array $fanout_results Results from research stage.
|
||||
* @param PRAutoBlogger_Research_Judge $judge Judge instance.
|
||||
* @param string $run_id Pipeline run UUID.
|
||||
* @param string $item_key Article-scoped item key.
|
||||
* @param array $fanout_results Results from research stage.
|
||||
* @param PRAutoBlogger_Research_Judge $judge Judge instance.
|
||||
* @return array<int, array{url: string, title: string, quality_score?: float}> Kept sources.
|
||||
*/
|
||||
public static function run_curate(
|
||||
@@ -63,18 +63,18 @@ class PRAutoBlogger_Authority_Pipeline_Stages {
|
||||
array $fanout_results,
|
||||
PRAutoBlogger_Research_Judge $judge
|
||||
): array {
|
||||
PRAutoBlogger_Pipeline_Status::broadcast( __( 'Authority: curating research sources…', 'prautoblogger' ) );
|
||||
PRAutoBlogger_Pipeline_Status::broadcast( __( 'Authority: curating research sources...', 'prautoblogger' ) );
|
||||
return $judge->curate( $run_id, $item_key, $fanout_results );
|
||||
}
|
||||
|
||||
/**
|
||||
* Run the draft (Content_Generator) stage.
|
||||
*
|
||||
* @param string $run_id Pipeline run UUID.
|
||||
* @param string $item_key Article-scoped item key.
|
||||
* @param PRAutoBlogger_Article_Idea $idea The idea to draft.
|
||||
* @param PRAutoBlogger_Cost_Tracker $cost_tracker Pipeline cost tracker.
|
||||
* @param PRAutoBlogger_Content_Generator|null $generator Optional override (tests).
|
||||
* @param string $run_id Pipeline run UUID.
|
||||
* @param string $item_key Article-scoped item key.
|
||||
* @param PRAutoBlogger_Article_Idea $idea The idea to draft.
|
||||
* @param PRAutoBlogger_Cost_Tracker $cost_tracker Pipeline cost tracker.
|
||||
* @param PRAutoBlogger_Content_Generator|null $generator Optional override (tests).
|
||||
* @return string Draft HTML content.
|
||||
*/
|
||||
public static function run_draft(
|
||||
@@ -84,7 +84,7 @@ class PRAutoBlogger_Authority_Pipeline_Stages {
|
||||
PRAutoBlogger_Cost_Tracker $cost_tracker,
|
||||
?PRAutoBlogger_Content_Generator $generator = null
|
||||
): string {
|
||||
PRAutoBlogger_Pipeline_Status::broadcast( __( 'Authority: generating article draft…', 'prautoblogger' ) );
|
||||
PRAutoBlogger_Pipeline_Status::broadcast( __( 'Authority: generating article draft...', 'prautoblogger' ) );
|
||||
if ( null === $generator ) {
|
||||
$llm = new PRAutoBlogger_OpenRouter_Provider();
|
||||
$generator = new PRAutoBlogger_Content_Generator( $llm, $cost_tracker );
|
||||
@@ -96,12 +96,12 @@ class PRAutoBlogger_Authority_Pipeline_Stages {
|
||||
/**
|
||||
* Run the editorial loop stage.
|
||||
*
|
||||
* @param string $run_id Pipeline run UUID.
|
||||
* @param string $item_key Article-scoped item key.
|
||||
* @param string $content Draft HTML.
|
||||
* @param PRAutoBlogger_Article_Idea $idea The idea under review.
|
||||
* @param PRAutoBlogger_Cost_Tracker $cost_tracker Pipeline cost tracker.
|
||||
* @param PRAutoBlogger_Editorial_Loop $editorial Editorial loop instance.
|
||||
* @param string $run_id Pipeline run UUID.
|
||||
* @param string $item_key Article-scoped item key.
|
||||
* @param string $content Draft HTML.
|
||||
* @param PRAutoBlogger_Article_Idea $idea The idea under review.
|
||||
* @param PRAutoBlogger_Cost_Tracker $cost_tracker Pipeline cost tracker.
|
||||
* @param PRAutoBlogger_Editorial_Loop $editorial Editorial loop instance.
|
||||
* @return array{content: string, escalated: bool} Result: content and escalation flag.
|
||||
*/
|
||||
public static function run_editorial(
|
||||
@@ -112,7 +112,7 @@ class PRAutoBlogger_Authority_Pipeline_Stages {
|
||||
PRAutoBlogger_Cost_Tracker $cost_tracker,
|
||||
PRAutoBlogger_Editorial_Loop $editorial
|
||||
): array {
|
||||
PRAutoBlogger_Pipeline_Status::broadcast( __( 'Authority: running editorial loop…', 'prautoblogger' ) );
|
||||
PRAutoBlogger_Pipeline_Status::broadcast( __( 'Authority: running editorial loop...', 'prautoblogger' ) );
|
||||
$reviewed = $editorial->run( $run_id, $item_key, $content, $idea, $cost_tracker );
|
||||
return array(
|
||||
'content' => '' === $reviewed ? $content : $reviewed,
|
||||
@@ -123,9 +123,9 @@ class PRAutoBlogger_Authority_Pipeline_Stages {
|
||||
/**
|
||||
* Run the SEO stage.
|
||||
*
|
||||
* @param string $run_id Pipeline run UUID.
|
||||
* @param string $item_key Article-scoped item key.
|
||||
* @param int $post_id Published/draft post ID.
|
||||
* @param string $run_id Pipeline run UUID.
|
||||
* @param string $item_key Article-scoped item key.
|
||||
* @param int $post_id Published/draft post ID.
|
||||
* @param array $kept_sources Kept research sources from curate stage.
|
||||
* @param array $peptide_ids Related peptide post IDs.
|
||||
* @return float The computed citation_score.
|
||||
@@ -137,25 +137,36 @@ class PRAutoBlogger_Authority_Pipeline_Stages {
|
||||
array $kept_sources,
|
||||
array $peptide_ids
|
||||
): float {
|
||||
PRAutoBlogger_Pipeline_Status::broadcast( __( 'Authority: writing SEO meta…', 'prautoblogger' ) );
|
||||
PRAutoBlogger_Pipeline_Status::broadcast( __( 'Authority: writing SEO meta...', 'prautoblogger' ) );
|
||||
$seo_stage = new PRAutoBlogger_Seo_Stage();
|
||||
return $seo_stage->run( $run_id, $item_key, $post_id, $kept_sources, $peptide_ids );
|
||||
}
|
||||
|
||||
/**
|
||||
* Hold an article as draft (citation gate, escalation, or cost ceiling).
|
||||
* Hold an article (citation gate, escalation, or cost ceiling).
|
||||
*
|
||||
* Creates the draft post and suppresses image generation on it. Writes
|
||||
* a run_decisions row for the hold reason. Returns the decision verdict
|
||||
* string suitable for the result 'status' key.
|
||||
* Behaviour depends on whether draft content is available:
|
||||
*
|
||||
* @param string $run_id Pipeline run UUID.
|
||||
* @param string $item_key Article-scoped item key.
|
||||
* @param string $content Draft HTML content.
|
||||
* @param PRAutoBlogger_Article_Idea $idea The article idea.
|
||||
* @param string $hold_reason Short human-readable hold reason.
|
||||
* @param string $verdict Decision verdict for audit row.
|
||||
* @param string $run_id_for_publisher Run ID passed to Publisher.
|
||||
* - NO content (empty after tag-strip): quorum miss or other pre-draft
|
||||
* failure. No post is created. The hold is recorded as a run_decisions
|
||||
* row and logged. This path never calls Publisher (avoids the
|
||||
* empty-content RuntimeException introduced in v0.18.1).
|
||||
*
|
||||
* - WITH content (editorial escalation, citation gate, or cost ceiling
|
||||
* after draft stage): saves a draft post, suppresses imagery, and
|
||||
* records the decision row. Behaviour unchanged from pre-v0.32.2.
|
||||
*
|
||||
* Side effects (no-content path): Logger info + Audit_Writer decision row.
|
||||
* Side effects (content path): Logger info + Publisher draft + post-meta
|
||||
* (_prautoblogger_imagery_suppressed) + Audit_Writer decision row.
|
||||
*
|
||||
* @param string $run_id Pipeline run UUID.
|
||||
* @param string $item_key Article-scoped item key.
|
||||
* @param string $content Draft HTML ('' = pre-draft hold).
|
||||
* @param PRAutoBlogger_Article_Idea $idea The article idea.
|
||||
* @param string $hold_reason Short human-readable hold reason.
|
||||
* @param string $verdict Decision verdict for audit row.
|
||||
* @param string $run_id_for_publisher Run ID passed to Publisher (content path).
|
||||
* @return void
|
||||
*/
|
||||
public static function hold_as_draft(
|
||||
@@ -172,7 +183,17 @@ class PRAutoBlogger_Authority_Pipeline_Stages {
|
||||
'authority-pipeline'
|
||||
);
|
||||
|
||||
// Save as draft with a neutral editorial review stub.
|
||||
// v0.32.2: when there is no draft content yet (quorum miss or other
|
||||
// pre-draft failure), skip Publisher entirely -- Publisher::save_as_draft()
|
||||
// throws RuntimeException on empty content (v0.18.1 guard). Record the
|
||||
// hold decision only; the run state is returned as 'held' by the caller.
|
||||
if ( '' === trim( wp_strip_all_tags( $content ) ) ) {
|
||||
PRAutoBlogger_Audit_Writer::record_decision( $run_id, 'publish-gate', $verdict, $hold_reason );
|
||||
return;
|
||||
}
|
||||
|
||||
// Content is present: save as draft and suppress imagery (editorial
|
||||
// escalation, citation gate, or cost ceiling after the draft stage).
|
||||
$publisher = new PRAutoBlogger_Publisher();
|
||||
$review = new PRAutoBlogger_Editorial_Review(
|
||||
array(
|
||||
@@ -184,7 +205,7 @@ class PRAutoBlogger_Authority_Pipeline_Stages {
|
||||
'issues' => array(),
|
||||
)
|
||||
);
|
||||
$post_id = $publisher->save_as_draft( $content, $idea, $review, $run_id_for_publisher, null );
|
||||
$post_id = $publisher->save_as_draft( $content, $idea, $review, $run_id_for_publisher, null, 'authority' );
|
||||
|
||||
// Imagery gate: suppress image generation on held articles.
|
||||
if ( $post_id > 0 ) {
|
||||
|
||||
@@ -222,7 +222,7 @@ class PRAutoBlogger_Authority_Pipeline implements PRAutoBlogger_Authority_Pipeli
|
||||
)
|
||||
);
|
||||
$auto_publish = in_array( get_option( 'prautoblogger_auto_publish', '0' ), array( '1', 'yes' ), true );
|
||||
$post_id = $publisher->save_as_draft( $final_content, $idea, $stub_review, $run_id, null );
|
||||
$post_id = $publisher->save_as_draft( $final_content, $idea, $stub_review, $run_id, null, 'authority' );
|
||||
PRAutoBlogger_Run_Stage_State::start( $run_id, 'publish', (string) PRAutoBlogger_Stage_Display_Map::default_agent_role( 'publish' ), $item_key );
|
||||
|
||||
// Stage 5: SEO.
|
||||
|
||||
@@ -13,22 +13,23 @@ declare(strict_types=1);
|
||||
* Dependencies: PRAutoBlogger_Post_Assembler (taxonomy, images, sanitization),
|
||||
* WordPress wp_insert_post(), post meta API.
|
||||
*
|
||||
* @see core/class-post-assembler.php — Post-creation helpers (taxonomy, images, logs).
|
||||
* @see core/class-peptide-linker.php — Injects peptide database hyperlinks into content.
|
||||
* @see core/class-chief-editor.php — Produces the editorial review we consume.
|
||||
* @see core/class-content-generator.php — Produces the content we publish.
|
||||
* @see ARCHITECTURE.md — Data flow step 6.
|
||||
* @see core/class-post-assembler.php -- Post-creation helpers (taxonomy, images, logs).
|
||||
* @see core/class-peptide-linker.php -- Injects peptide database hyperlinks into content.
|
||||
* @see core/class-chief-editor.php -- Produces the editorial review we consume.
|
||||
* @see core/class-content-generator.php -- Produces the content we publish.
|
||||
* @see ARCHITECTURE.md -- Data flow step 6.
|
||||
*/
|
||||
class PRAutoBlogger_Publisher {
|
||||
|
||||
/**
|
||||
* Publish an editor-approved article.
|
||||
*
|
||||
* @param string $content The final HTML content.
|
||||
* @param PRAutoBlogger_Article_Idea $idea The original article idea.
|
||||
* @param PRAutoBlogger_Editorial_Review $review The editor's review.
|
||||
* @param string|null $run_id Pipeline run ID for log linking.
|
||||
* @param ?PRAutoBlogger_Cost_Tracker $cost_tracker Optional cost tracker for image generation cost logging.
|
||||
* @param string $content The final HTML content.
|
||||
* @param PRAutoBlogger_Article_Idea $idea The original article idea.
|
||||
* @param PRAutoBlogger_Editorial_Review $review The editor's review.
|
||||
* @param string|null $run_id Pipeline run ID for log linking.
|
||||
* @param PRAutoBlogger_Cost_Tracker|null $cost_tracker Optional cost tracker for imagery.
|
||||
* @param string $pipeline_mode Override pipeline_mode meta ('' = option).
|
||||
* @return int The created post ID.
|
||||
* @throws \RuntimeException If post creation fails.
|
||||
*/
|
||||
@@ -37,19 +38,21 @@ class PRAutoBlogger_Publisher {
|
||||
PRAutoBlogger_Article_Idea $idea,
|
||||
PRAutoBlogger_Editorial_Review $review,
|
||||
?string $run_id = null,
|
||||
?PRAutoBlogger_Cost_Tracker $cost_tracker = null
|
||||
?PRAutoBlogger_Cost_Tracker $cost_tracker = null,
|
||||
string $pipeline_mode = ''
|
||||
): int {
|
||||
return $this->create_post( $content, $idea, $review, 'publish', $run_id, $cost_tracker );
|
||||
return $this->create_post( $content, $idea, $review, 'publish', $run_id, $cost_tracker, $pipeline_mode );
|
||||
}
|
||||
|
||||
/**
|
||||
* Save an editor-rejected article as a draft for human review.
|
||||
*
|
||||
* @param string $content The generated HTML content (pre-revision).
|
||||
* @param PRAutoBlogger_Article_Idea $idea The original article idea.
|
||||
* @param PRAutoBlogger_Editorial_Review $review The editor's review with rejection notes.
|
||||
* @param string|null $run_id Pipeline run ID for log linking.
|
||||
* @param ?PRAutoBlogger_Cost_Tracker $cost_tracker Optional cost tracker for image generation cost logging.
|
||||
* @param string $content The generated HTML content (pre-revision).
|
||||
* @param PRAutoBlogger_Article_Idea $idea The original article idea.
|
||||
* @param PRAutoBlogger_Editorial_Review $review The editor's review with rejection notes.
|
||||
* @param string|null $run_id Pipeline run ID for log linking.
|
||||
* @param PRAutoBlogger_Cost_Tracker|null $cost_tracker Optional cost tracker for imagery.
|
||||
* @param string $pipeline_mode Override pipeline_mode meta ('' = option).
|
||||
* @return int The created post ID.
|
||||
* @throws \RuntimeException If post creation fails.
|
||||
*/
|
||||
@@ -58,21 +61,24 @@ class PRAutoBlogger_Publisher {
|
||||
PRAutoBlogger_Article_Idea $idea,
|
||||
PRAutoBlogger_Editorial_Review $review,
|
||||
?string $run_id = null,
|
||||
?PRAutoBlogger_Cost_Tracker $cost_tracker = null
|
||||
?PRAutoBlogger_Cost_Tracker $cost_tracker = null,
|
||||
string $pipeline_mode = ''
|
||||
): int {
|
||||
return $this->create_post( $content, $idea, $review, 'draft', $run_id, $cost_tracker );
|
||||
return $this->create_post( $content, $idea, $review, 'draft', $run_id, $cost_tracker, $pipeline_mode );
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a WordPress post with generation metadata.
|
||||
*
|
||||
* @param string $content HTML content.
|
||||
* @param PRAutoBlogger_Article_Idea $idea Article idea.
|
||||
* @param PRAutoBlogger_Editorial_Review $review Editorial review.
|
||||
* @param string $post_status 'publish' or 'draft'.
|
||||
* @param string|null $run_id Pipeline run ID for log linking.
|
||||
* @param string $content HTML content.
|
||||
* @param PRAutoBlogger_Article_Idea $idea Article idea.
|
||||
* @param PRAutoBlogger_Editorial_Review $review Editorial review.
|
||||
* @param string $post_status 'publish' or 'draft'.
|
||||
* @param string|null $run_id Pipeline run ID.
|
||||
* @param PRAutoBlogger_Cost_Tracker|null $cost_tracker Cost tracker for imagery.
|
||||
* @param string $pipeline_mode Override pipeline_mode meta ('' = option).
|
||||
* @return int Post ID.
|
||||
* @throws \RuntimeException If wp_insert_post fails.
|
||||
* @throws \RuntimeException On wp_insert_post failure or empty content (v0.18.1 guard).
|
||||
*/
|
||||
private function create_post(
|
||||
string $content,
|
||||
@@ -80,10 +86,11 @@ class PRAutoBlogger_Publisher {
|
||||
PRAutoBlogger_Editorial_Review $review,
|
||||
string $post_status,
|
||||
?string $run_id = null,
|
||||
?PRAutoBlogger_Cost_Tracker $cost_tracker = null
|
||||
?PRAutoBlogger_Cost_Tracker $cost_tracker = null,
|
||||
string $pipeline_mode = ''
|
||||
): int {
|
||||
// v0.18.1 belt-and-braces: never create a post whose content is
|
||||
// empty once tags and whitespace are stripped — an empty "draft
|
||||
// empty once tags and whitespace are stripped -- an empty "draft
|
||||
// for human review" (2026-06-11 incident, post 921) reviews
|
||||
// nothing and hides the underlying generation failure. The
|
||||
// provider/writer guards make this unreachable on OpenRouter
|
||||
@@ -110,7 +117,7 @@ class PRAutoBlogger_Publisher {
|
||||
// v0.20.0: a re-run's regenerated content must land on the
|
||||
// existing UNPUBLISHED post (otherwise re-runs silently
|
||||
// discard their output). Published posts stay frozen
|
||||
// (CPO guardrail 5) — refresh skips them untouched.
|
||||
// (CPO guardrail 5) -- refresh skips them untouched.
|
||||
return $this->refresh_unpublished_post( $existing_id, $content, $idea, $review );
|
||||
}
|
||||
}
|
||||
@@ -127,10 +134,10 @@ class PRAutoBlogger_Publisher {
|
||||
'post_status' => $post_status,
|
||||
'post_type' => 'post',
|
||||
'post_author' => PRAutoBlogger_Post_Assembler::get_default_author_id(),
|
||||
'meta_input' => $this->build_meta( $idea, $review, $run_id, $idea_hash ),
|
||||
'meta_input' => $this->build_meta( $idea, $review, $run_id, $idea_hash, $pipeline_mode ),
|
||||
);
|
||||
|
||||
/** @see class-prautoblogger.php — listeners registered in main loader. */
|
||||
/** @see class-prautoblogger.php -- listeners registered in main loader. */
|
||||
$post_data = apply_filters( 'prautoblogger_filter_post_data', $post_data, $idea, $review );
|
||||
|
||||
$post_id = wp_insert_post( $post_data, true );
|
||||
@@ -158,15 +165,11 @@ class PRAutoBlogger_Publisher {
|
||||
}
|
||||
|
||||
/**
|
||||
* Refresh an existing post from re-run output — unpublished only.
|
||||
*
|
||||
* Idempotent-resume calls land here too (same content in = same
|
||||
* content out, so behavior is unchanged for plain resumes). The post
|
||||
* keeps its CURRENT status: a re-run never publishes an unpublished
|
||||
* post — publication stays an explicit Review Queue / WP editor
|
||||
* action. Published (and scheduled/private) posts are returned
|
||||
* untouched: the run is frozen (CPO guardrail 5).
|
||||
* Refresh an existing post from re-run output -- unpublished only.
|
||||
*
|
||||
* Idempotent-resume: same content in = same content out. The post keeps
|
||||
* its CURRENT status -- a re-run never publishes an unpublished post.
|
||||
* Published/scheduled/private posts are returned untouched (CPO guardrail 5).
|
||||
* Side effects: wp_update_post + post meta updates (unpublished only).
|
||||
*
|
||||
* @param int $post_id Existing post ID.
|
||||
@@ -179,7 +182,7 @@ class PRAutoBlogger_Publisher {
|
||||
$post = get_post( $post_id );
|
||||
if ( PRAutoBlogger_Rerun_Eligibility::post_frozen( $post ) ) {
|
||||
PRAutoBlogger_Logger::instance()->info(
|
||||
sprintf( 'Post %d already exists and is published — frozen, skipping content refresh.', $post_id ),
|
||||
sprintf( 'Post %d already exists and is published -- frozen, skipping content refresh.', $post_id ),
|
||||
'publisher'
|
||||
);
|
||||
return $post_id;
|
||||
@@ -214,28 +217,35 @@ class PRAutoBlogger_Publisher {
|
||||
/**
|
||||
* Build post_meta array for generation metadata.
|
||||
*
|
||||
* The `_prautoblogger_run_id` key (added v0.8.1) lets the orphan-research
|
||||
* reaper attribute an orphan `llm_research` row back to its sibling
|
||||
* articles without re-walking the gen_log table. See
|
||||
* core/class-research-reaper.php.
|
||||
* `_prautoblogger_run_id` lets the orphan-research reaper attribute an orphan
|
||||
* `llm_research` row back to its article without re-walking gen_log.
|
||||
* `_prautoblogger_pipeline_mode`: Authority passes 'authority'; Economy passes
|
||||
* '' (falls back to the option). See core/class-research-reaper.php.
|
||||
*
|
||||
* @param PRAutoBlogger_Article_Idea $idea
|
||||
* @param PRAutoBlogger_Editorial_Review $review
|
||||
* @param string|null $run_id Pipeline run UUID, or null in legacy paths.
|
||||
* @param PRAutoBlogger_Article_Idea $idea Article idea.
|
||||
* @param PRAutoBlogger_Editorial_Review $review Editorial review.
|
||||
* @param string|null $run_id Pipeline run UUID, or null in legacy paths.
|
||||
* @param string $idea_hash Idea hash ('' when not yet computed).
|
||||
* @param string $pipeline_mode Explicit pipeline mode ('' = read option).
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
private function build_meta(
|
||||
PRAutoBlogger_Article_Idea $idea,
|
||||
PRAutoBlogger_Editorial_Review $review,
|
||||
?string $run_id = null,
|
||||
string $idea_hash = ''
|
||||
string $idea_hash = '',
|
||||
string $pipeline_mode = ''
|
||||
): array {
|
||||
$mode = '' !== $pipeline_mode
|
||||
? $pipeline_mode
|
||||
: get_option( 'prautoblogger_writing_pipeline', 'multi_step' );
|
||||
|
||||
$meta = array(
|
||||
'_prautoblogger_generated' => '1',
|
||||
'_prautoblogger_analysis_id' => $idea->get_analysis_id(),
|
||||
'_prautoblogger_source_ids' => wp_json_encode( $idea->get_source_ids() ),
|
||||
'_prautoblogger_model_used' => get_option( 'prautoblogger_writing_model', PRAUTOBLOGGER_DEFAULT_WRITING_MODEL ),
|
||||
'_prautoblogger_pipeline_mode' => get_option( 'prautoblogger_writing_pipeline', 'multi_step' ),
|
||||
'_prautoblogger_pipeline_mode' => $mode,
|
||||
'_prautoblogger_editor_verdict' => $review->get_verdict(),
|
||||
'_prautoblogger_editor_notes' => $review->get_notes(),
|
||||
'_prautoblogger_quality_score' => $review->get_quality_score(),
|
||||
@@ -257,7 +267,7 @@ class PRAutoBlogger_Publisher {
|
||||
/**
|
||||
* Find a post already created for this (run, idea) pair.
|
||||
*
|
||||
* Direct postmeta self-join (any post_status, including trash) — the
|
||||
* Direct postmeta self-join (any post_status, including trash) -- the
|
||||
* idempotency check must see drafts and pending posts too.
|
||||
*
|
||||
* @param string $run_id Pipeline run UUID.
|
||||
|
||||
Reference in New Issue
Block a user