Skip to content

Always file forecast outcome issues; add forecast --timeout support and error templating#35492

Merged
pelikhan merged 5 commits into
mainfrom
copilot/create-forecast-issue
May 28, 2026
Merged

Always file forecast outcome issues; add forecast --timeout support and error templating#35492
pelikhan merged 5 commits into
mainfrom
copilot/create-forecast-issue

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 28, 2026

The maintenance forecast operation now always produces an issue with the computed outcome, including timeout/failure cases. Forecast execution is bounded to 10 minutes, while cache warm-up/save behavior remains intact so precomputed data is retained.

  • Forecast job control flow

    • Added id: generate_forecast_report and now runs forecast with built-in timeout handling via --timeout 10.
    • On timeout (124) or non-zero exit, writes ./.cache/gh-aw/forecast/error.json and fails the step.
    • Kept cache warm-up and cache save semantics, with cache save continuing under if: ${{ always() }}.
  • Forecast CLI timeout support

    • Added --timeout <minutes> to gh aw forecast for graceful cancellation after the configured duration.
    • Wired timeout handling to return exit code 124 on deadline expiration so maintenance error handling remains consistent.
    • Added/updated forecast CLI tests for timeout flag parsing and timeout validation.
  • Issue creation semantics

    • Made forecast issue generation unconditional (if: ${{ always() }}) and passed FORECAST_STEP_OUTCOME into the script.
    • Updated issue generation to always create an issue:
      • success: [aw] workflow forecast report
      • non-success outcome: [aw] workflow forecast report (error)
  • Template-driven issue body

    • Moved forecast issue body to setup prompt template:
      • actions/setup/md/forecast_issue.md
    • Refactored create_forecast_issue.cjs to render from template via messages_core helpers, including:
      • report table section
      • timeout/error warning section
      • source run reference
  • Generator/test/doc alignment

    • Mirrored workflow changes in pkg/workflow/maintenance_workflow_yaml.go.
    • Updated maintenance workflow assertions in pkg/workflow/maintenance_workflow_test.go.
    • Updated forecast issue unit tests in actions/setup/js/create_forecast_issue.test.cjs.
    • Updated forecast operation reference text in docs/src/content/docs/reference/ephemerals.md.
- name: Generate forecast report
  id: generate_forecast_report
  run: |
    ${GH_AW_CMD_PREFIX} forecast --repo "${{ github.repository }}" --timeout 10 --json > ./.cache/gh-aw/forecast/report.json
    # on timeout/failure -> write ./.cache/gh-aw/forecast/error.json

- name: Generate forecast issue
  if: ${{ always() }}
  env:
    FORECAST_STEP_OUTCOME: ${{ steps.generate_forecast_report.outcome }}

Copilot AI and others added 4 commits May 28, 2026 04:27
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
@pelikhan
Copy link
Copy Markdown
Collaborator

@copilot the forecast command should support a --timeout minutes to gracefully stop after that duration.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 28, 2026

@copilot the forecast command should support a --timeout minutes to gracefully stop after that duration.

Implemented in 1f87b63: gh aw forecast now supports --timeout <minutes> for graceful cancellation, maps timeout expiry to exit code 124, and the maintenance forecast job now calls forecast --timeout 10 instead of wrapping with shell timeout.

Copilot AI changed the title Always file forecast outcome issues; add 10m forecast timeout and error templating Always file forecast outcome issues; add forecast --timeout support and error templating May 28, 2026
Copilot AI requested a review from pelikhan May 28, 2026 15:09
@pelikhan pelikhan marked this pull request as ready for review May 28, 2026 15:13
Copilot AI review requested due to automatic review settings May 28, 2026 15:13
Copy link
Copy Markdown
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 updates the maintenance forecast flow so forecast runs are bounded by a CLI timeout and outcome issues are generated for success and failure cases.

Changes:

  • Adds --timeout support to the forecast CLI and uses it from the maintenance workflow.
  • Writes forecast error metadata and renders forecast issues from a new Markdown template.
  • Updates workflow generator/tests, docs, and synced workflow metadata.
Show a summary per file
File Description
pkg/workflow/maintenance_workflow_yaml.go Generates the updated forecast maintenance job.
pkg/workflow/maintenance_workflow_test.go Updates assertions for forecast timeout/error issue behavior.
pkg/cli/forecast.go Adds timeout context handling and exit-code normalization.
pkg/cli/forecast_command.go Adds the --timeout CLI flag and config field.
pkg/cli/forecast_test.go Adds timeout flag/validation tests.
actions/setup/js/create_forecast_issue.cjs Creates success/error forecast issues using a template.
actions/setup/js/create_forecast_issue.test.cjs Updates tests for unconditional/error issue behavior.
actions/setup/md/forecast_issue.md Adds the forecast issue body template.
docs/src/content/docs/reference/ephemerals.md Documents new forecast maintenance semantics.
.github/workflows/agentics-maintenance.yml Applies generated forecast maintenance workflow changes.
.github/workflows/pr-sous-chef.lock.yml Updates generated metadata hash.
.github/workflows/contribution-check.lock.yml Updates generated metadata hash.

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 12/12 changed files
  • Comments generated: 3

Comment on lines 637 to +641
- name: Generate forecast issue
if: ${{ always() }}
uses: ` + getCachedActionPinFromResolver("actions/github-script", resolver) + `
env:
FORECAST_STEP_OUTCOME: ${{ steps.generate_forecast_report.outcome }}
Comment on lines 557 to +561
- name: Generate forecast issue
if: ${{ always() }}
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
env:
FORECAST_STEP_OUTCOME: ${{ steps.generate_forecast_report.outcome }}
Comment thread pkg/cli/forecast.go
Comment on lines +160 to +164
if config.TimeoutMinutes > 0 {
timeoutCtx, cancel := context.WithTimeout(ctx, time.Duration(config.TimeoutMinutes)*time.Minute)
defer cancel()
ctx = timeoutCtx
}
@pelikhan pelikhan merged commit 8a4626e into main May 28, 2026
1 check passed
@pelikhan pelikhan deleted the copilot/create-forecast-issue branch May 28, 2026 15:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants