Add mandatory MCP health gate with abort-on-unavailability to all 10 agentic workflows#465
Add mandatory MCP health gate with abort-on-unavailability to all 10 agentic workflows#465
Conversation
Co-authored-by: pethers <[email protected]>
…agentic workflows Co-authored-by: pethers <[email protected]>
There was a problem hiding this comment.
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-*.mdworkflow 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)**
| ## 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 | ||
|
|
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
|
@copilot apply changes based on the comments in this thread |
…ith MCP Health Gate (noop on unavailability) Co-authored-by: pethers <[email protected]>
Co-authored-by: pethers <[email protected]>
🔍 Lighthouse Performance Audit
📥 Download full Lighthouse report Budget Compliance: Performance budgets enforced via |
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-*.mdworkflow definitionsAdded
## MANDATORY MCP Health Gatesection immediately after## MANDATORY Date Validationin each file:news-realtime-monitor.md— contradiction fixThe 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 conflictOur branch hadn't touched this generated file; resolved by bringing it up to date with
main.Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.