Eliminate no-op runs: dedup check controls article generation only, analysis always executes#1613
Eliminate no-op runs: dedup check controls article generation only, analysis always executes#1613
Conversation
🏷️ Automatic Labeling SummaryThis PR has been automatically labeled based on the files changed and PR metadata. Applied Labels: size-xs Label Categories
For more information, see |
🔍 Lighthouse Performance Audit
📥 Download full Lighthouse report Budget Compliance: Performance budgets enforced via |
…tence - Update MANDATORY Deduplication Check in all 9 news workflows to never skip analysis - Change dedup check from exit/noop to SKIP_ARTICLE_GENERATION flag - Add explicit "NEVER noop because articles exist" rules to all workflows - Restrict safeoutputs___noop to MCP server unreachable scenario only - Update SHARED_PROMPT_PATTERNS.md with analysis-first dedup pattern - Strengthen AI-Driven Analysis Protocol with no-exceptions rule - Update Step 1 in all workflows from "Check Recent Generation" to "Check Existing Articles (Analysis Always Runs)" Agent-Logs-Url: https://github.com/Hack23/riksdagsmonitor/sessions/9405f477-bca1-41a6-b552-1aaf84314c33 Co-authored-by: pethers <1726836+pethers@users.noreply.github.com>
🔍 Lighthouse Performance Audit
📥 Download full Lighthouse report Budget Compliance: Performance budgets enforced via |
- Clarify that noop is only valid when MCP server is unreachable - Add analysis-only PR as required output option - Add explicit "ALWAYS run analysis" rule to non-negotiable rules - Update force_generation description to note analysis always runs Agent-Logs-Url: https://github.com/Hack23/riksdagsmonitor/sessions/9405f477-bca1-41a6-b552-1aaf84314c33 Co-authored-by: pethers <1726836+pethers@users.noreply.github.com>
🔍 Lighthouse Performance Audit
📥 Download full Lighthouse report Budget Compliance: Performance budgets enforced via |
There was a problem hiding this comment.
Pull request overview
Updates agentic workflow guidance so deduplication prevents duplicate article generation without prematurely stopping the mandatory deep political analysis phase.
Changes:
- Replaces dedup “exit early / noop” guidance with a flag-based approach intended to skip HTML generation while analysis continues.
- Tightens safe-output rules across content workflows to disallow noop when “articles already exist,” reserving noop for MCP-unreachable scenarios.
- Updates journalist/realtime-monitor rules to allow analysis-only PRs when analysis artifacts exist but no articles are generated.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
| .github/workflows/SHARED_PROMPT_PATTERNS.md | Updates the standardized dedup pattern and codifies “analysis always runs” rules. |
| .github/workflows/news-weekly-review.md | Updates dedup + noop rules and renames Step 1 to emphasize analysis always runs. |
| .github/workflows/news-week-ahead.md | Updates dedup + noop rules and renames Step 1 to emphasize analysis always runs. |
| .github/workflows/news-realtime-monitor.md | Updates safe output decision rules to include analysis-only PRs and restrict noop. |
| .github/workflows/news-propositions.md | Updates dedup + noop rules and renames Step 1 to emphasize analysis always runs. |
| .github/workflows/news-motions.md | Updates dedup + noop rules and renames Step 1 to emphasize analysis always runs. |
| .github/workflows/news-monthly-review.md | Updates dedup + noop rules and renames Step 1 to emphasize analysis always runs. |
| .github/workflows/news-month-ahead.md | Updates dedup + noop rules and renames Step 1 to emphasize analysis always runs. |
| .github/workflows/news-interpellations.md | Updates dedup + noop rules and renames Step 1 to emphasize analysis always runs. |
| .github/workflows/news-evening-analysis.md | Updates dedup + noop rules to prevent skipping analysis when articles exist. |
| .github/workflows/news-committee-reports.md | Updates dedup + noop rules and renames Step 1 to emphasize analysis always runs. |
| .github/workflows/news-article-generator.md | Updates rules to support analysis-only PRs and restrict noop scenarios. |
| # Check if articles for today already exist (controls article GENERATION only, NOT analysis) | ||
| EXISTING=$(ls news/${ARTICLE_DATE}-${ARTICLE_TYPE}-en.html 2>/dev/null | wc -l) | ||
| if [ "$EXISTING" -gt 0 ] && [ "${FORCE_GENERATION}" != "true" ]; then | ||
| echo "📋 Articles for $ARTICLE_DATE/$ARTICLE_TYPE already exist — skipping (use FORCE_GENERATION=true to override)" | ||
| exit 0 | ||
| echo "📋 Articles for $ARTICLE_DATE/$ARTICLE_TYPE already exist — article generation will be skipped (analysis still runs)" | ||
| echo "SKIP_ARTICLE_GENERATION=true" | ||
| fi |
There was a problem hiding this comment.
echo "SKIP_ARTICLE_GENERATION=true" only prints text; it does not set a flag that later steps can read. Since these workflows rely on passing state across steps (and even across separate run blocks), the dedup check currently won’t actually control article generation. Persist the flag (e.g., via $GITHUB_ENV or the repo’s /tmp/gh-aw/agent/*.env pattern) and ensure the article-generation step is conditionally skipped based on it.
| FORCE_GENERATION="${{ github.event.inputs.force_generation || 'false' }}" | ||
| EXISTING=$(ls news/${ARTICLE_DATE}-${ARTICLE_TYPE}-en.html 2>/dev/null | wc -l) | ||
| if [ "$EXISTING" -gt 0 ] && [ "${FORCE_GENERATION}" != "true" ]; then | ||
| echo "📋 Articles for $ARTICLE_DATE/$ARTICLE_TYPE already exist — skipping (set force_generation=true to override)" | ||
| exit 0 | ||
| echo "📋 Articles for $ARTICLE_DATE/$ARTICLE_TYPE already exist — article generation will be skipped (analysis still runs)" | ||
| echo "SKIP_ARTICLE_GENERATION=true" | ||
| fi | ||
| # NOTE: Do NOT exit here or call safeoutputs___noop — analysis phase MUST still execute |
There was a problem hiding this comment.
The dedup check intends to set SKIP_ARTICLE_GENERATION, but echo "SKIP_ARTICLE_GENERATION=true" only writes to stdout. This won’t be available to later workflow steps, so article generation won’t actually be skipped. Persist the flag (e.g., append to $GITHUB_ENV) and gate the article generation step on it.
| # Derive FORCE_GENERATION from the workflow_dispatch input | ||
| FORCE_GENERATION="${{ github.event.inputs.force_generation || 'false' }}" | ||
| EXISTING=$(ls news/${ARTICLE_DATE}-${ARTICLE_TYPE}-en.html 2>/dev/null | wc -l) | ||
| if [ "$EXISTING" -gt 0 ] && [ "${FORCE_GENERATION}" != "true" ]; then | ||
| echo "📋 Articles for $ARTICLE_DATE/$ARTICLE_TYPE already exist — skipping (set force_generation=true to override)" | ||
| exit 0 | ||
| echo "📋 Articles for $ARTICLE_DATE/$ARTICLE_TYPE already exist — article generation will be skipped (analysis still runs)" | ||
| echo "SKIP_ARTICLE_GENERATION=true" | ||
| fi | ||
| # NOTE: Do NOT exit here or call safeoutputs___noop — analysis phase MUST still execute |
There was a problem hiding this comment.
The dedup check currently only echoes SKIP_ARTICLE_GENERATION=true (stdout) rather than setting it for later steps. As a result, the flag won’t control whether article generation runs. Persist it (e.g., $GITHUB_ENV) and ensure the generation step is conditionally skipped when the flag is set.
.github/workflows/news-week-ahead.md
Outdated
| echo "SKIP_ARTICLE_GENERATION=true" | ||
| fi | ||
| # NOTE: Do NOT exit here or call safeoutputs___noop — analysis phase MUST still execute |
There was a problem hiding this comment.
echo "SKIP_ARTICLE_GENERATION=true" does not set an environment variable for subsequent steps; it only prints. If the intent is to skip the article generation phase, persist the flag (e.g., via $GITHUB_ENV) and gate the generation step on it.
| echo "SKIP_ARTICLE_GENERATION=true" | |
| fi | |
| # NOTE: Do NOT exit here or call safeoutputs___noop — analysis phase MUST still execute | |
| echo "SKIP_ARTICLE_GENERATION=true" >> "$GITHUB_ENV" | |
| fi | |
| # NOTE: Do NOT exit here or call safeoutputs___noop — analysis phase MUST still execute, and later article-generation steps should gate on env.SKIP_ARTICLE_GENERATION != 'true' |
| # Derive FORCE_GENERATION from the workflow_dispatch input | ||
| FORCE_GENERATION="${{ github.event.inputs.force_generation || 'false' }}" | ||
| EXISTING=$(ls news/${ARTICLE_DATE}-${ARTICLE_TYPE}-en.html 2>/dev/null | wc -l) | ||
| if [ "$EXISTING" -gt 0 ] && [ "${FORCE_GENERATION}" != "true" ]; then | ||
| echo "📋 Articles for $ARTICLE_DATE/$ARTICLE_TYPE already exist — skipping (set force_generation=true to override)" | ||
| exit 0 | ||
| echo "📋 Articles for $ARTICLE_DATE/$ARTICLE_TYPE already exist — article generation will be skipped (analysis still runs)" | ||
| echo "SKIP_ARTICLE_GENERATION=true" | ||
| fi | ||
| # NOTE: Do NOT exit here or call safeoutputs___noop — analysis phase MUST still execute |
There was a problem hiding this comment.
The workflow echoes SKIP_ARTICLE_GENERATION=true but doesn’t actually set/persist it for later steps. This means article generation won’t be reliably skipped. Persist the flag (e.g., $GITHUB_ENV or the workflow’s env-file convention) and conditionally skip the generation step based on it.
| # Derive FORCE_GENERATION from the workflow_dispatch input | ||
| FORCE_GENERATION="${{ github.event.inputs.force_generation || 'false' }}" | ||
| EXISTING=$(ls news/${ARTICLE_DATE}-${ARTICLE_TYPE}-en.html 2>/dev/null | wc -l) | ||
| if [ "$EXISTING" -gt 0 ] && [ "${FORCE_GENERATION}" != "true" ]; then | ||
| echo "📋 Articles for $ARTICLE_DATE/$ARTICLE_TYPE already exist — skipping (set force_generation=true to override)" | ||
| exit 0 | ||
| echo "📋 Articles for $ARTICLE_DATE/$ARTICLE_TYPE already exist — article generation will be skipped (analysis still runs)" | ||
| echo "SKIP_ARTICLE_GENERATION=true" | ||
| fi | ||
| # NOTE: Do NOT exit here or call safeoutputs___noop — analysis phase MUST still execute |
There was a problem hiding this comment.
The dedup check only prints SKIP_ARTICLE_GENERATION=true; it doesn’t set a value that later steps can read. If article generation should be skipped, persist the flag (e.g., append to $GITHUB_ENV) and gate the generation step accordingly.
| # Derive FORCE_GENERATION from the workflow_dispatch input | ||
| FORCE_GENERATION="${{ github.event.inputs.force_generation || 'false' }}" | ||
| EXISTING=$(ls news/${ARTICLE_DATE}-${ARTICLE_TYPE}-en.html 2>/dev/null | wc -l) | ||
| if [ "$EXISTING" -gt 0 ] && [ "${FORCE_GENERATION}" != "true" ]; then | ||
| echo "📋 Articles for $ARTICLE_DATE/$ARTICLE_TYPE already exist — skipping (set force_generation=true to override)" | ||
| exit 0 | ||
| echo "📋 Articles for $ARTICLE_DATE/$ARTICLE_TYPE already exist — article generation will be skipped (analysis still runs)" | ||
| echo "SKIP_ARTICLE_GENERATION=true" | ||
| fi | ||
| # NOTE: Do NOT exit here or call safeoutputs___noop — analysis phase MUST still execute |
There was a problem hiding this comment.
The dedup check intends to set SKIP_ARTICLE_GENERATION, but echo "SKIP_ARTICLE_GENERATION=true" only prints to stdout. Persist the flag for subsequent steps (e.g., $GITHUB_ENV) and ensure the article generation step is skipped when it’s set.
| # Derive FORCE_GENERATION from the workflow_dispatch input | ||
| FORCE_GENERATION="${{ github.event.inputs.force_generation || 'false' }}" | ||
| EXISTING=$(ls news/${ARTICLE_DATE}-${ARTICLE_TYPE}-en.html 2>/dev/null | wc -l) | ||
| if [ "$EXISTING" -gt 0 ] && [ "${FORCE_GENERATION}" != "true" ]; then | ||
| echo "📋 Articles for $ARTICLE_DATE/$ARTICLE_TYPE already exist — skipping (set force_generation=true to override)" | ||
| exit 0 | ||
| echo "📋 Articles for $ARTICLE_DATE/$ARTICLE_TYPE already exist — article generation will be skipped (analysis still runs)" | ||
| echo "SKIP_ARTICLE_GENERATION=true" | ||
| fi | ||
| # NOTE: Do NOT exit here or call safeoutputs___noop — analysis phase MUST still execute |
There was a problem hiding this comment.
The dedup check currently only echoes SKIP_ARTICLE_GENERATION=true instead of setting it for later steps. Persist the flag (e.g., via $GITHUB_ENV) and gate the article generation step so it truly skips when articles already exist.
| # Derive FORCE_GENERATION from the workflow_dispatch input | ||
| FORCE_GENERATION="${{ github.event.inputs.force_generation || 'false' }}" | ||
| EXISTING=$(ls news/${ARTICLE_DATE}-${ARTICLE_TYPE}-en.html 2>/dev/null | wc -l) | ||
| if [ "$EXISTING" -gt 0 ] && [ "${FORCE_GENERATION}" != "true" ]; then | ||
| echo "📋 Articles for $ARTICLE_DATE/$ARTICLE_TYPE already exist — skipping (set force_generation=true to override)" | ||
| exit 0 | ||
| echo "📋 Articles for $ARTICLE_DATE/$ARTICLE_TYPE already exist — article generation will be skipped (analysis still runs)" | ||
| echo "SKIP_ARTICLE_GENERATION=true" | ||
| fi | ||
| # NOTE: Do NOT exit here or call safeoutputs___noop — analysis phase MUST still execute |
There was a problem hiding this comment.
echo "SKIP_ARTICLE_GENERATION=true" doesn’t set a flag for subsequent steps; it only writes to stdout. Persist the flag (e.g., $GITHUB_ENV), and conditionally skip the article-generation step based on it so the dedup check has real effect.
| ARTICLE_TYPE="evening-analysis" | ||
| EXISTING=$(ls news/${ARTICLE_DATE}-${ARTICLE_TYPE}-en.html 2>/dev/null | wc -l) | ||
| if [ "$EXISTING" -gt 0 ]; then | ||
| echo "📋 Articles for $ARTICLE_DATE/$ARTICLE_TYPE already exist — skipping" | ||
| exit 0 | ||
| echo "📋 Articles for $ARTICLE_DATE/$ARTICLE_TYPE already exist — article generation will be skipped (analysis still runs)" | ||
| echo "SKIP_ARTICLE_GENERATION=true" | ||
| fi | ||
| # NOTE: Do NOT exit here or call safeoutputs___noop — analysis phase MUST still execute |
There was a problem hiding this comment.
The dedup check echoes SKIP_ARTICLE_GENERATION=true but does not actually set/persist it for later steps, so article generation won’t be skipped as described. Persist the flag (e.g., $GITHUB_ENV) and gate the generation step on it.
|
@copilot apply changes based on the comments in this thread |
…isibility Previously echo "SKIP_ARTICLE_GENERATION=true" only printed to stdout. Now sets both the shell variable and persists to $GITHUB_ENV so downstream steps can gate article generation on it. Agent-Logs-Url: https://github.com/Hack23/riksdagsmonitor/sessions/044f3ceb-e4f2-4c05-a107-7f8916af96c7 Co-authored-by: pethers <1726836+pethers@users.noreply.github.com>
Fixed in |
🔍 Lighthouse Performance Audit
📥 Download full Lighthouse report Budget Compliance: Performance budgets enforced via |
Agentic workflows were calling
safeoutputs___noopand exiting early when articles already existed for the target date, skipping the mandatory 15-20 minute deep political analysis phase entirely.Root cause
The
MANDATORY Deduplication Checkin all 9 content workflows hadexit 0+ noop instruction when articles existed:Changes
exit 0toSKIP_ARTICLE_GENERATIONflag persisted via$GITHUB_ENV; added analysis-first no-exceptions rule to AI-Driven Analysis Protocolexit 0with flag-based skip persisted to$GITHUB_ENVfor cross-step visibility❌ NEVER use safeoutputs___noop because articles already existto all safe-output rule listsValid noop after this change
Only when MCP server is completely unreachable AND no analysis artifacts were produced. "Articles exist" and "another job ran recently" are no longer valid noop reasons.
Post-merge
Run
compile-agentic-workflowsworkflow dispatch to recompile.lock.ymlfiles.