Skip to content

Propagate workflow timeout to Copilot SDK driver sessions#37262

Merged
pelikhan merged 2 commits into
mainfrom
copilot/copilot-sdk-driver-fix-timeout-value
Jun 6, 2026
Merged

Propagate workflow timeout to Copilot SDK driver sessions#37262
pelikhan merged 2 commits into
mainfrom
copilot/copilot-sdk-driver-fix-timeout-value

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jun 6, 2026

Copilot SDK driver runs were timing out at the hardcoded 600000ms default while waiting for session.idle, even when workflow timeout-minutes was higher. The SDK path was not consistently receiving the workflow timeout budget needed to derive COPILOT_SDK_SEND_TIMEOUT_MS.

  • Timeout propagation

    • Set GH_AW_TIMEOUT_MINUTES in the Copilot execution step env for SDK-driver runs, using the effective workflow timeout (explicit value or default).
    • This restores the intended process_runner.cjs derivation path for COPILOT_SDK_SEND_TIMEOUT_MS.
  • Timeout value normalization

    • Hardened parsing to accept both normalized and prefixed forms of timeout values (e.g. raw value vs timeout-minutes: ...) before writing env.
  • Coverage updates

    • Extended Copilot engine tests to assert timeout env emission in SDK mode for:
      • default timeout
      • expression-based timeout (e.g. ${{ inputs.timeout }})
timeoutValue := strconv.Itoa(int(constants.DefaultAgenticWorkflowTimeout / time.Minute))
if workflowData.TimeoutMinutes != "" {
    rawTimeoutValue := strings.TrimSpace(workflowData.TimeoutMinutes)
    if strings.HasPrefix(rawTimeoutValue, "timeout-minutes:") {
        rawTimeoutValue = strings.TrimSpace(strings.TrimPrefix(rawTimeoutValue, "timeout-minutes:"))
    }
    if rawTimeoutValue != "" {
        timeoutValue = rawTimeoutValue
    }
}
env["GH_AW_TIMEOUT_MINUTES"] = timeoutValue

Copilot AI and others added 2 commits June 6, 2026 05:22
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
@pelikhan pelikhan marked this pull request as ready for review June 6, 2026 05:49
Copilot AI review requested due to automatic review settings June 6, 2026 05:49
@pelikhan pelikhan merged commit e76a712 into main Jun 6, 2026
@pelikhan pelikhan deleted the copilot/copilot-sdk-driver-fix-timeout-value branch June 6, 2026 05:49
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 fixes Copilot SDK driver runs timing out at the SDK’s default send timeout by propagating the effective workflow timeout-minutes budget into the Copilot execution step environment (GH_AW_TIMEOUT_MINUTES), enabling process_runner.cjs to derive COPILOT_SDK_SEND_TIMEOUT_MS correctly.

Changes:

  • Emit GH_AW_TIMEOUT_MINUTES in Copilot execution step env, derived from the workflow timeout (default or configured), and reuse the same normalized value for the step’s timeout-minutes.
  • Normalize workflowData.TimeoutMinutes parsing to accept both prefixed (timeout-minutes: ...) and already-normalized forms before emitting env/step fields.
  • Extend Copilot engine tests to cover default timeout emission and expression-based timeout propagation in Copilot SDK mode.
Show a summary per file
File Description
pkg/workflow/copilot_engine_execution.go Derives a normalized timeout value, adds GH_AW_TIMEOUT_MINUTES to the Copilot step env, and unifies step timeout-minutes emission.
pkg/workflow/copilot_engine_test.go Adds assertions (including expression coverage) that SDK mode emits GH_AW_TIMEOUT_MINUTES derived from the workflow timeout.
actions/setup/js/handle_agent_failure.cjs Formatting-only change to the effective-tokens context import.
actions/setup/js/effective_tokens_context.cjs Formatting-only changes to pattern array and a wrapped assignment.
actions/setup/js/copilot_sdk_driver.test.cjs Formatting-only change to a test fixture argument array.
actions/setup/js/copilot_sdk_driver.cjs Minor JSDoc cast formatting simplification (no behavior change).

Copilot's findings

Tip

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

  • Files reviewed: 6/6 changed files
  • Comments generated: 0

dsyme added a commit that referenced this pull request Jun 6, 2026
PR #37262 (e76a712) added GH_AW_TIMEOUT_MINUTES to the agent step env
in copilot_engine_execution.go but did not refresh the wasm golden
fixtures. Regenerated via 'make update-wasm-golden'.
dsyme added a commit that referenced this pull request Jun 6, 2026
…ng infrastructure fields (#37299)

* fix patch/bindle file paths

* remove all mention of patch_path and bundle_path

* recompile workflow

* recompile workflow

* Update wasm golden files for GH_AW_TIMEOUT_MINUTES env var

PR #37262 (e76a712) added GH_AW_TIMEOUT_MINUTES to the agent step env
in copilot_engine_execution.go but did not refresh the wasm golden
fixtures. Regenerated via 'make update-wasm-golden'.

* docs: replace Effective Tokens terminology with AI Credits (AIC)

* docs: rename GH_AW_DEFAULT_MAX_EFFECTIVE_TOKENS → GH_AW_DEFAULT_MAX_AI_CREDITS

* clean old stuff
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