Skip to content

Comments

Add mandatory MCP health gate with abort-on-unavailability to all 10 agentic workflows#465

Merged
pethers merged 6 commits intomainfrom
copilot/add-mcp-health-gate
Feb 23, 2026
Merged

Add mandatory MCP health gate with abort-on-unavailability to all 10 agentic workflows#465
pethers merged 6 commits intomainfrom
copilot/add-mcp-health-gate

Conversation

Copy link
Contributor

Copilot AI commented Feb 23, 2026

Agentic workflows called get_sync_status() as a warm-up hint but never enforced abort on failure — agents could fall back to analyzing existing repo articles or fabricating content when MCP was unreachable, silently committing recycled/hallucinated output.

Changes

All 10 news-*.md workflow definitions

Added ## MANDATORY MCP Health Gate section immediately after ## MANDATORY Date Validation in each file:

## MANDATORY MCP Health Gate

Before generating ANY articles, verify MCP connectivity:

1. Call `get_sync_status({})` — if successful, proceed
2. If it fails, wait 30 seconds and retry (up to 3 total attempts)
3. If ALL 3 attempts fail:
   - Use `safeoutputs___noop` with message: "MCP server unavailable after 3 connection attempts. No articles generated."
   - DO NOT analyze existing articles in the repository
   - DO NOT fabricate or recycle content
   - The workflow MUST end with noop

**CRITICAL**: ALL article content MUST originate from live MCP data. Never generate content from:
- Existing articles in the news/ directory
- Cached or stale data
- AI-generated content without MCP source data

news-realtime-monitor.md — contradiction fix

The existing Error Handling section previously said "MCP server unavailable … let workflow FAIL (don't use noop)", directly contradicting the new health gate. Updated to: "Follow MCP Health Gate — retry 3 times, then call safeoutputs___noop".

sitemap.xml — merge conflict

Our branch hadn't touched this generated file; resolved by bringing it up to date with main.

Lock files (*.lock.yml) do not need recompilation — they use {{#runtime-import}} to load the .md body dynamically at runtime.

Original prompt

This section details on the original issue you should resolve

<issue_title>Agentic workflows: Add MCP health gate with abort on unavailability</issue_title>
<issue_description>## 📋 Issue Type
Feature / Agentic Workflow Improvement

🎯 Objective

Update all agentic workflow definition files (.github/workflows/news-*.md) to add explicit MCP health check validation with abort behavior. Currently, the workflows call get_sync_status() but don't enforce failure if MCP is unreachable — the agent can still proceed to generate articles from existing file analysis or fabricate content.

📊 Current State

In all 10 workflow .md files:

  • get_sync_status({}) is called as warm-up but failure is not enforced
  • The workflow prompt says "ALWAYS call get_sync_status() FIRST" but doesn't say "ABORT if it fails"
  • Agent can fall back to analyzing existing articles in the repo when MCP is unavailable
  • This leads to fabricated or recycled content being committed as new articles
  • No explicit instruction to use noop when MCP is truly unavailable

🚀 Desired State

Each workflow .md file should include:

  1. Explicit MCP health gate: "If get_sync_status() fails after 3 retries, use safeoutputs___noop with message 'MCP server unavailable' and DO NOT generate any articles"
  2. Anti-fabrication rule: "NEVER generate articles by analyzing existing articles in the repo. ALL content MUST come from live MCP data"
  3. Connection retry instructions: "Try get_sync_status() up to 3 times with 30-second waits between attempts before declaring MCP unavailable"
  4. Clear abort path: "If MCP is unavailable: noop. If MCP returns empty data: noop. If MCP returns data: generate articles"

🔧 Implementation Approach

Target files: .github/workflows/news-*.md (all 10 workflow definition files)

Add a new section after "MANDATORY Date Validation" in each workflow:

## MANDATORY MCP Health Gate

Before generating ANY articles, verify MCP connectivity:

1. Call `get_sync_status({})` — if successful, proceed
2. If it fails, wait 30 seconds and retry (up to 3 total attempts)
3. If ALL 3 attempts fail:
   - Use `safeoutputs___noop` with message: "MCP server unavailable after 3 connection attempts. No articles generated."
   - DO NOT analyze existing articles in the repository
   - DO NOT fabricate or recycle content
   - The workflow MUST end with noop

**CRITICAL**: ALL article content MUST originate from live MCP data. Never generate content from:
- Existing articles in the news/ directory
- Cached or stale data
- AI-generated content without MCP source data

✅ Acceptance Criteria

  • All 10 workflow .md files include MCP health gate section
  • Clear 3-retry-then-abort instruction in each workflow
  • Anti-fabrication rule explicitly stated
  • noop used correctly when MCP unavailable
  • Lock files recompiled after workflow changes
  • Consistent wording across all 10 workflows

📚 References

  • .github/workflows/news-motions.md
  • .github/workflows/news-propositions.md
  • .github/workflows/news-committee-reports.md
  • .github/workflows/news-evening-analysis.md
  • .github/workflows/news-realtime-monitor.md
  • .github/workflows/news-week-ahead.md
  • .github/workflows/news-month-ahead.md
  • .github/workflows/news-weekly-review.md
  • .github/workflows/news-monthly-review.md
  • .github/workflows/news-article-generator.md

🤖 Recommended Agent

Copilot coding agent — update all 10 workflow .md files with MCP health gate</issue_description>

<agent_instructions>Focus ONLY on the .github/workflows/news-*.md files (all 10 workflow definition files). Add a new section called 'MANDATORY MCP Health Gate' after the 'MANDATORY Date Validation' section in EACH file. The section should instruct the agent to: (1) call get_sync_status() up to 3 times with 30-second waits, (2) if all 3 fail, use safeoutputs___noop with message about MCP unavailability, (3) NEVER generate articles from existing repo content or fabricated data. Also add an anti-fabrication rule. Make the wording consistent across all 10 files. Do NOT modify any TypeScript files (scripts/), test files, or lock.yml files to avoid merge conflicts.</agent_instructions>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI changed the title [WIP] Add MCP health gate with abort on unavailability Add MANDATORY MCP Health Gate with abort-on-unavailability to all 10 agentic workflows Feb 23, 2026
Copilot AI requested a review from pethers February 23, 2026 07:48
Copilot AI changed the title Add MANDATORY MCP Health Gate with abort-on-unavailability to all 10 agentic workflows Add mandatory MCP health gate with abort-on-unavailability to all 10 agentic workflows Feb 23, 2026
@pethers pethers requested a review from Copilot February 23, 2026 10:47
@github-actions github-actions bot added documentation Documentation updates workflow GitHub Actions workflows ci-cd CI/CD pipeline changes deployment Deployment configuration news News articles and content generation agentic-workflow Agentic workflow changes size-xl Extra large change (> 1000 lines) labels Feb 23, 2026
Copy link
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

This PR strengthens the repository’s agentic news workflows by adding a mandatory MCP connectivity “health gate” so workflows abort early (via noop) when the MCP server is unavailable, preventing generation from repo content or fabricated sources.

Changes:

  • Added a standardized “MANDATORY MCP Health Gate” section to all 10 news-*.md workflow definitions.
  • Introduced explicit 3-attempt retry guidance and a required noop abort path on MCP unavailability.
  • Added explicit anti-fabrication / anti-recycling instructions tying all article content to live MCP data.

Reviewed changes

Copilot reviewed 10 out of 11 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
.github/workflows/news-weekly-review.md Adds MCP health gate before generation to enforce MCP-sourced content only.
.github/workflows/news-week-ahead.md Adds MCP health gate + noop abort path prior to prospective generation.
.github/workflows/news-realtime-monitor.md Adds MCP health gate to prevent breaking-news generation without live MCP connectivity.
.github/workflows/news-propositions.md Adds MCP health gate to prevent proposition articles without live MCP data.
.github/workflows/news-motions.md Adds MCP health gate to prevent motions articles without live MCP data.
.github/workflows/news-monthly-review.md Adds MCP health gate to prevent monthly review generation without live MCP data.
.github/workflows/news-month-ahead.md Adds MCP health gate to prevent month-ahead generation without live MCP data.
.github/workflows/news-evening-analysis.md Adds MCP health gate to prevent evening analysis generation without live MCP data.
.github/workflows/news-committee-reports.md Adds MCP health gate to prevent committee report articles without live MCP data.
.github/workflows/news-article-generator.md Adds MCP health gate to prevent manual multi-type generation without live MCP data.
Comments suppressed due to low confidence (9)

.github/workflows/news-week-ahead.md:138

  • The MCP health gate adds a required noop when MCP is unreachable, but the later PR creation rule says noop is ONLY allowed if there are genuinely no upcoming calendar events. In the MCP-unavailable scenario the agent can’t validate that condition, so the instructions conflict. Adjust the PR creation/noop rules to explicitly permit noop when the MCP health gate fails.
## MANDATORY MCP Health Gate

Before generating ANY articles, verify MCP connectivity:

1. Call `get_sync_status({})` — if successful, proceed
2. If it fails, wait 30 seconds and retry (up to 3 total attempts)
3. If ALL 3 attempts fail:
   - Use `safeoutputs___noop` with message: "MCP server unavailable after 3 connection attempts. No articles generated."
   - DO NOT analyze existing articles in the repository
   - DO NOT fabricate or recycle content
   - The workflow MUST end with noop

**CRITICAL**: ALL article content MUST originate from live MCP data. Never generate content from:
- Existing articles in the news/ directory
- Cached or stale data
- AI-generated content without MCP source data

## MANDATORY PR Creation

- ✅ `safeoutputs___create_pull_request` when articles generated
- ✅ `noop` ONLY if genuinely no upcoming calendar events
- ❌ NEVER use `noop` as fallback for PR creation failures

.github/workflows/news-propositions.md:138

  • The MCP health gate adds a mandatory noop path when MCP is unreachable, but the later PR creation rule says noop is ONLY allowed if there are genuinely no new propositions. In the MCP-down case the agent can’t confirm that condition, so the rules conflict. Update the PR creation/noop criteria to explicitly allow noop when the MCP health gate fails.
## MANDATORY MCP Health Gate

Before generating ANY articles, verify MCP connectivity:

1. Call `get_sync_status({})` — if successful, proceed
2. If it fails, wait 30 seconds and retry (up to 3 total attempts)
3. If ALL 3 attempts fail:
   - Use `safeoutputs___noop` with message: "MCP server unavailable after 3 connection attempts. No articles generated."
   - DO NOT analyze existing articles in the repository
   - DO NOT fabricate or recycle content
   - The workflow MUST end with noop

**CRITICAL**: ALL article content MUST originate from live MCP data. Never generate content from:
- Existing articles in the news/ directory
- Cached or stale data
- AI-generated content without MCP source data

## MANDATORY PR Creation

- ✅ `safeoutputs___create_pull_request` when articles generated
- ✅ `noop` ONLY if genuinely no new propositions
- ❌ NEVER use `noop` as fallback for PR creation failures

.github/workflows/news-motions.md:138

  • The MCP health gate mandates noop when MCP is unavailable, but the later PR creation rule says noop is ONLY allowed if there are genuinely no new motions. In the MCP-down case the agent can’t validate that, so the instructions conflict. Update the PR creation/noop rules to explicitly permit noop when the MCP health gate fails.
## MANDATORY MCP Health Gate

Before generating ANY articles, verify MCP connectivity:

1. Call `get_sync_status({})` — if successful, proceed
2. If it fails, wait 30 seconds and retry (up to 3 total attempts)
3. If ALL 3 attempts fail:
   - Use `safeoutputs___noop` with message: "MCP server unavailable after 3 connection attempts. No articles generated."
   - DO NOT analyze existing articles in the repository
   - DO NOT fabricate or recycle content
   - The workflow MUST end with noop

**CRITICAL**: ALL article content MUST originate from live MCP data. Never generate content from:
- Existing articles in the news/ directory
- Cached or stale data
- AI-generated content without MCP source data

## MANDATORY PR Creation

- ✅ `safeoutputs___create_pull_request` when articles generated
- ✅ `noop` ONLY if genuinely no new motions
- ❌ NEVER use `noop` as fallback for PR creation failures

.github/workflows/news-monthly-review.md:140

  • The MCP health gate introduces a mandatory noop when MCP is unreachable, but the later PR creation rule says noop is ONLY allowed if there is genuinely no parliamentary activity in the past month. In the MCP-down case the agent can’t verify that condition, so the instructions conflict. Update the PR creation/noop criteria to explicitly allow noop when the MCP health gate fails.
## MANDATORY MCP Health Gate

Before generating ANY articles, verify MCP connectivity:

1. Call `get_sync_status({})` — if successful, proceed
2. If it fails, wait 30 seconds and retry (up to 3 total attempts)
3. If ALL 3 attempts fail:
   - Use `safeoutputs___noop` with message: "MCP server unavailable after 3 connection attempts. No articles generated."
   - DO NOT analyze existing articles in the repository
   - DO NOT fabricate or recycle content
   - The workflow MUST end with noop

**CRITICAL**: ALL article content MUST originate from live MCP data. Never generate content from:
- Existing articles in the news/ directory
- Cached or stale data
- AI-generated content without MCP source data

## MANDATORY PR Creation

- ✅ `safeoutputs___create_pull_request` when articles generated
- ✅ `noop` ONLY if genuinely no parliamentary activity in past month
- ❌ NEVER use `noop` as fallback for PR creation failures

.github/workflows/news-month-ahead.md:140

  • The MCP health gate mandates noop when MCP is unavailable, but the later PR creation rule says noop is ONLY allowed if there are genuinely no upcoming events in the next 30 days. In the MCP-down case the agent can’t validate that condition, so the instructions conflict. Update the PR creation/noop rules to explicitly allow noop when the MCP health gate fails.
## MANDATORY MCP Health Gate

Before generating ANY articles, verify MCP connectivity:

1. Call `get_sync_status({})` — if successful, proceed
2. If it fails, wait 30 seconds and retry (up to 3 total attempts)
3. If ALL 3 attempts fail:
   - Use `safeoutputs___noop` with message: "MCP server unavailable after 3 connection attempts. No articles generated."
   - DO NOT analyze existing articles in the repository
   - DO NOT fabricate or recycle content
   - The workflow MUST end with noop

**CRITICAL**: ALL article content MUST originate from live MCP data. Never generate content from:
- Existing articles in the news/ directory
- Cached or stale data
- AI-generated content without MCP source data

## MANDATORY PR Creation

- ✅ `safeoutputs___create_pull_request` when articles generated
- ✅ `noop` ONLY if genuinely no upcoming events in next 30 days
- ❌ NEVER use `noop` as fallback for PR creation failures

.github/workflows/news-committee-reports.md:145

  • The MCP health gate mandates noop when MCP is unreachable, but the later PR creation section says noop is ONLY allowed if there are genuinely no committee reports from MCP. With MCP unavailable, the agent can’t confirm that condition, so the instructions conflict. Update the PR creation/noop rules to explicitly allow noop when the MCP health gate fails.
## MANDATORY MCP Health Gate

Before generating ANY articles, verify MCP connectivity:

1. Call `get_sync_status({})` — if successful, proceed
2. If it fails, wait 30 seconds and retry (up to 3 total attempts)
3. If ALL 3 attempts fail:
   - Use `safeoutputs___noop` with message: "MCP server unavailable after 3 connection attempts. No articles generated."
   - DO NOT analyze existing articles in the repository
   - DO NOT fabricate or recycle content
   - The workflow MUST end with noop

**CRITICAL**: ALL article content MUST originate from live MCP data. Never generate content from:
- Existing articles in the news/ directory
- Cached or stale data
- AI-generated content without MCP source data

## MANDATORY PR Creation

- ✅ **REQUIRED:** `safeoutputs___create_pull_request` when articles generated
- ✅ **ONLY USE `noop` if genuinely no new committee reports** from riksdag-regering-mcp
- ❌ **NEVER use `noop` as fallback for PR creation failures**

.github/workflows/news-evening-analysis.md:142

  • This MCP health gate mandates ending with noop when MCP is unavailable, but the subsequent "MANDATORY Pull Request Creation" section says the workflow MUST create a PR with analysis or FAIL and that noop is only for "insufficient data" after checking MCP. With MCP unreachable, the workflow can’t satisfy those later criteria, so the instructions are contradictory. Update the PR creation rules to explicitly allow noop when the MCP health gate fails, while keeping the "PR must succeed if articles were generated" requirement.
## MANDATORY MCP Health Gate

Before generating ANY articles, verify MCP connectivity:

1. Call `get_sync_status({})` — if successful, proceed
2. If it fails, wait 30 seconds and retry (up to 3 total attempts)
3. If ALL 3 attempts fail:
   - Use `safeoutputs___noop` with message: "MCP server unavailable after 3 connection attempts. No articles generated."
   - DO NOT analyze existing articles in the repository
   - DO NOT fabricate or recycle content
   - The workflow MUST end with noop

**CRITICAL**: ALL article content MUST originate from live MCP data. Never generate content from:
- Existing articles in the news/ directory
- Cached or stale data
- AI-generated content without MCP source data

### 2. MANDATORY Pull Request Creation (Final Step)

**CRITICAL: Workflow MUST create a PR with analysis or FAIL**

From a reader's perspective: **Where's the analysis?**

- ✅ **REQUIRED:** `safeoutputs___create_pull_request` - When analysis articles generated
- ✅ **ONLY USE `noop` if genuinely insufficient data** (checked riksdag-regering-mcp, found no votes, no debates, no documents, no calendar events for the lookback period)
- ❌ **NEVER use `noop` as a fallback for PR creation failures** - If articles were generated but PR fails, the workflow MUST FAIL

**⚠️ If you generated analysis articles but cannot create PR → workflow FAILS (not noop)**

.github/workflows/news-weekly-review.md:140

  • The MCP health gate introduces a new noop path when MCP is unreachable, but the later "MANDATORY PR Creation" section says noop is ONLY allowed when there is genuinely no weekly activity. This creates conflicting instructions for the agent in the MCP-down case (it can’t verify activity but is told to noop). Update the PR creation/noop criteria to explicitly allow noop when the MCP health gate fails (in addition to the normal no-activity case) so the abort behavior is unambiguous.
## MANDATORY MCP Health Gate

Before generating ANY articles, verify MCP connectivity:

1. Call `get_sync_status({})` — if successful, proceed
2. If it fails, wait 30 seconds and retry (up to 3 total attempts)
3. If ALL 3 attempts fail:
   - Use `safeoutputs___noop` with message: "MCP server unavailable after 3 connection attempts. No articles generated."
   - DO NOT analyze existing articles in the repository
   - DO NOT fabricate or recycle content
   - The workflow MUST end with noop

**CRITICAL**: ALL article content MUST originate from live MCP data. Never generate content from:
- Existing articles in the news/ directory
- Cached or stale data
- AI-generated content without MCP source data

## MANDATORY PR Creation

- ✅ `safeoutputs___create_pull_request` when articles generated
- ✅ `noop` ONLY if genuinely no parliamentary activity in the past week
- ❌ NEVER use `noop` as fallback for PR creation failures

.github/workflows/news-article-generator.md:150

  • This MCP health gate mandates ending with noop when MCP is unavailable, but the following PR creation rules say the workflow MUST create a PR with articles or FAIL and that noop is only for "no new data" after checking MCP. With MCP unreachable, those later criteria can’t be met, so the instructions conflict. Update the PR creation/noop rules to explicitly allow noop when the MCP health gate fails, while still failing if articles were generated but PR creation fails.
## MANDATORY MCP Health Gate

Before generating ANY articles, verify MCP connectivity:

1. Call `get_sync_status({})` — if successful, proceed
2. If it fails, wait 30 seconds and retry (up to 3 total attempts)
3. If ALL 3 attempts fail:
   - Use `safeoutputs___noop` with message: "MCP server unavailable after 3 connection attempts. No articles generated."
   - DO NOT analyze existing articles in the repository
   - DO NOT fabricate or recycle content
   - The workflow MUST end with noop

**CRITICAL**: ALL article content MUST originate from live MCP data. Never generate content from:
- Existing articles in the news/ directory
- Cached or stale data
- AI-generated content without MCP source data

### 2. MANDATORY Pull Request Creation (Final Step)

**CRITICAL: Workflow MUST create a PR with articles or FAIL**

From a reader's perspective: **Where's the article?**

- ✅ **REQUIRED:** `safeoutputs___create_pull_request` - When articles generated
- ✅ **ONLY USE `noop` if genuinely no new data** (checked riksdag-regering-mcp, found no committee reports, no propositions, no significant updates, AND force_generation=false)
- ❌ **NEVER use `noop` as a fallback for PR creation failures** - If articles were generated but PR fails, the workflow MUST FAIL

**⚠️ If you generated articles but cannot create PR → workflow FAILS (not noop)**

Comment on lines +121 to +137
## MANDATORY MCP Health Gate

Before generating ANY articles, verify MCP connectivity:

1. Call `get_sync_status({})` — if successful, proceed
2. If it fails, wait 30 seconds and retry (up to 3 total attempts)
3. If ALL 3 attempts fail:
- Use `safeoutputs___noop` with message: "MCP server unavailable after 3 connection attempts. No articles generated."
- DO NOT analyze existing articles in the repository
- DO NOT fabricate or recycle content
- The workflow MUST end with noop

**CRITICAL**: ALL article content MUST originate from live MCP data. Never generate content from:
- Existing articles in the news/ directory
- Cached or stale data
- AI-generated content without MCP source data

Copy link

Copilot AI Feb 23, 2026

Choose a reason for hiding this comment

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

The MCP health gate mandates ending with safeoutputs___noop if MCP is unavailable, but later in this workflow the Error Handling section states "MCP server unavailable … let workflow FAIL (don't use noop)". These instructions contradict each other; align them by updating/removing the Error Handling guidance so MCP-unavailable consistently results in noop per the health gate.

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 03f5203. The Error Handling section now reads: "Follow MCP Health Gate — retry 3 times, then call safeoutputs___noop with message 'MCP server unavailable after 3 connection attempts. No articles generated.' (do NOT let the workflow fail)" — consistent with the health gate at the top of the file.

@pethers
Copy link
Member

pethers commented Feb 23, 2026

@copilot apply changes based on the comments in this thread

…ith MCP Health Gate (noop on unavailability)

Co-authored-by: pethers <[email protected]>
Copy link
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

Copilot reviewed 10 out of 11 changed files in this pull request and generated no new comments.

@pethers pethers requested a review from Copilot February 23, 2026 14:44
@github-actions github-actions bot added the size-m Medium change (50-250 lines) label Feb 23, 2026
@github-actions
Copy link
Contributor

🔍 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

Copy link
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

Copilot reviewed 10 out of 10 changed files in this pull request and generated no new comments.

@pethers pethers marked this pull request as ready for review February 23, 2026 15:59
@pethers pethers merged commit 33446a8 into main Feb 23, 2026
15 checks passed
@pethers pethers deleted the copilot/add-mcp-health-gate branch February 23, 2026 16: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 deployment Deployment configuration documentation Documentation updates news News articles and content generation size-m Medium change (50-250 lines) size-xl Extra large change (> 1000 lines) workflow GitHub Actions workflows

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Agentic workflows: Add MCP health gate with abort on unavailability

2 participants