Skip to content

Fix smoke experiment expressions and make OIDC reminders informational - #66928

Merged
pelikhan merged 4 commits into
mainfrom
pelikhan-smoke-workflow-expressions
Oct 8, 2026
Merged

pelikhan merged 4 commits into
mainfrom
pelikhan-smoke-workflow-expressions

Conversation

@pelikhan

@pelikhan pelikhan commented Oct 8, 2026 •

Copy link
Copy Markdown
Collaborator

Why

Three Copilot smoke workflows are rejected before any jobs start because generated sub-agent metadata contains the gh-aw-only experiments.subagent_model context. Separately, the intentional id-token: write permission in the Entra workflow produces a warning that contributes to warnings-as-errors failures.

Changes

  • Rewrite experimental sub-agent model references in run-info metadata to steps.pick-experiment.outputs, since that metadata is evaluated inside activation. Preserve authored runtime declarations and regenerate the three affected smoke locks.
  • Expand declared experiment variants through model aliases into deduplicated concrete patterns shared by audit metadata and model-routing request admission. Preserve models.allowed/models.blocked filtering and router candidates. These union patterns indicate possible model usage, not proof that the selected variant was honored or delegation occurred.
  • Reject unsupported compound experiment-backed sub-agent models and undeclared experiment references before generating YAML. Errors direct authors to use ${{ experiments.<name> }} with complete models or aliases as variants.
  • Emit the OIDC audience/trust-policy reminder as info without incrementing compiler warnings. Keep invalid permission values and missing required OIDC permissions as errors.
  • Add coverage for inline/imported agents, compound-expression rejection, variant alias expansion, routing policy, audit matching, diagnostic severity, and development-gate behavior. Update documentation and synchronize compiler threat detection specification 1.0.44, CTR-001 mappings, and the changelog.

ADR: ADR-66928: Scope Experiment Expressions to Their Evaluating Job and Keep Security Reminders Advisory. The record is complete; maintainer acceptance remains part of PR review.

Validation

  • Passed: make build, make fmt, make lint, and focused workflow/CLI unit regressions covering the review fixes.
  • Passed: impacted test-unit coverage within make agent-report-progress.
  • Passed: go test -tags integration ./pkg/workflow -run '^TestIdTokenWriteInfo' -count=1 on the unchanged OIDC implementation before this finisher pass.
  • Passed: make check-workflow-drift; all 330 workflow locks remain synchronized with the final compiler.
  • Go lint reports no issues, and native actionlint no longer reports the invalid experiment expressions.

Known pre-existing blockers remain unchanged: the progress gate reports unchecked fmt.Fprintf/fmt.Fprintln results and the existing oversized permissions validator; the combined smoke strict dry-run still reports one other warning; pinned actionlint rejects the existing concurrency.queue syntax. The Entra OIDC reminder now appears as info.

CI on the final pushed HEAD is unverified. A maintainer must re-trigger CI before merge; no workflow run or merge was initiated by this finisher pass.

pelikhan and others added 2 commits October 8, 2026 07:57
Resolve declared experiment references to activation-local step outputs without changing runtime declarations. Cover inline and imported agents, preserve static metadata, document support, and regenerate affected smoke workflows.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Keep id-token audience and cloud trust guidance without incrementing compiler warnings. Preserve OIDC permission enforcement, add strict/non-strict and development-gate regressions, and synchronize compiler threat detection specification 1.0.44, mappings, changelog, and permissions documentation.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@pelikhan
pelikhan marked this pull request as ready for review October 8, 2026 15:10
Copilot AI balanced review requested due to automatic review settings October 8, 2026 15:10
@github-actions

github-actions Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

✅ Ponytail Reviewer completed successfully!

Lean already. Ship.

Generated by Ponytail Reviewer for #66928

@github-actions

github-actions Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

✅ Design Decision Gate 🏗️ completed the design decision gate check. See the comment below for the result and any generated ADR draft.

🏗️ ADR gate enforced by Design Decision Gate 🏗️

@github-actions

github-actions Bot commented Oct 8, 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

@github-actions

github-actions Bot commented Oct 8, 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 Oct 8, 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 Oct 8, 2026

Copy link
Copy Markdown
Contributor

🏗️ Design Decision Gate — ADR Required

This PR makes significant changes to core business logic (172 new lines across pkg/) but does not have a linked Architecture Decision Record (ADR).

📄 Draft ADR committed: docs/adr/66928-scope-experiment-expressions-and-advisory-diagnostics.md — review and complete it before merging.

🔒 This PR cannot merge until an ADR is linked in the PR body.

🔍 Evidence used
  • No implementation label; enforcement triggered by code volume (172 additions in business-logic directories, threshold 100).
  • No ADR found in the PR body, on the branch (docs/adr/ has no 66928-* entry prior to this commit), and no closing-keyword issue reference in the body.
  • Decision inferred from pkg/workflow/compiler_yaml_step_lifecycle.go (RewriteActivationOutputsToLocalStepOutputs for generate_aw_info) and pkg/workflow/permissions_compiler_validator.go (id-token: write reminder emitted as info).
📋 What to do next
  1. Review the draft ADR committed to your branch — it was generated from the PR diff
  2. Complete the missing sections — confirm the decider list and refine rationale/alternatives
  3. Commit the finalized ADR to docs/adr/ on your branch
  4. Reference the ADR in this PR body by adding a line such as:

    ADR: ADR-66928: Scope Experiment Expressions to Their Evaluating Job and Keep Security Reminders Advisory

Once an ADR is linked in the PR body, this gate will re-run and verify the implementation matches the decision.

📋 Michael Nygard ADR Format Reference

An ADR must contain these four sections to be considered complete:

  • Context — What is the problem? What forces are at play?
  • Decision — What did you decide? Why?
  • Alternatives Considered — What else could have been done?
  • Consequences — What are the trade-offs (positive and negative)?

🏗️ ADR gate enforced by Design Decision Gate 🏗️ · pi · opus50 · 53.3 AIC · ⌖ 50.6 AIC · ⊞ 1.8K · ◷
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.

Impeccable Skills Review

This PR is a Go compiler fix (experiment expression rewriting + OIDC permission diagnostic downgrade), not a UI/frontend change, so the installed Impeccable modes (audit, critique, harden, distill, extract, clarify) do not apply to the changed code.

Falling back to a standard correctness/security review per the fallback instructions:

  • RewriteExperimentsReferenceForDownstreamJobs / RewriteActivationOutputsToLocalStepOutputs (pkg/workflow/compiler_experiments.go) are regex-scoped to only declared experiment names, well-documented, and applied in the correct order inside writeSubagentModelDeclarations, matching the activation-job context where steps.pick-experiment.outputs is valid (confirmed via generateCreateAwInfo).
  • The id-token: write permission change (pkg/workflow/permissions_compiler_validator.go) correctly downgrades the reminder to info without incrementing the warning counter, consistent with updated tests (TestIdTokenWriteInfo, pull_request_target_validation_test.go) and docs.
  • New/updated tests cover inline/imported agents, compound expressions, diagnostic severity, and dev-gate behavior; lock files and specs are regenerated/updated consistently.

No correctness, security, or maintainability issues found in the changed lines.

@copilot no action needed.

🧵 Reviewed using Impeccable skills by Impeccable Skills Reviewer · copilot · sonnet50 · 27.5 AIC · ⌖ 13 AIC · ⊞ 8.1K

@github-actions

github-actions Bot commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

Comment Memory

Peek at saved memory (pr-code-quality-reviewer)
reviewed_at: 2026-10-08T15:14:09Z
review_event: COMMENT
top_themes:
  - experimental sub-agent metadata loses matchable model patterns
files_reviewed:
  - pkg/workflow/compiler_yaml_step_lifecycle.go
  - pkg/workflow/compiler_experiments_test.go
  - pkg/workflow/permissions_compiler_validator.go
  - pkg/workflow/idtoken_write_info_test.go
  - pkg/workflow/compiler_threat_detection_formal_test.go
comment_count: 1

Note

This comment is managed by comment memory.

Expand the saved memory block to view or edit the persistent context for this thread.
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 · copilot · gpt54 · 37.7 AIC · ⌖ 5.52 AIC · ⊞ 19.8K · ◷
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.

Verdict

I found one actionable correctness issue in the new experimental sub-agent metadata path.

Theme
  • The activation-job metadata rewrite fixes the invalid experiments.* context in model, but it still leaves experiment-backed sub-agents without matchable patterns, which will produce false declared-model audit mismatches downstream.

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt54 · 37.7 AIC · ⌖ 5.52 AIC · ⊞ 19.8K
Comment /review to run again

Comment thread pkg/workflow/compiler_yaml_step_lifecycle.go Outdated

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.

🟡 Changes recommended

Compound experiment expressions remain invalid at runtime, and experiment aliases are not expanded for metadata auditing or model-routing policy.

2 open findings
What changed in this PR

Fixes smoke workflow experiment metadata and downgrades OIDC reminders from warnings to informational diagnostics.

Changes:

  • Rewrites sub-agent experiment references for activation metadata.
  • Makes id-token: write reminders informational.
  • Adds tests, documentation, specification updates, and regenerated locks.
File Description
specs/​compiler-threat-detection-spec.md Updates CTR-001 requirements.
specs/​compiler-threat-detection-changelog.md Records specification 1.0.44.
pkg/​workflow/​pull_request_target_validation_test.go Updates OIDC warning expectations.
pkg/​workflow/​permissions_compiler_validator.go Emits OIDC reminder as info.
pkg/​workflow/​idtoken_write_info_test.go Tests informational diagnostics.
pkg/​workflow/​compiler_yaml_step_lifecycle.go Rewrites sub-agent metadata expressions.
pkg/​workflow/​compiler_threat_detection_formal_test.go Adds CTR-001 conformance coverage.
pkg/​workflow/​compiler_experiments_test.go Tests experiment-backed sub-agent metadata.
pkg/​cli/​compile_development_test.go Verifies dry-run acceptance.
docs/​src/​content/​docs/​reference/​permissions.md Documents OIDC severity behavior.
docs/​src/​content/​docs/​experimental/​experiments.md Documents sub-agent model experiments.
.github/​workflows/​smoke-copilot.lock.yml Regenerates smoke metadata expression.
.github/​workflows/​smoke-copilot-aoai-entra.lock.yml Regenerates Entra smoke lock.
.github/​workflows/​smoke-copilot-aoai-apikey.lock.yml Regenerates API-key smoke lock.

🧠 Review effort: Balanced


Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.

Comment thread pkg/workflow/compiler_experiments_test.go Outdated
Comment thread pkg/workflow/compiler_yaml_step_lifecycle.go

@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 (per pr-triage classification: bug_fix). No actionable issues found — approving.

📋 Analysis

Root-cause fix verified

  • writeSubagentModelDeclarations (compiler_yaml_step_lifecycle.go) correctly chains RewriteExperimentsReferenceForDownstreamJobs → RewriteActivationOutputsToLocalStepOutputs so ${{ experiments.subagent_model }} becomes ${{ steps.pick-experiment.outputs.subagent_model }} for metadata evaluated inside the activation job, while the runtime data.SubAgentModels declaration is left unmutated (verified by the explicit "must not mutate" assertion in TestWriteSubagentModelDeclarationsExperimentExpressions). This is the actual root cause fix, not a symptom patch, since the aw_info step runs in the same job as pick-experiment and can't use needs.activation.outputs.* on itself.
  • Confirmed via git diff HEAD~1 -- .github/workflows/smoke-copilot.lock.yml that the regenerated lock now emits the corrected steps.pick-experiment.outputs.subagent_model expression.

OIDC reminder downgrade

  • permissions_compiler_validator.go change from warning → info and removal of c.IncrementWarningCount() is consistent with the existing info diagnostic pattern used elsewhere (e.g. create_discussion.go, redirect notices), and doesn't weaken CTR-001 enforcement — missing/invalid OIDC permissions remain errors.
  • pull_request_target_validation_test.go's "unrelated warning remains" case was correctly updated to "id-token permission is informational" rather than silently dropped.

Test coverage (/tdd)

  • New tests cover inline and imported sub-agents, compound format(...) / fallback (||) expressions, undeclared-experiment names, and ordering (pick-experiment step precedes generate_aw_info) — good edge-case coverage per TDD principles.
  • TestFormal_CTR001_IDTokenWriteIsInformational covers both strict and non-strict modes and asserts the warning count stays at zero.

Docs & spec

  • specs/compiler-threat-detection-spec.md/changelog version bump to 1.0.44 and CTR-001 rule text are consistent with the code change. experiments.md doc addition about subagent_model and the Pi literal-model restriction accurately matches validatePiSubagentModel's containsExpression check.

Positive highlights

  • ✅ Clear root-cause fix (rewrites metadata reference, not a special-case workaround)
  • ✅ Behavior-preserving: runtime declarations untouched, only generated metadata rewritten
  • ✅ Spec/changelog/docs kept in sync with the code and test changes

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · sonnet50 · 85.5 AIC · ⌖ 14.4 AIC · ⊞ 10.1K
Comment /matt to run again

Reject compound and undeclared experimental sub-agent models rather than accepting runtime expressions the sub-agent renderer cannot evaluate. Share concrete variant expansion between metadata and routing policy, preserve router candidates, and complete the ADR with explicit pending maintainer acceptance.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@pelikhan
pelikhan merged commit ec065d1 into main Oct 8, 2026
48 checks passed
@pelikhan
pelikhan deleted the pelikhan-smoke-workflow-expressions branch October 8, 2026 15:46
@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot address the following outstanding work in one pass:

  1. Update this branch with the latest main using make merge-main, resolving any conflicts and preserving the intended changes.
  2. Review (pkg/workflow/compiler_yaml_step_lifecycle.go:286): This only rewrites the model field; patterns is still expanded from the original ${{ experiments.* }} expression, so the generated metadata stays patterns: null for every experiment-driven sub-agent. - Fix smoke experiment expressions and make OIDC reminders informational #66928 (comment)
  3. Review (pkg/workflow/compiler_experiments_test.go:241): This case exercises only metadata serialization, but the same compound expression remains in the inline/imported sub-agent definition. transformExperimentsExpression rewrites only an exact experiments.<name> or comparison, so ${{ experiments.subagent_model || 'small' }} is emitted into the interpolation step as an invalid GitHub Actions context and the workflow is still rejected before jobs run. Add an end-to-end compile case for this input and either rewrite experiment references inside compound prompt expressions or reject compound model expressions. - Fix smoke experiment expressions and make OIDC reminders informational #66928 (comment)
  4. Review (pkg/workflow/compiler_yaml_step_lifecycle.go:285): Experiment-backed models are rewritten only for the metadata model field, while model-policy/pattern expansion still receives the raw ${{ experiments.* }} string. expandModelPatterns therefore returns no patterns (the new test explicitly expects nil), so token-usage auditing falls back to matching the selected alias such as small literally instead of its concrete model patterns; model-routing also cannot admit the known experiment variants and can reject the sub-agent request. Expand the declared variants through ModelMappings for metadata and routing policy, or reject/document thi... - Fix smoke experiment expressions and make OIDC reminders informational #66928 (comment)

Push the necessary fixes, reply to each listed review thread and resolve it when addressed. Ignore feedback already answered or resolved. Use the pr-finisher skill and stop when only human review or CI remains; do not trigger CI.

Sous-chef head: feceadc
Sous-chef work: 007948f100bf401cc9290dc4ceb5069b40d635c9667f5d720c8142cdf3225f41 589fb9f6ea52d9a0bf3bf9b9dce27bba4cb3f6a098142e6c98f91a5b46ed0dd0 f2ef0ef796c3337b596290531e03bda69cbf9e2e686f6834492e79b9b71dac66
Sous-chef state: d0c2b43357e8690ac761b80dccaa29c393acaad30025a6fe2aaef3edf9a32bba

Generated by 👨‍🍳 PR Sous Chef · pi · haiku45 · 3.94 AIC · ⌖ 11.2 AIC · ⊞ 1K · ◷
Comment /souschef to run again

@github-actions

github-actions Bot commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v0.91.6

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