Skip to content

fix: news-translate workflow timeout — add batch limiting and time guards#1293

Merged
pethers merged 3 commits intomainfrom
copilot/debug-news-translate-articles
Mar 19, 2026
Merged

fix: news-translate workflow timeout — add batch limiting and time guards#1293
pethers merged 3 commits intomainfrom
copilot/debug-news-translate-articles

Conversation

Copy link
Contributor

Copilot AI commented Mar 19, 2026

The news-translate scheduled workflow timed out at 45 minutes when 3+ EN article types needed translation into 12 languages (36 files). The agent spent its entire budget on translation work without ever reaching PR creation.

Changes

  • Timeout increase: 45 → 60 minutes in frontmatter (recompiled lock.yml)
  • Batch limiting: Caps at 2 article types per scheduled run when scanning finds >2 untranslated types. Remaining types deferred to next cron trigger.
    # Sort alphabetically for deterministic batch selection, then take first 2
    SORTED_TYPES=$(echo "$UNTRANSLATED_TYPES" | tr ',' '\n' | sort | tr '\n' ',' | sed 's/,$//')
    BATCH_TYPES=$(echo "$SORTED_TYPES" | cut -d',' -f1-2)
  • Time guards: Parity check step (3c) checks elapsed time and skips to validation/PR creation if >40 min have passed
    TIME_GUARD_SECONDS=2400  # 40 minutes
    ELAPSED=$(( $(date +%s) - START_TIME ))
    if [ "$ELAPSED" -gt "$TIME_GUARD_SECONDS" ]; then
      exit 0  # skip to validation + PR
    fi
  • Simplified enhancement step: Renamed to "Quick Parity Check" — only intervenes on critical structural issues (line count >3x or <0.3x EN source), trusting the TypeScript script baseline output
  • Error handling: Added batch limiting scenario to error table; emphasized partial PR > timeout failure
Original prompt

This section details on the original issue you should resolve

<issue_title>[aw] News: Translate Articles failed</issue_title>
<issue_description>### Workflow Failure

Workflow: News: Translate Articles
Branch: main
Run: https://github.com/Hack23/riksdagsmonitor/actions/runs/23292372553

Action Required

Option 1: Debug using any coding agent

Use this prompt with any coding agent (GitHub Copilot, Claude, Gemini, etc.):

Debug the agentic workflow failure using https://raw.githubusercontent.com/github/gh-aw/main/debug.md

The failed workflow run is at https://github.com/Hack23/riksdagsmonitor/actions/runs/23292372553

Option 2: Assign this issue to Copilot

Assign this issue to Copilot using the agentic-workflows sub-agent to automatically debug and fix the workflow failure.

Option 3: Manually invoke the agent

Debug this workflow failure using your favorite Agent CLI and the agentic-workflows prompt.

[!TIP]
To stop a workflow from creating failure issues, set report-failure-as-issue: false in its frontmatter:

safe-outputs:
  report-failure-as-issue: false

Generated from News: Translate Articles ·

  • expires on Mar 26, 2026, 12:05 PM UTC

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

Custom agent used: agentic-workflows
GitHub Agentic Workflows (gh-aw) - Create, debug, and upgrade AI-powered workflows with intelligent prompt routing


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@github-actions github-actions bot added the size-xs Extra small change (< 10 lines) label Mar 19, 2026
@github-actions
Copy link
Contributor

🏷️ 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
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

… news-translate workflow

- Increase timeout-minutes from 45 to 60 to prevent premature timeout
- Add batch limiting: max 2 article types per run when scanning all
- Add time guard: skip parity check if 40+ min elapsed
- Simplify enhancement step (3c) to only fix critical issues
- Update error handling table with batch limit guidance
- Recompile lock.yml with gh-aw v0.62.0

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 Mar 19, 2026
…med time guard constant

Co-authored-by: pethers <1726836+pethers@users.noreply.github.com>
@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

@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

Copilot AI changed the title [WIP] Debug workflow failure in news translate articles fix: news-translate workflow timeout — add batch limiting and time guards Mar 19, 2026
Copilot AI requested a review from pethers March 19, 2026 14:12
@pethers pethers marked this pull request as ready for review March 19, 2026 14:15
Copilot AI review requested due to automatic review settings March 19, 2026 14:15
@pethers pethers merged commit fa56ed7 into main Mar 19, 2026
16 checks passed
@pethers pethers deleted the copilot/debug-news-translate-articles branch March 19, 2026 14:16
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

Updates the agentic news-translate workflow prompt and compiled lock workflow to reduce scheduled-run timeouts when many untranslated article types exist, aiming to ensure the workflow reaches validation + PR creation reliably.

Changes:

  • Increased workflow timeout from 45 to 60 minutes (prompt + compiled lock).
  • Added batch limiting guidance (process max 2 untranslated types per run) and introduced time-guard guidance to prioritize creating a partial PR over timing out.
  • Simplified the translation “enhancement” step into a time-conscious “Quick Parity Check”.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
.github/workflows/news-translate.md Adjusts timeout/time budget guidance and adds batch limiting + time guards in the agent prompt.
.github/workflows/news-translate.lock.yml Recompiled lock workflow to apply the 60-minute timeout in the executed job and env.
.github/aw/actions-lock.json Adds the github/gh-aw-actions/setup@v0.62.0 lock entry consistent with the updated compiler version.

ELAPSED=$(( $(date +%s) - START_TIME ))
if [ "$ELAPSED" -gt "$TIME_GUARD_SECONDS" ]; then
echo "⏰ 40+ minutes elapsed — skipping remaining article types to avoid timeout"
echo " Remaining types will be handled by the next scheduled run."
echo "⚠️ BATCH LIMIT: Processing only first 2 types (sorted): $BATCH_TYPES"
echo " Deferred to next run: $REMAINING"
UNTRANSLATED_TYPES="$BATCH_TYPES"
fi

If no untranslated articles are found, call `safeoutputs___noop` with message: "All articles are fully translated. No translation work needed."

**IMPORTANT**: When batch limiting is applied, the agent MUST only process the `BATCH_TYPES` (first 2 article types). Do NOT attempt to translate deferred types — they will be handled by the next scheduled run.
Comment on lines 410 to +416
# Re-derive variables (each code block runs in its own shell session)
source /tmp/gh-aw/agent/timing.env 2>/dev/null || START_TIME=$(date +%s)
TIME_GUARD_SECONDS=2400 # 40 minutes
ELAPSED=$(( $(date +%s) - START_TIME ))
echo "⏰ Elapsed time: $((ELAPSED / 60)) minutes"
if [ "$ELAPSED" -gt "$TIME_GUARD_SECONDS" ]; then
echo "⚠️ 40+ minutes elapsed — skipping parity check to avoid timeout"
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] News: Translate Articles failed

3 participants