Skip to content

runtime: reject unresolved GitHub Actions expressions in model name#46712

Merged
pelikhan merged 6 commits into
mainfrom
copilot/add-runtime-check-model-name
Jul 20, 2026
Merged

runtime: reject unresolved GitHub Actions expressions in model name#46712
pelikhan merged 6 commits into
mainfrom
copilot/add-runtime-check-model-name

Conversation

Copilot AI commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

When a vars.* expression is used for model in workflow frontmatter but the variable isn't defined, GitHub Actions passes the literal ${{ vars.MODEL }} string at runtime — silently poisoning aw_info.json with a non-functional model name.

Changes

  • generate_aw_info.cjs: Before building awInfo, validates that GH_AW_INFO_MODEL does not contain ${{. Fails fast via core.setFailed + throw with an ERR_CONFIG-prefixed message.
if (/\$\{\{/.test(model)) {
  const message = `${ERR_CONFIG}: GH_AW_INFO_MODEL contains an unresolved GitHub Actions expression: ${model}`;
  core.setFailed(message);
  throw new Error(message);
}
  • generate_aw_info.test.cjs: Four new tests — two failure cases (${{ vars.COPILOT_MODEL }}, expression-with-fallback syntax) and two pass cases (plain model string, empty string).

…name

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title Add runtime check for unresolved GitHub Actions expressions in model name runtime: reject unresolved GitHub Actions expressions in model name Jul 20, 2026
Copilot AI requested a review from pelikhan July 20, 2026 05:24
@pelikhan

Copy link
Copy Markdown
Collaborator

@copilot ensure that expressions with experiments... are properly expanded for the model field.

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

Copilot AI commented Jul 20, 2026

Copy link
Copy Markdown
Contributor Author

@copilot ensure that expressions with experiments... are properly expanded for the model field.

Experiment model variants work correctly with this check. When frontmatter uses model: "${{ needs.activation.outputs.model_size }}", GitHub Actions evaluates the expression before setting GH_AW_INFO_MODEL — so by the time generate_aw_info.cjs runs, the env var contains the resolved variant string (e.g. "claude-haiku-4.5"), never the literal ${{ text. Added a test to make this explicit (commit 0428f78).

@pelikhan

Copy link
Copy Markdown
Collaborator

@copilot merge main and recompile

Copilot AI and others added 2 commits July 20, 2026 05:54
…heck-model-name

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

Copilot AI commented Jul 20, 2026

Copy link
Copy Markdown
Contributor Author

@copilot merge main and recompile

Done — merged main and recompiled all 258 workflows (0 errors, lock files in sync).

@github-actions

Copy link
Copy Markdown
Contributor

Thanks for working on this runtime validation fix! The code quality is strong — the logic is clear, tests are comprehensive, and the problem it solves (unresolved GitHub Actions expressions silently poisoning aw_info.json) is a real pain point.

However, this PR requires a process correction. Per CONTRIBUTING.md, Traditional Pull Requests Are Not Enabled for non-Core team members. The proper workflow is:

  1. Community members create a detailed agentic plan in a GitHub issue
  2. The core team discusses and validates the approach
  3. A core team member implements and opens the PR using an agent

This PR should have started as an issue-based agentic plan rather than a direct PR. Since a core team member (like @pelikhan) is already assigned, they can take it from here — but for future contributions following this workflow, please open an issue first.

Once the process is aligned, this change is ready to merge. The validation logic is solid, and the test coverage (two failure cases + two pass cases) is appropriate.

If you'd like to contribute via the proper channel, you can assign this prompt to your agent:

Close this PR and create a GitHub issue titled "Add runtime validation for unresolved GitHub Actions expressions in model name" with the following agentic plan:

1. **Problem**: When a `vars.*` expression is used for `model` in workflow frontmatter but the variable isn't defined, GitHub Actions passes the literal `${{ vars.MODEL }}` string at runtime, silently poisoning `aw_info.json` with a non-functional model name.

2. **Solution**: Add validation in `generate_aw_info.cjs` to detect and reject model names containing unresolved GitHub Actions expressions (check for `${{`). Fail fast with `core.setFailed()` and an `ERR_CONFIG`-prefixed error message.

3. **Tests**: Add test cases covering:
   - Unresolved `vars.*` expressions (should fail)
   - Expression-with-fallback syntax (should fail)
   - Plain model strings (should pass)
   - Empty string (should pass)

4. **Files to modify**:
   - `actions/setup/js/generate_aw_info.cjs`
   - `actions/setup/js/generate_aw_info.test.cjs`

Generated by ✅ Contribution Check · 58.5 AIC · ⌖ 11.1 AIC · ⊞ 6.2K ·

@pelikhan
pelikhan marked this pull request as ready for review July 20, 2026 06:03
Copilot AI review requested due to automatic review settings July 20, 2026 06:03
@pelikhan

Copy link
Copy Markdown
Collaborator

/smoke-copilot

@github-actions

github-actions Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

📰 BREAKING: Smoke Copilot is now investigating this issue comment. Sources say the story is developing...

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

Adds runtime validation to prevent unresolved GitHub Actions expressions from becoming model metadata.

Changes:

  • Rejects unresolved model expressions with ERR_CONFIG.
  • Adds failure and success tests.
  • Includes an unrelated generated JSON reformat.
Show a summary per file
File Description
actions/setup/js/generate_aw_info.cjs Validates model metadata before writing run information.
actions/setup/js/generate_aw_info.test.cjs Tests rejected and accepted model values.
pkg/agentdrain/data/default_weights.json Reformats generated weights without semantic changes.

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: Medium

"span_id",
"timestamp"
],
"ExcludeFields": ["session_id", "trace_id", "span_id", "timestamp"],

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.

Reverted pkg/agentdrain/data/default_weights.json in 7b76783, so this PR no longer carries the unrelated formatting rewrite.

@github-actions

Copy link
Copy Markdown
Contributor

Comment Memory

Test drum beat now
Tiny bots tap stone all night
Green sparks wake cave dawn

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

📰 BREAKING: Report filed by Smoke Copilot · 117.8 AIC · ⌖ 8.24 AIC · ⊞ 19K ·
Comment /smoke-copilot to run again
Add label smoke 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.

Cave smoke done. One stray file seen.

📰 BREAKING: Report filed by Smoke Copilot · 117.8 AIC · ⌖ 8.24 AIC · ⊞ 19K
Comment /smoke-copilot to run again
Add label smoke to run again

@github-actions

github-actions Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Test Quality Sentinel completed test quality analysis.

@github-actions

github-actions Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

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

@github-actions

github-actions Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

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

No ADR enforcement needed: PR #46712 does not have the 'implementation' label and has only 8 new lines of code in business logic directories (threshold: 100).

@github-actions

github-actions Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

PR Code Quality Reviewer completed the code quality review.

@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 no blocking issues.

📋 Key Themes & Highlights

Key Themes

  • Fail-fast validation: The $\{\{ regex precisely targets the GH Actions expression opening delimiter — correct and minimal.
  • Test coverage: Five tests cover both failure paths (plain expression, expression-with-fallback) and three pass paths (plain string, empty, resolved variant). Good use of Arrange/Act/Assert throughout.
  • Unrelated change: The default_weights.json reformatting is already called out in an existing review comment — no further action needed here.

Positive Highlights

  • ✅ Clean separation: validation fires before awInfo is built, preventing poisoned writes.
  • ✅ Error message includes the offending value, making debugging easy for users.
  • ERR_CONFIG prefix is consistent with the project's error code conventions.

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · 15.2 AIC · ⌖ 4.39 AIC · ⊞ 6.7K
Comment /matt 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.

The validation logic is correct and well-tested. Checking for $\{\{ as the sentinel for an unresolved expression is the right approach — GitHub Actions never emits that substring in a fully-evaluated value.

The five new test cases cover the important scenarios (bare expression, expression-with-fallback, plain string, empty string, resolved variant). The PR description says four tests but there are actually five — minor discrepancy.

The unrelated default_weights.json reformatting already has an open review comment.

🧵 Reviewed using Impeccable skills by Impeccable Skills Reviewer · 13.3 AIC · ⌖ 4.97 AIC · ⊞ 5K

@github-actions github-actions Bot mentioned this pull request Jul 20, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🧪 Test Quality Sentinel Report

Test Quality Score: 62/100 — Acceptable (but fails quality threshold)

Analyzed 5 test(s): 3 design, 2 implementation, 1 violation(s).

📊 Metrics (5 tests)
Metric Value
Analyzed 5 (Go: 0, JS: 5)
✅ Design 3 (60%)
⚠️ Implementation 2 (40%)
Edge/error coverage 3 (60%)
Duplicate clusters 0
Inflation YES (3.57:1)
🚨 Violations 1
Test File Classification Issues
"should fail when model name contains unresolved GitHub Actions expression" generate_aw_info.test.cjs:233 Design Error case for security validation ✅
"should fail when model name contains partial unresolved expression" generate_aw_info.test.cjs:242 Design Error edge case ✅
"should not fail when model name is a plain string" generate_aw_info.test.cjs:249 Implementation Happy path, no edge coverage
"should not fail when model name is empty" generate_aw_info.test.cjs:259 Implementation Empty string edge case (partial value)
"should not fail when model is resolved experiment variant string" generate_aw_info.test.cjs:269 Design Validates expected resolved behavior ✅
⚠️ Quality Issues (2)

Test Inflation Detected (3.57:1)

  • Production code: +14 lines (regex check + comment + variable extraction)
  • Test code: +50 lines (5 test functions)
  • Threshold: 2:1
  • Impact: Tests are 3.5x larger than production. While coverage is good, test code weight suggests possible test redundancy or overly verbose assertions.

Implementation Tests Ratio: 40% (threshold: 30%)

  • Tests 3 and 4 verify happy-path scenarios with no behavioral significance:
    • Test 3 validates "gpt-4o" passes (implementation detail)
    • Test 4 validates empty string passes (basic no-op)
  • These don't validate design contracts; they validate that the code does nothing when validation passes.
  • Fix: Consolidate happy-path tests or add more edge cases (e.g., whitespace, special chars that don't trigger regex).

Verdict

Failed. 40% implementation tests (threshold: 30%). The test suite over-indexes on happy-path validation rather than design contracts. The 3 design tests (security validation, partial expressions, resolved variants) are strong; the 2 implementation tests (plain string, empty string) add marginal value and inflate the test count.

Recommendation: Merge as-is (security checks are well-covered), but consolidate the happy-path tests in future work.

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • awmgmcpg

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "awmgmcpg"

See Network Configuration for more information.

🧪 Test quality analysis by Test Quality Sentinel · 18.4 AIC · ⌖ 9.19 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.

❌ Test Quality Sentinel: 62/100. 40% implementation tests (threshold: 30%). Review flagged tests in the comment above.

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

Non-blocking review. One low-severity concern found (see inline comment on line 56). The guard logic, tests, and JSON reformatting are all correct.

🔎 Code quality review by PR Code Quality Reviewer · 26.2 AIC · ⌖ 4.38 AIC · ⊞ 5.6K
Comment /review to run again

}

// Build awInfo from env vars (compile-time) + context (runtime)
const model = process.env.GH_AW_INFO_MODEL || "";

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.

Raw model value interpolated into error message — risk of log injection/corruption: if the model string contains ANSI escape sequences or newlines, it can corrupt GitHub Actions log output or mislead log parsers.

💡 Suggested fix

Stringify the value before embedding it in the message:

const message = `${ERR_CONFIG}: GH_AW_INFO_MODEL contains an unresolved GitHub Actions expression: ${JSON.stringify(model)}`;

This ensures the full raw value is safely visible in logs without escaping into the surrounding log stream.

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.

Updated the failure path in 7b76783 to stringify GH_AW_INFO_MODEL before embedding it in the error message, and kept the assertion coverage aligned with that output.

@pelikhan

Copy link
Copy Markdown
Collaborator

@copilot run pr-finisher skip

@github-actions

Copy link
Copy Markdown
Contributor

🤖 PR Triage - run 29724276600

Field Value
Category bug
Risk Medium
Score 70 / 100
Action fast_track

Score breakdown: Impact 35/50 - Urgency 22/30 - Quality 13/20

Rationale: Silent bug: unresolved GitHub Actions vars poison model name at runtime. CI passing (canary-go, Windows). Tests included. New PR.

Next: Human review + merge if CI clean.

Generated by 🔧 PR Triage Agent · 45.9 AIC · ⌖ 5.33 AIC · ⊞ 5.6K ·

Copilot AI and others added 2 commits July 20, 2026 07:29
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
@pelikhan
pelikhan merged commit 690c520 into main Jul 20, 2026
@pelikhan
pelikhan deleted the copilot/add-runtime-check-model-name branch July 20, 2026 08:15
@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot please run the pr-finisher skill, address any unresolved review feedback, and rerun checks once the branch is up to date.

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • pi.dev

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "pi.dev"

See Network Configuration for more information.

Generated by 👨‍🍳 PR Sous Chef · 2.96 AIC · ⌖ 14.1 AIC · ⊞ 5.4K ·
Comment /souschef to run again

@github-actions

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v0.82.14

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.

4 participants