-
Notifications
You must be signed in to change notification settings - Fork 1
Consolidate news article CSS and fix workflow error handling #162
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 7 commits
75a8291
56ffcb9
c2564e2
7f25049
10fdc8f
82ca632
8c503de
a94e2ef
eaef579
f77b0db
3f9fe94
7de96c8
bcf1003
39cd80f
f6f261a
739310b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -105,8 +105,56 @@ jobs: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Generate news articles | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Check for recent agentic workflow activity | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if: steps.check-updates.outputs.should_generate == 'true' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| id: check-agentic | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo "π€ Checking for recent agentic workflow activity..." | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if [ -f "news/metadata/workflow-state.json" ]; then | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Check if agentic workflows generated content recently (< 2 hours) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| LAST_AGENTIC=$(jq -r '.lastUpdate // empty' news/metadata/workflow-state.json) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if [ -n "$LAST_AGENTIC" ]; then | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Safely parse lastUpdate and guard against invalid or future timestamps | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if PARSED_AGENTIC_TS=$(date -d "$LAST_AGENTIC" +%s 2>/dev/null); then | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| NOW_TS=$(date +%s) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Check for future timestamp (clock skew or invalid data) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if [ "$PARSED_AGENTIC_TS" -gt "$NOW_TS" ]; then | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Future timestamp - treat as invalid, not recent | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo "agentic_recent=false" >> $GITHUB_OUTPUT | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo "β οΈ Future timestamp in workflow state (clock skew?), proceeding with traditional workflow" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Valid past timestamp - calculate hours ago | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| HOURS_AGO=$(( (NOW_TS - PARSED_AGENTIC_TS) / 3600 )) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if [ "$HOURS_AGO" -lt 2 ]; then | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo "agentic_recent=true" >> $GITHUB_OUTPUT | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo "β Agentic workflows active (${HOURS_AGO}h ago), skipping traditional workflow" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo "agentic_recent=false" >> $GITHUB_OUTPUT | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo "βΉοΈ No recent agentic activity (${HOURS_AGO}h ago), proceeding with traditional workflow" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Unparseable timestamp | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo "agentic_recent=false" >> $GITHUB_OUTPUT | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo "β οΈ Unparseable lastUpdate timestamp in workflow state, proceeding with traditional workflow" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo "agentic_recent=false" >> $GITHUB_OUTPUT | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo "βΉοΈ Invalid lastUpdate in workflow state, proceeding with traditional workflow" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo "agentic_recent=false" >> $GITHUB_OUTPUT | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo "βΉοΈ No agentic workflow state found, proceeding with traditional workflow" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Generate news articles | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if: | | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| steps.check-updates.outputs.should_generate == 'true' && | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| steps.check-agentic.outputs.agentic_recent != 'true' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| id: generate | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| env: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ARTICLE_TYPES: ${{ github.event.inputs.article_types || '' }} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -181,36 +229,97 @@ jobs: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Create metadata directory | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| mkdir -p news/metadata | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Run news generation script | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if [ -f "scripts/generate-news-enhanced.js" ]; then | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| node scripts/generate-news-enhanced.js --types="$ARTICLE_TYPES" --languages="$LANG_ARG" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Check script exists before running | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if [ ! -f "scripts/generate-news-enhanced.js" ]; then | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo "β CRITICAL ERROR: scripts/generate-news-enhanced.js not found" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Check results | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if [ -f "news/metadata/generation-result.json" ]; then | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| GENERATED=$(jq -r '.generated' news/metadata/generation-result.json) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ERRORS=$(jq -r '.errors' news/metadata/generation-result.json) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo "generated=$GENERATED" >> $GITHUB_OUTPUT | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo "errors=$ERRORS" >> $GITHUB_OUTPUT | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo "β Generated $GENERATED articles with $ERRORS errors" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Log structured error | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| cat > news/metadata/errors.json <<EOF | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "lastError": { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "timestamp": "$(date -u +"%Y-%m-%dT%H:%M:%SZ")", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "workflow": "news-generation.yml", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "errorType": "script_missing", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "message": "scripts/generate-news-enhanced.js not found", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "severity": "critical", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "retryable": false | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "errorHistory": [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "timestamp": "$(date -u +"%Y-%m-%dT%H:%M:%SZ")", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "workflow": "news-generation.yml", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "errorType": "script_missing", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "message": "scripts/generate-news-enhanced.js not found", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "severity": "critical", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "retryable": false | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| EOF | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| cat > news/metadata/errors.json <<EOF | |
| { | |
| "lastError": { | |
| "timestamp": "$(date -u +"%Y-%m-%dT%H:%M:%SZ")", | |
| "workflow": "news-generation.yml", | |
| "errorType": "script_missing", | |
| "message": "scripts/generate-news-enhanced.js not found", | |
| "severity": "critical", | |
| "retryable": false | |
| }, | |
| "errorHistory": [ | |
| { | |
| "timestamp": "$(date -u +"%Y-%m-%dT%H:%M:%SZ")", | |
| "workflow": "news-generation.yml", | |
| "errorType": "script_missing", | |
| "message": "scripts/generate-news-enhanced.js not found", | |
| "severity": "critical", | |
| "retryable": false | |
| } | |
| ] | |
| } | |
| EOF | |
| ERROR_TIMESTAMP="$(date -u +"%Y-%m-%dT%H:%M:%SZ")" | |
| jq -n --arg ts "$ERROR_TIMESTAMP" ' | |
| { | |
| lastError: { | |
| timestamp: $ts, | |
| workflow: "news-generation.yml", | |
| errorType: "script_missing", | |
| message: "scripts/generate-news-enhanced.js not found", | |
| severity: "critical", | |
| retryable: false | |
| } | |
| } | |
| | . + { errorHistory: [ .lastError ] } | |
| ' > news/metadata/errors.json |
Copilot
AI
Feb 14, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MCP failure classification is likely incorrect for real timeouts: the workflow only greps for MCP.*timeout/MCP.*unavailable, but the MCP client throws errors like MCP request failed: ${error.message} (often AbortError/"aborted") which wonβt match those patterns. This will misclassify MCP outages/timeouts as script_failure (severity=error) instead of mcp_unavailable (warning). Expand the detection (e.g., case-insensitive grep for AbortError|aborted|mcp request failed|econnrefused|network) or have the generator emit an explicit sentinel on MCP connectivity failures.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 739310b - MCP error detection now includes all actual error patterns from scripts/mcp-client.js:
grep -qi "MCP request failed" || \
grep -qi "AbortError" || \
grep -qi "aborted" || \
grep -qi "ECONNREFUSED" || \
grep -qi "network.*error"This correctly classifies MCP outages as mcp_unavailable (warning) instead of script_failure (error).
Outdated
Copilot
AI
Feb 14, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error logging for script execution failures (lines 287-298) is missing the errorHistory array field, which is inconsistent with the documented schema in news/metadata/README.md and the error logging for script_missing errors (lines 247-256). The errorHistory array should be included in all errors.json writes to maintain schema consistency and avoid breaking tooling that expects this field to exist.
| } | |
| }, | |
| "errorHistory": [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in a94e2ef - added errorHistory array to script execution error logging (lines 297-306), now consistent with script_missing error logging
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The date parsing uses
date -dwhich may not be portable across different Unix systems (GNU date vs BSD date). Consider using a more portable approach or adding a fallback for BSD-based systems to ensure the workflow runs correctly on different runner environments.