Conversation
Agent-Logs-Url: https://github.com/Hack23/riksdagsmonitor/sessions/b198242a-f2cf-4407-abc3-b206196a8d23 Co-authored-by: pethers <1726836+pethers@users.noreply.github.com>
Agent-Logs-Url: https://github.com/Hack23/riksdagsmonitor/sessions/b22fe912-17fb-4d9e-9e25-a80fa4791482 Co-authored-by: pethers <1726836+pethers@users.noreply.github.com>
…on keep-alive Agent-Logs-Url: https://github.com/Hack23/riksdagsmonitor/sessions/5c4de321-11cd-4a2d-8ec8-a4c5afed87cb Co-authored-by: pethers <1726836+pethers@users.noreply.github.com>
🏷️ Automatic Labeling SummaryThis PR has been automatically labeled based on the files changed and PR metadata. Applied Labels: documentation,workflow,ci-cd,size-m,news,agentic-workflow Label Categories
For more information, see |
🔍 Lighthouse Performance Audit
📥 Download full Lighthouse report Budget Compliance: Performance budgets enforced via |
🔍 Lighthouse Performance Audit
📥 Download full Lighthouse report Budget Compliance: Performance budgets enforced via |
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds a “heartbeat PR” pattern and updates safe-outputs configuration to prevent safeoutputs MCP session expiry from causing silent PR creation failures in longer news workflows.
Changes:
- Increased
safe-outputs.create-pull-request.maxto2for affected workflows to allow a heartbeat PR plus the final PR. - Inserted workflow guidance to create an early heartbeat PR (~minute 19–25) to refresh the safeoutputs session and preserve partial work.
- Updated multiple shell snippets to avoid
$(...)command substitution (AWF-safe), using tempfiles +readinstead.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| .github/workflows/news-weekly-review.md | Enables 2 PRs and adds heartbeat PR guidance; AWF-safe tempfile change in validator snippet |
| .github/workflows/news-week-ahead.md | Enables 2 PRs and adds heartbeat PR guidance |
| .github/workflows/news-translate.md | Replaces $(git branch --show-current) with tempfile + read in two sections |
| .github/workflows/news-propositions.md | Enables 2 PRs and adds heartbeat PR guidance |
| .github/workflows/news-motions.md | Enables 2 PRs and adds heartbeat PR guidance |
| .github/workflows/news-monthly-review.md | Enables 2 PRs, adds heartbeat PR guidance; AWF-safe tempfile change in validator snippet |
| .github/workflows/news-month-ahead.md | Enables 2 PRs and adds heartbeat PR guidance |
| .github/workflows/news-interpellations.md | Enables 2 PRs and adds heartbeat PR guidance |
| .github/workflows/news-evening-analysis.md | Enables 2 PRs; adds heartbeat PR + hard cutoff guidance; AWF-safe tempfile change for file sizing |
| .github/workflows/news-committee-reports.md | Enables 2 PRs and adds heartbeat PR guidance |
| .github/workflows/news-article-generator.md | Enables 2 PRs; adds heartbeat PR + hard cutoff guidance |
| .github/aw/SHARED_PROMPT_PATTERNS.md | Documents heartbeat PR rule; AWF-safe tempfile changes; replaces basename usage with path-pattern case |
| - **Minutes 6–21**: 🚨 **AI Analysis Pass 1 (15 min minimum)**: Read ALL methodology guides, create per-file analysis for EVERY document with Mermaid diagrams, evidence tables, SWOT entries. | ||
| - **Minutes 21–28**: 🚨 **AI Analysis Pass 2 (7 min minimum)**: Read ALL analysis back completely, improve every section, replace ALL script stubs with AI analysis. Run enrichment verification gate. | ||
| - **Minutes 22–25**: 🫀 **Heartbeat PR** — `git add && git commit` analysis artifacts so far, then `safeoutputs___create_pull_request` (title `🫀 Heartbeat - Weekly Review - {date}`). Refreshes the safeoutputs MCP session (idle timeout ~30–35 min) AND preserves work if later phases fail. Run `git checkout main` after the call so subsequent commits don't stack onto the frozen patch. | ||
| - **Minutes 28–30**: Run ENFORCED Minimum Time Gate + Enrichment Verification Gate (SHARED_PROMPT_PATTERNS.md). Both MUST pass. |
There was a problem hiding this comment.
The timeline ranges overlap: Pass 2 is defined as minutes 21–28, but the Heartbeat PR is scheduled for minutes 22–25 inside that same window. This creates contradictory instructions (do Pass 2 vs stop to commit/PR). Consider splitting Pass 2 into two explicit phases (e.g., 21–22 and 25–28) or moving the heartbeat to a non-overlapping slot so the schedule is internally consistent.
| > # AWF-safe: no $(...) command substitution — use tempfile + read redirection. | ||
| > find "analysis/daily/$ARTICLE_DATE/weekly-review/documents" -maxdepth 1 -name '*.json' 2>/dev/null | wc -l > /tmp/doc_count.txt | ||
| > read doc_count < /tmp/doc_count.txt |
There was a problem hiding this comment.
Writing to a fixed /tmp/doc_count.txt path is vulnerable to cross-step interference (and, on shared machines, symlink clobbering). Prefer a per-process unique temp filename (e.g., include $$) and delete it after reading; if you want stronger safety, use mktemp but avoid $(...) by writing its output to a separate temp path then read-ing it.
| > # AWF-safe: no $(...) command substitution — use tempfile + read redirection. | |
| > find "analysis/daily/$ARTICLE_DATE/weekly-review/documents" -maxdepth 1 -name '*.json' 2>/dev/null | wc -l > /tmp/doc_count.txt | |
| > read doc_count < /tmp/doc_count.txt | |
| > # AWF-safe: no $(...) command substitution — use a per-process temp file + read redirection. | |
| > doc_count_tmp="/tmp/doc_count.$$" | |
| > find "analysis/daily/$ARTICLE_DATE/weekly-review/documents" -maxdepth 1 -name '*.json' 2>/dev/null | wc -l > "$doc_count_tmp" | |
| > read doc_count < "$doc_count_tmp" | |
| > rm -f "$doc_count_tmp" |
| git branch --show-current > /tmp/current-branch.txt | ||
| read CURRENT_BRANCH < /tmp/current-branch.txt |
There was a problem hiding this comment.
Using a fixed /tmp/current-branch.txt filename can collide if this snippet is run in parallel (or if prior runs leave stale data). Use a unique temp path (e.g., suffix with $$) and remove it after reading to avoid cross-run interference.
| git branch --show-current > /tmp/current-branch.txt | |
| read CURRENT_BRANCH < /tmp/current-branch.txt | |
| CURRENT_BRANCH_FILE="/tmp/current-branch-$$.txt" | |
| git branch --show-current > "$CURRENT_BRANCH_FILE" | |
| read CURRENT_BRANCH < "$CURRENT_BRANCH_FILE" | |
| rm -f "$CURRENT_BRANCH_FILE" |
| FSIZE=$(wc -c < "$ANALYSIS_DIR/$REQUIRED_FILE") | ||
| # AWF-safe: no $(...) command substitution — use tempfile + read redirection. | ||
| wc -c < "$ANALYSIS_DIR/$REQUIRED_FILE" | tr -d ' ' > /tmp/fsize-$$.txt | ||
| read FSIZE < /tmp/fsize-$$.txt |
There was a problem hiding this comment.
The tempfile /tmp/fsize-$$.txt is reused and never cleaned up. Consider removing it after reading (or using a trap cleanup) to avoid accumulating temp artifacts across repeated gate executions.
| read FSIZE < /tmp/fsize-$$.txt | |
| read FSIZE < /tmp/fsize-$$.txt | |
| rm -f /tmp/fsize-$$.txt |
|
@copilot apply changes based on the comments in this thread |
…cleanup Agent-Logs-Url: https://github.com/Hack23/riksdagsmonitor/sessions/8de83f76-d244-4c87-b09e-f57daf675d07 Co-authored-by: pethers <1726836+pethers@users.noreply.github.com>
Addressed all 4 review comments in b4a4397:
|
🔍 Lighthouse Performance Audit
📥 Download full Lighthouse report Budget Compliance: Performance budgets enforced via |
Fix safeoutputs MCP session expiry causing silent PR failures across all news workflows
The safeoutputs Streamable-HTTP MCP session expires after ~30–35 min idle. Ten content workflows called
safeoutputs___create_pull_requestonly once at minute 40–45 — past the expiry window — producingsession not foundfailures and silently discarding all work (confirmed: PR #1835, run #24672037751).Every
safeoutputs___create_pull_requestcall resets the session idle timer. The fix adds an early "heartbeat PR" call that both keeps the session alive and acts as a safety net if later phases fail.Completed
safe-outputs.create-pull-request.max: 2added to all 10 content workflowsSHARED_PROMPT_PATTERNS.md— rule Sync styles.css from Hack23/homepage #2 "Heartbeat PR" under UNIVERSAL SAFE OUTPUT RULES>= 25 minhard-cutoff bullet in article-generator and evening-analysisReview comments addressed
/tmp/doc_count.txt→ per-process/tmp/doc_count.$$+rm -fcleanup innews-weekly-review.mdandnews-monthly-review.md/tmp/current-branch.txt→ per-process/tmp/current-branch-$$.txt+rm -fcleanup innews-translate.md(both occurrences)/tmp/fsize-$$.txt— addedrm -fcleanup after everyread FSIZEinSHARED_PROMPT_PATTERNS.md(2 places) andnews-evening-analysis.md