Skip to content

Fix Codex fetch integration tests and restore timeout-minutes propagation fallback - #49858

Merged
pelikhan merged 4 commits into
mainfrom
copilot/fix-copilot-issue
Aug 3, 2026
Merged

Fix Codex fetch integration tests and restore timeout-minutes propagation fallback#49858
pelikhan merged 4 commits into
mainfrom
copilot/fix-copilot-issue

Conversation

Copilot AI commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

The linked CI job failed in pkg/workflow due to two regressions: Codex integration tests used an invalid restricted tools.bash config, and engine step timeout emission missed workflows that only had legacy extracted TimeoutMinutes.

  • Timeout resolution compatibility

    • Updated resolveStepTimeoutValue(...) to fall back to workflowData.TimeoutMinutes when ParsedFrontmatter.TimeoutMinutes is absent.
    • Supports both legacy numeric and expression forms by stripping the timeout-minutes: prefix before returning the value.
  • Regression coverage for timeout emission

    • Extended TestAllEnginesEmitTimeoutMinutes with legacy-form cases:
      • timeout-minutes: 30
      • timeout-minutes: ${{ inputs.timeout }}
  • Codex fetch integration test alignment

    • Removed restricted tools.bash allow-list usage from Codex test workflows in:
      • TestCodexFetchDisabledByDefault
      • TestNoWebFetchNoMCPFetchServer
    • These tests now validate fetch behavior without tripping Codex bash allow-list validation.
func resolveStepTimeoutValue(workflowData *WorkflowData) string {
    // ...
    if raw := strings.TrimSpace(workflowData.TimeoutMinutes); raw != "" {
        if after, ok := strings.CutPrefix(raw, "timeout-minutes:"); ok {
            raw = strings.TrimSpace(after)
        }
        if raw != "" {
            return raw
        }
    }
    return defaultValue
}

Run: https://github.com/github/gh-aw/actions/runs/30771772506

Generated by 👨‍🍳 PR Sous Chef · gpt54 · 13.5 AIC · ⌖ 5.05 AIC · ⊞ 8.3K ·
Comment /souschef to run again

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix issue with Copilot integration for action Fix Codex fetch integration tests and restore timeout-minutes propagation fallback Aug 2, 2026
Copilot AI requested a review from pelikhan August 2, 2026 22:38
@pelikhan
pelikhan marked this pull request as ready for review August 2, 2026 22:39
Copilot AI review requested due to automatic review settings August 2, 2026 22:39
@github-actions

github-actions Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

PR Code Quality Reviewer completed the code quality review.

@github-actions

github-actions Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Test Quality Sentinel completed test quality analysis.

@github-actions

github-actions Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅

@github-actions

github-actions Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Design Decision Gate 🏗️ completed the design decision gate check.

No ADR enforcement needed: PR does not have the 'implementation' label and has ≤100 new lines of code in business logic directories (only 20 additions detected).

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Restores timeout propagation compatibility and fixes Codex fetch integration tests.

Changes:

  • Adds legacy timeout fallback handling.
  • Adds numeric and expression regression tests.
  • Removes invalid Codex bash allow-list configuration.
Show a summary per file
File Description
pkg/workflow/fetch_integration_test.go Fixes Codex test fixtures.
pkg/workflow/agentic_engine.go Restores extracted timeout fallback.
pkg/workflow/agentic_engine_test.go Covers legacy timeout forms.

Review details

Tip

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

  • Files reviewed: 3/3 changed files
  • Comments generated: 1
  • Review effort level: Balanced

return v
}
}
if raw := strings.TrimSpace(workflowData.TimeoutMinutes); raw != "" {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in e1da6cd and 028ea2b. The doc comment now documents the three-level precedence: ParsedFrontmatter.TimeoutMinutes → WorkflowData.TimeoutMinutes (raw extracted string, stripped of prefix, validated) → DefaultAgenticWorkflowTimeout.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧵 Reviewed using Impeccable skills by Impeccable Skills Reviewer · sonnet46 · 23.4 AIC · ⌖ 9.31 AIC · ⊞ 5.4K

Comments that could not be inline-anchored

pkg/workflow/agentic_engine.go:714

The doc comment says "no raw-string parsing is needed" but the new fallback block (lines 727–734) does exactly that — it strips the timeout-minutes: prefix from a raw YAML string. The comment should be updated to reflect the new fallback path, e.g.:

// resolveStepTimeoutValue returns the timeout value string to emit on an
// agentic_execution step&#39;s timeout-minutes field. It first reads the
// already-parsed TimeoutMinutes from ParsedFrontmatter; when that is absent
// it falls back …

</details>

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Skills-Based Review 🧠

Applied /diagnosing-bugs and /tdd — one minor comment, overall solid fix.

📋 Key Themes & Highlights

Key Themes

  • Stale doc comment: resolveStepTimeoutValue doc says "no raw-string parsing is needed" but the new fallback does exactly that. Flagged inline.
  • Regression coverage: two new test cases directly cover the bug being fixed — good practice.
  • Fetch test fix: removing the invalid tools.bash allow-list is the correct minimal fix; the test now validates the intended Codex fetch behavior without noise.

Positive Highlights

  • ✅ The fallback strips the timeout-minutes: prefix cleanly with strings.CutPrefix — handles both numeric and expression forms.
  • ✅ New test cases use descriptive names and cover both value shapes (numeric and expression).
  • ✅ No unrelated changes; PR scope is tight.

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · sonnet46 · 27.7 AIC · ⌖ 7.89 AIC · ⊞ 7.1K
Comment /matt to run again

Comments that could not be inline-anchored

pkg/workflow/agentic_engine.go:714

[/diagnosing-bugs] The function doc comment says no raw-string parsing is needed and only mentions ParsedFrontmatter, but the new fallback at lines 727-734 does parse raw strings from workflowData.TimeoutMinutes. The comment is now misleading. Please update it to describe both code paths. @copilot please address this.

@github-actions

github-actions Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

🧪 Test Quality Sentinel Report

Test Quality Score: 95/100 — Excellent

Analyzed 2 test(s): 2 design, 0 implementation, 0 violation(s).

📊 Metrics (2 tests)
Metric Value
Analyzed 2 (Go: 2, JS: 0)
✅ Design 2 (100%)
⚠️ Implementation 0 (0%)
Edge/error coverage 2 (100%)
Duplicate clusters 0
Inflation No (1.5:1 ratio)
🚨 Violations 0
Test File Classification Details
TestAllEnginesEmitTimeoutMinutes: legacy timeout-minutes field (numeric) agentic_engine_test.go:270-273 Design / High-value Tests backward compatibility with numeric legacy timeout format; verifies all engines honor already-extracted timeout values
TestAllEnginesEmitTimeoutMinutes: legacy timeout-minutes field (expression) agentic_engine_test.go:276-279 Design / High-value Tests backward compatibility with expression legacy timeout format; ensures GitHub Actions expressions are forwarded verbatim

Quality Signals

Behavioral contracts tested: Both new test cases verify the timeout-minutes fallback mechanism added to resolveStepTimeoutValue(). Tests confirm that when the new ParsedFrontmatter.TimeoutMinutes is unavailable, the engine properly extracts and forwards legacy TimeoutMinutes values (both numeric and expression formats).

Test infrastructure:

  • Proper build tags (//go:build !integration on line 1)
  • Table-driven pattern with subtests for each engine (claude, codex, copilot, gemini, opencode)
  • Clear descriptions documenting each test case's intent
  • Assertions use require for setup failures and assert for behavioral checks
  • Assertion messages include descriptive context for debugging failures

Fixture cleanup: Deletions in fetch_integration_test.go remove malformed tools: bash: - echo entries from test data, improving test fixture quality.

Verdict

Approved. Test Quality Score: 95/100. 0% implementation tests (threshold: 30%). Backward-compatibility tests properly validate the timeout fallback mechanism across all engine implementations. No violations detected.

🧪 Test quality analysis by Test Quality Sentinel · haiku45 · 18.5 AIC · ⌖ 6.16 AIC · ⊞ 8.5K ·
Comment /review to run again

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Test Quality Sentinel: 95/100. 0% implementation tests (threshold: 30%). Well-designed backward-compatibility tests with proper table-driven pattern and comprehensive engine coverage.

@pelikhan

pelikhan commented Aug 2, 2026

Copy link
Copy Markdown
Collaborator

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: Request changes

Small, targeted fix, but the new raw-string fallback in resolveStepTimeoutValue skips the validation its sibling function does, risking invalid generated YAML on unexpected input.

💡 Themes
  • The Codex bash allow-list test cleanup and the new legacy-timeout test cases are correct and match the described regression.
  • The resolveStepTimeoutValue fallback trusts workflowData.TimeoutMinutes unconditionally after prefix-stripping, unlike resolveAWFContainerAgentTimeoutMinutes, which validates the value is numeric before using it. Since workflowData.TimeoutMinutes is produced by generic YAML re-marshaling (extractTopLevelYAMLSection), non-numeric/quoted content can slip through, worth hardening for consistency and to avoid the malformed value being emitted verbatim into the generated Actions YAML.

🔎 Code quality review by PR Code Quality Reviewer · auto · 77.1 AIC · ⌖ 4.69 AIC · ⊞ 7.9K
Comment /review to run again

if raw != "" {
return raw
}
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new fallback returns any non-empty raw value verbatim without validating it is a well-formed integer or GitHub Actions expression, unlike the near-identical logic in resolveAWFContainerAgentTimeoutMinutes.

💡 Why this matters

If workflowData.TimeoutMinutes contains a malformed value (e.g. leftover quotes from extractTopLevelYAMLSection producing timeout-minutes: "30", since a plain-string TimeoutMinutes gets quoted by the YAML marshaler, or any other unexpected content), this function emits it straight into the generated step YAML as timeout-minutes: <raw>. That produces an invalid GitHub Actions workflow only caught later at Actions runtime/schema-validation — a much harder failure to diagnose than catching it here.

resolveAWFContainerAgentTimeoutMinutes (awf_config.go:775-788) handles the same input source but validates with strconv.Atoi and falls back to the default on parse failure. This new code path should do the same (or explicitly allow GH Actions expression syntax) instead of trusting the raw string unconditionally.

Suggested test: add a case with a quoted/malformed non-numeric, non-expression TimeoutMinutes value to confirm the function falls back to the default rather than emitting invalid YAML.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 028ea2b. The raw fallback now validates with strconv.Atoi (positive integer required) and isExpression (GitHub Actions expression allowed), matching the sibling resolveAWFContainerAgentTimeoutMinutes pattern. Anything else is rejected with a log warning and the default is used. A new test case (legacy timeout-minutes field — malformed value falls back to default) covers this path across all registered engines.

…e doc comment

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>

Copilot AI commented Aug 2, 2026

Copy link
Copy Markdown
Contributor Author

@copilot fix https://github.com/github/gh-aw/actions/runs/30770592670/job/91556969199

The CI failure was a stale golden file: smoke-copilot.golden expected timeout-minutes: 20 but both the original code and the current code correctly emit timeout-minutes: 15 (the fixture has timeout-minutes: 15 in its frontmatter). Updated the golden file in 9e8ea8e.

Also updated the resolveStepTimeoutValue doc comment (same commit) to document the parsed-value → extracted-string → default precedence, addressing the reviewer's note.

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot Please address the remaining blocker on this PR, then run the pr-finisher skill.

Outstanding review item:

  • github-actions: validate and harden resolveStepTimeoutValue so the raw workflowData.TimeoutMinutes fallback cannot emit malformed YAML; match the sibling validation behavior noted in the blocking review.

Branch refresh may help once you are ready.

Generated by 👨‍🍳 PR Sous Chef · gpt54 · 13.5 AIC · ⌖ 5.05 AIC · ⊞ 8.3K ·
Comment /souschef to run again

…to prevent malformed YAML

Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>

Copilot AI commented Aug 2, 2026

Copy link
Copy Markdown
Contributor Author

@copilot Please address the remaining blocker on this PR, then run the pr-finisher skill.

Outstanding review item:...

Hardened in the latest commit. The raw workflowData.TimeoutMinutes fallback now validates the extracted value before using it: only positive integers (strconv.Atoi) and GitHub Actions expressions (isExpression) are accepted; anything else (multi-line content, arbitrary strings, etc.) is rejected with a warning log and falls back to DefaultAgenticWorkflowTimeout. This matches the pattern in the sibling resolveAWFContainerAgentTimeoutMinutes while also allowing expressions. A new test case covering the malformed-input path is included across all registered engines.

Copilot AI requested a review from gh-aw-bot August 2, 2026 23:42
@pelikhan
pelikhan merged commit 6aff3e9 into main Aug 3, 2026
29 checks passed
@pelikhan
pelikhan deleted the copilot/fix-copilot-issue branch August 3, 2026 00:03
@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v0.84.3

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.

4 participants