Skip to content

Eliminate no-op runs: dedup check controls article generation only, analysis always executes#1613

Merged
pethers merged 4 commits intomainfrom
copilot/track-no-op-runs
Apr 8, 2026
Merged

Eliminate no-op runs: dedup check controls article generation only, analysis always executes#1613
pethers merged 4 commits intomainfrom
copilot/track-no-op-runs

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 8, 2026

Agentic workflows were calling safeoutputs___noop and 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 Check in all 9 content workflows had exit 0 + noop instruction when articles existed:

# Before: kills entire workflow before analysis runs
if [ "$EXISTING" -gt 0 ] && [ "${FORCE_GENERATION}" != "true" ]; then
  echo "📋 Articles already exist — skipping"
  exit 0
fi
# After: flags article generation skip via $GITHUB_ENV, analysis continues
if [ "$EXISTING" -gt 0 ] && [ "${FORCE_GENERATION}" != "true" ]; then
  echo "📋 Articles already exist — article generation will be skipped (analysis still runs)"
  SKIP_ARTICLE_GENERATION=true
  echo "SKIP_ARTICLE_GENERATION=true" >> "$GITHUB_ENV"
fi
# NOTE: Do NOT exit here or call safeoutputs___noop — analysis phase MUST still execute
# Later article-generation steps MUST gate on: if [ "$SKIP_ARTICLE_GENERATION" != "true" ]; then ...

Changes

  • SHARED_PROMPT_PATTERNS.md — Updated standardized dedup pattern from exit 0 to SKIP_ARTICLE_GENERATION flag persisted via $GITHUB_ENV; added analysis-first no-exceptions rule to AI-Driven Analysis Protocol
  • 9 content workflows (committee-reports, propositions, motions, interpellations, week-ahead, weekly-review, month-ahead, monthly-review, evening-analysis):
    • Replaced exit 0 with flag-based skip persisted to $GITHUB_ENV for cross-step visibility
    • Renamed "Step 1: Check Recent Generation" → "Step 1: Check Existing Articles (Analysis Always Runs)"
    • Added ❌ NEVER use safeoutputs___noop because articles already exist to all safe-output rule lists
    • Restricted valid noop to: MCP server unreachable after 3 retries AND zero analysis artifacts
  • article-generator, realtime-monitor — Updated NON-NEGOTIABLE RULES with analysis-only PR as required output option

Valid 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-workflows workflow dispatch to recompile .lock.yml files.

Copilot AI linked an issue Apr 8, 2026 that may be closed by this pull request
@github-actions github-actions bot added the size-xs Extra small change (< 10 lines) label Apr 8, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 8, 2026

🏷️ Automatic Labeling Summary

This PR has been automatically labeled based on the files changed and PR metadata.

Applied Labels: size-xs

Label Categories

  • 🗳️ Content: news, dashboard, visualization, intelligence
  • 💻 Technology: html-css, javascript, workflow, security
  • 📊 Data: cia-data, riksdag-data, data-pipeline, schema
  • 🌍 I18n: i18n, translation, rtl
  • 🔒 ISMS: isms, iso-27001, nist-csf, cis-controls
  • 🏗️ Infrastructure: ci-cd, deployment, performance, monitoring
  • 🔄 Quality: testing, accessibility, documentation, refactor
  • 🤖 AI: agent, skill, agentic-workflow

For more information, see .github/labeler.yml.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 8, 2026

🔍 Lighthouse Performance Audit

Category Score Status
Performance 85/100 🟡
Accessibility 95/100 🟢
Best Practices 90/100 🟢
SEO 95/100 🟢

📥 Download full Lighthouse report

Budget Compliance: Performance budgets enforced via budget.json

…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>
@github-actions github-actions bot added documentation Documentation updates workflow GitHub Actions workflows ci-cd CI/CD pipeline changes news News articles and content generation agentic-workflow Agentic workflow changes size-m Medium change (50-250 lines) labels Apr 8, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 8, 2026

🔍 Lighthouse Performance Audit

Category Score Status
Performance 85/100 🟡
Accessibility 95/100 🟢
Best Practices 90/100 🟢
SEO 95/100 🟢

📥 Download full Lighthouse report

Budget Compliance: Performance budgets enforced via budget.json

- 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>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 8, 2026

🔍 Lighthouse Performance Audit

Category Score Status
Performance 85/100 🟡
Accessibility 95/100 🟢
Best Practices 90/100 🟢
SEO 95/100 🟢

📥 Download full Lighthouse report

Budget Compliance: Performance budgets enforced via budget.json

Copilot AI changed the title [WIP] Add tracking for no-op runs in agentic workflows Eliminate no-op runs: dedup check controls article generation only, analysis always executes Apr 8, 2026
Copilot AI requested a review from pethers April 8, 2026 15:27
@pethers pethers marked this pull request as ready for review April 8, 2026 15:52
Copilot AI review requested due to automatic review settings April 8, 2026 15:52
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +873 to 878
# 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
Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Comment on lines 309 to +315
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
Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Comment on lines 287 to +294
# 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
Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Comment on lines +287 to +289
echo "SKIP_ARTICLE_GENERATION=true"
fi
# NOTE: Do NOT exit here or call safeoutputs___noop — analysis phase MUST still execute
Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
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'

Copilot uses AI. Check for mistakes.
Comment on lines 300 to +307
# 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
Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Comment on lines 290 to +297
# 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
Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Comment on lines 320 to +327
# 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
Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Comment on lines 321 to +328
# 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
Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Comment on lines 332 to +339
# 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
Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Comment on lines 325 to +331
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
Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 uses AI. Check for mistakes.
@pethers
Copy link
Copy Markdown
Member

pethers commented Apr 8, 2026

@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>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 8, 2026

@copilot apply changes based on the comments in this thread

Fixed in 2a487f4. All 10 dedup bash blocks now set the shell variable locally (SKIP_ARTICLE_GENERATION=true) AND persist it via echo "SKIP_ARTICLE_GENERATION=true" >> "$GITHUB_ENV" so downstream steps can gate on it. This follows the same pattern already used for ARTICLE_DATE persistence elsewhere in the workflows. All 143 workflow tests pass.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 8, 2026

🔍 Lighthouse Performance Audit

Category Score Status
Performance 85/100 🟡
Accessibility 95/100 🟢
Best Practices 90/100 🟢
SEO 95/100 🟢

📥 Download full Lighthouse report

Budget Compliance: Performance budgets enforced via budget.json

@pethers pethers merged commit 6b6702a into main Apr 8, 2026
13 checks passed
@pethers pethers deleted the copilot/track-no-op-runs branch April 8, 2026 17:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agentic-workflow Agentic workflow changes ci-cd CI/CD pipeline changes documentation Documentation updates news News articles and content generation size-m Medium change (50-250 lines) size-xs Extra small change (< 10 lines) workflow GitHub Actions workflows

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[aw] No-Op Runs

3 participants