Skip to content

Reject expression input for max-turn-cache-misses instead of silently defaulting - #54707

Open
pelikhan with Copilot wants to merge 12 commits into
mainfrom
copilot/fix-9919-1036865607-b31e5ad1-c245-4d3f-a5d4-2f52046b8a38
Open

Reject expression input for max-turn-cache-misses instead of silently defaulting#54707
pelikhan with Copilot wants to merge 12 commits into
mainfrom
copilot/fix-9919-1036865607-b31e5ad1-c245-4d3f-a5d4-2f52046b8a38

Conversation

Copilot AI commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

max-turn-cache-misses accepted expression-shaped strings but then silently degraded to the default behavior (0 → fallback to configured default) with no explicit invalid-path handling. This created a schema/parser consistency gap versus user expectations from nearby templatable limits.

  • Parser behavior correction

    • parsePositiveIntValue now performs strict positive-integer parsing directly (native int or numeric string).
    • GitHub Actions expression strings are treated as invalid for integer-only fields, instead of being implicitly accepted by the int-or-expression helper path and then dropped.
  • Targeted guardrail coverage

    • Added a focused unit case for max-turn-cache-misses to codify that expression input is invalid and does not count as configured.
  • Resulting behavior (before vs after)

    // before: expression passed through int-or-expression helper path and was effectively ignored
    parseMaxTurnCacheMissesValue("${{ inputs.max_turn_cache_misses }}") // => 0 (silent fallback semantics)
    
    // after: expression is explicitly invalid for this integer-only field
    parseMaxTurnCacheMissesValue("${{ inputs.max_turn_cache_misses }}") // => 0 via invalid-value path

Generated by 👨‍🍳 PR Sous Chef · gpt54 · 12.3 AIC · ⌖ 8.33 AIC · ⊞ 7K ·
Comment /souschef to run again

Copilot AI and others added 2 commits August 22, 2026 03:31
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Copilot Request Reject expression input for max-turn-cache-misses instead of silently defaulting Aug 22, 2026
Copilot AI requested a review from pelikhan August 22, 2026 03:40
@pelikhan
pelikhan marked this pull request as ready for review August 22, 2026 03:40
Copilot AI balanced review requested due to automatic review settings August 22, 2026 03:40
@github-actions

github-actions Bot commented Aug 22, 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 only 15 new lines of code in business logic directories (threshold: 100).

🏗️ ADR gate enforced by Design Decision Gate 🏗️

@github-actions

github-actions Bot commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

Test Quality Sentinel completed test quality analysis.

Test Quality Sentinel skipped because pre-fetch PR data was unavailable: unable to fetch test file diff

🧪 Test quality analysis by Test Quality Sentinel

@github-actions

github-actions Bot commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

PR Code Quality Reviewer completed the code quality review.

🔎 Code quality review by PR Code Quality Reviewer

@github-actions

github-actions Bot commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

Ponytail Reviewer completed successfully!

Generated by Ponytail Reviewer for #54707

@github-actions

github-actions Bot commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

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

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer

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

Attempts to reject expression values for integer-only max-turn-cache-misses.

Changes:

  • Refactors positive-integer parsing and adds an expression test.
  • Refreshes generated workflow harness hashes.
Show a summary per file
File Description
pkg/workflow/engine_config_parser.go Updates positive-integer parsing.
pkg/workflow/engine_config_parser_test.go Adds expression-input coverage.
.github/workflows/smoke-copilot.lock.yml Refreshes harness hash.
.github/workflows/smoke-copilot-aoai-entra.lock.yml Refreshes harness hash.
.github/workflows/smoke-copilot-aoai-apikey.lock.yml Refreshes harness hash.

Review details

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

Comment thread pkg/workflow/engine_config_parser.go Outdated
Comment on lines +57 to +58
engineLog.Printf("Ignoring invalid %s value: %q", fieldName, rawStr)
return 0
@github-actions

Copy link
Copy Markdown
Contributor

Comment Memory

reviewed_at: 2026-08-22T00:00:00Z
review_event: REQUEST_CHANGES
top_themes:
  - invalid integer input still silently falls back to default
  - PR description overstates rejection semantics
files_reviewed:
  - pkg/workflow/engine_config_parser.go
  - pkg/workflow/engine_config_parser_test.go
  - pkg/workflow/engine.go
comment_count: 1

Note

This comment is managed by comment memory.

It stores persistent context for this thread in the code block at the top of this comment.
Edit only the text inside the backtick fences; workflow metadata and the footer are regenerated automatically.

Learn more about comment memory

🔎 Code quality review by PR Code Quality Reviewer · gpt54 · 7.04 AIC · ⌖ 8.12 AIC · ⊞ 7K ·
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.

Request changes

This patch changes the logging path, but it still does not actually reject invalid max-turn-cache-misses expressions — the parser collapses them back into the same “unset” sentinel, so misconfigured workflows continue to compile and run with an implicit default.

Blocking theme
  • Invalid max-turn-cache-misses input is still indistinguishable from an omitted value at the configuration boundary.
  • Because 0 still means “not configured”, the new branch only adds a log line; it does not enforce the “expression input is invalid” contract described by the PR.
  • The tests codify the same fallback behavior, so they do not prove a real rejection path yet.

🔎 Code quality review by PR Code Quality Reviewer · gpt54 · 7.04 AIC · ⌖ 8.12 AIC · ⊞ 7K
Comment /review to run again

// treated as 0 (not configured) because these fields are integer-only.
// GitHub Actions expression strings (e.g. "${{ inputs.value }}") are treated
// as invalid for integer-only fields.
func parsePositiveIntValue(raw any, fieldName string) int {

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.

This change still silently falls back to the default max-turn-cache-misses behavior, so it does not actually “reject” expression input in any enforceable way and will keep masking misconfigured workflows.

💡 Why this is still broken

parsePositiveIntValue now logs and returns 0 for expression-shaped strings, but 0 is the existing sentinel for “not configured”, and GetMaxTurnCacheMisses() later converts that straight back into the built-in or enterprise default. In other words, an author can still write ${{ inputs.max_turn_cache_misses }}, compilation still succeeds, and the workflow still runs with an implicit default rather than failing or preserving intent.

That means the PR description overstates the behavioral change: this is only better logging, not a real rejection path. If the goal is to reject expressions for integer-only fields, the parser needs a way to distinguish absent from present-but-invalid and surface that as a validation error.

A fix here usually means returning an (int, bool)/error-style result or recording a validation diagnostic instead of collapsing invalid input into the same 0 sentinel used for “unset”.

@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.

The fix is correct and well-scoped. parsePositiveIntValue now explicitly rejects expression strings instead of silently treating them as 0, and the new test case confirms the behavior. The log message (engineLog.Printf) gives operators visibility when an invalid/expression value is ignored. No blocking issues found.

🧵 Reviewed using Impeccable skills by Impeccable Skills Reviewer · sonnet46 · 18.5 AIC · ⌖ 8.95 AIC · ⊞ 6.2K

@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.

Ponytail review (over-engineering only): one finding — duplicated string-parsing branch in parsePositiveIntValue that mirrors parseIntOrExpressionValue.

net: -8 lines possible.

Generated by ✂️ Ponytail Reviewer for #54707 · auto · 21.4 AIC · ⌖ 6.78 AIC · ⊞ 7.3K
Comment /ponytail to run again

Comment thread pkg/workflow/engine_config_parser.go Outdated
Comment on lines +42 to +46
func parsePositiveIntValue(raw any, fieldName string) int {
s := parseIntOrExpressionValue(raw, 1, fieldName)
if s == "" || isExpression(s) {
if val, ok := typeutil.ParseIntValue(raw); ok && val >= 1 {
return val
}
rawStr, ok := raw.(string)

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.

L42-59: yagni: reimplements the trim/atoi string-parsing branch already in parseIntOrExpressionValue (L104-111) just to reject expressions. Extract a shared string-parsing helper, or call parseIntOrExpressionValue and treat isExpression results as invalid, instead of duplicating the logic.

@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 /tdd — approving with one minor suggestion.

📋 Summary

What the PR does well

  • ✅ The fix correctly tightens parsePositiveIntValue to reject expression strings rather than silently returning 0.
  • engineLog.Printf gives a visible signal when an invalid value is ignored — future debugging is easier.
  • ✅ The new test case precisely specifies the corrected behavior for max-turn-cache-misses.
  • ✅ Lock-file bumps are the only other changes; no unrelated code was touched.

Minor gap

max-runs is the only other caller of parsePositiveIntValue and currently has no expression-rejection test. Adding one (see inline comment) would close the spec gap symmetrically.

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · sonnet46 · 30.1 AIC · ⌖ 9.79 AIC · ⊞ 7.6K
Comment /matt to run again

Comments that could not be inline-anchored

pkg/workflow/engine_config_parser_test.go:18

[/tdd] max-runs shares parsePositiveIntValue but has no expression-rejection test — the same silent-default bug could recur there unnoticed.

<details>
<summary>💡 Suggested addition</summary>

{name: &quot;max-runs expression invalid&quot;, parse: parseMaxRunsValue, raw: &quot;${{ inputs.max_runs }}&quot;, expected: 0},

Adding this alongside the existing max-runs cases gives the same specification-level coverage the PR adds for max-turn-cache-misses.

</details>

@copilot please address thi…

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot this PR still needs forward progress before maintainer review.

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

Generated by 👨‍🍳 PR Sous Chef · gpt54 · 12.3 AIC · ⌖ 8.33 AIC · ⊞ 7K ·
Comment /souschef to run again

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

Copilot AI commented Aug 22, 2026

Copy link
Copy Markdown
Contributor Author

@copilot this PR still needs forward progress before maintainer review.

  • Unresolved review feedback remains that expression input should be rejected rather than silently defaulted, and the PR descri...

Addressed in 38c9a6a: invalid main and imported max-turn-cache-misses values now fail compilation with an actionable positive-integer error and example; added compiler/import regression coverage. Focused workflow tests pass. The prior impacted-go-tests failure was reproduced as missing origin/main merge-base setup, and the custom-lint failure no longer reports the original changed-line findings.

@github-actions

Copy link
Copy Markdown
Contributor

PR Triage

  • Category: bug
  • Risk: low
  • Priority score: 58/100 (impact 30, urgency 20, quality 8)
  • Recommended action: fast_track
  • CI status: failing

Generated by 🔧 PR Triage Agent · auto · 82.9 AIC · ⌖ 6.65 AIC · ⊞ 8.3K ·

@github-actions

Copy link
Copy Markdown
Contributor

PR Triage

Category: bug | Risk: low | Priority: medium | Score: 62/100
Recommended action: fast_track

Rejects invalid expression input for max-turn-cache-misses. Mixed CI (2 failures/25 success) + CHANGES_REQUESTED alongside 2 APPROVED — needs CI fix before merge.

Automated triage — run 32572524009

Generated by 🔧 PR Triage Agent · auto · 65.4 AIC · ⌖ 6.04 AIC · ⊞ 8.3K ·

@github-actions

Copy link
Copy Markdown
Contributor

🛠️ Agentic Maintenance updated this pull request branch.

View workflow run

@pelikhan

Copy link
Copy Markdown
Collaborator

@copilot valid expressions should still be allowed

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

Copilot AI commented Aug 22, 2026

Copy link
Copy Markdown
Contributor Author

@copilot valid expressions should still be allowed

Addressed in eb53a7a: valid imported expressions again compile successfully; the regression test now asserts that behavior.

@pelikhan

Copy link
Copy Markdown
Collaborator

@copilot the expression should be maintained into the lock.yml instead of being converted to 0

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot this PR still needs forward progress before maintainer review.

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

Generated by 👨‍🍳 PR Sous Chef · gpt54 · 14.2 AIC · ⌖ 8.25 AIC · ⊞ 9.5K ·
Comment /souschef to run again

Copilot AI and others added 3 commits August 22, 2026 14:41
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>

Copilot AI commented Aug 22, 2026

Copy link
Copy Markdown
Contributor Author

@copilot the expression should be maintained into the lock.yml instead of being converted to 0

Addressed in 4468708 (with a follow-up guard in 00361c9): valid imported expressions are preserved in the generated lock file via GH_AW_MAX_TURN_CACHE_MISSES and substituted into the AWF maxCacheMisses configuration at runtime.

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

Copilot AI commented Aug 22, 2026

Copy link
Copy Markdown
Contributor Author

@copilot this PR still needs forward progress before maintainer review.

Validated the current expression-preservation contract and pushed 0fb4581. Valid imported expressions remain in the lockfile as GH_AW_MAX_TURN_CACHE_MISSES and are substituted into AWF maxCacheMisses at runtime. Reran: focused parser/compiler/AWF tests, make fmt, make lint, make test-unit, and make test (all pass). make agent-report-progress impacted tests pass; its custom-lint phase still reports unrelated historical diagnostics across prior PR files. Prior impacted-go-tests CI failed only because origin/main was unavailable to resolve a merge base.

@github-actions

Copy link
Copy Markdown
Contributor

🛠️ Agentic Maintenance updated this pull request branch.

View workflow run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[deep-report] max-turn-cache-misses silently ignores expression input instead of erroring

4 participants