Skip to content
Merged
3 changes: 3 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
# All of .github, not just workflows: check-model-pins scans the whole dir.
- '.github/**'
- 'tests/**'
- 'docs/initiatives/agent-ingress-collapse-markets.md' # read by agent_ingress_markets_package.bats
Comment thread
don-petry marked this conversation as resolved.
Resolved
- 'prompts/**'
- 'agents/**'
- 'personas/**'
Expand All @@ -25,6 +26,7 @@
paths:
- 'scripts/**'
- 'tests/**'
- 'docs/initiatives/agent-ingress-collapse-markets.md' # read by agent_ingress_markets_package.bats
- 'prompts/**'
- '.github/workflows/**'
- '.github/**' # check-model-pins scans all of .github
Expand Down Expand Up @@ -77,6 +79,7 @@
run: |
scripts/run-bats.sh \
tests/test_duplicate_decl_gate.bats \
tests/agent_ingress_markets_package.bats \
tests/test_vendored_installed_tools.bats \
tests/fleet_report.bats \
tests/fleet_stub_drift.bats \
Expand Down Expand Up @@ -301,7 +304,7 @@
timeout-minutes: 5
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
# NOTE: persist-credentials is intentionally left at the default (true) —

Check warning on line 307 in .github/workflows/lint.yml

View workflow job for this annotation

GitHub Actions / Lint

307:9 [comments-indentation] comment not indented like content
# vci_resolve_reusable needs `git fetch origin` to authenticate against this
# private repo when resolving same-repo channel tags. Setting
# persist-credentials: false would silently push every such caller into the
Expand Down
4 changes: 4 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,10 @@ calling it a regression, and treat CI as authoritative.**
agentic workflow compilation. It is not covered by the org template and must not be removed by template
syncs. If the org template gains a `gh-aw-compile` equivalent, remove this exception and defer to the
template instead.
- **Exception:** the `lint.yml` `paths:` filters (pull_request and push) carry the repo-specific entry
`docs/initiatives/agent-ingress-collapse-markets.md`, which is read by
`tests/agent_ingress_markets_package.bats` (#2038). It must not be removed as template drift on a sync;
without it, documentation-only edits to the package skip the suite that validates it.
- **Exception:** `token-report.yml` (weekly Token Cost Observatory report) is a documented repo-specific
workflow with no corresponding org template in `standards/workflows/`. It must not be removed by template
syncs. If the org template gains a token-report equivalent, remove this exception and defer to the
Expand Down
180 changes: 142 additions & 38 deletions docs/initiatives/agent-ingress-collapse-markets.md

Large diffs are not rendered by default.

122 changes: 122 additions & 0 deletions tests/agent_ingress_markets_package.bats
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
#!/usr/bin/env bats
# Regression test for the markets collapse package (#2038, ADR-0010): the §3
Comment thread
don-petry marked this conversation as resolved.
Resolved
# `agent-ingress.yml` in docs/initiatives/agent-ingress-collapse-markets.md must
# pass BOTH ingress guards as rendered, so the package cannot drift back to a
# non-conforming concurrency block (run_id / inputs.* fallbacks, expression
# cancel-in-progress). The §3 YAML is extracted from the doc itself — the test
# reads the package, not a copy of it.
Comment thread
don-petry marked this conversation as resolved.
Resolved
#
# The pinned reusables are resolved from trimmed snapshots
# (tests/fixtures/agent-ingress/markets-pinned-reusables/) via VCI_RESOLVE_DIR so
# the collision check is deterministic and offline. Changes to checked inputs or
# concurrency declarations behind channel refs are not fetched; refresh the
# snapshots to test those changes.

SCRIPT_DIR="$(cd "$(dirname "$BATS_TEST_FILENAME")/.." && pwd)"
PACKAGE="$SCRIPT_DIR/docs/initiatives/agent-ingress-collapse-markets.md"
Comment thread
don-petry marked this conversation as resolved.
Resolved
SNAPSHOTS="$SCRIPT_DIR/tests/fixtures/agent-ingress/markets-pinned-reusables"

setup() {
ROOT="$(mktemp -d)" || { echo "Failed to create temp dir" >&2; return 1; }
mkdir -p "$ROOT/.github/workflows"
INGRESS="$ROOT/.github/workflows/agent-ingress.yml"
# The first ```yaml fence after the "## 3." heading is the §3 ingress.
awk '
/^## 3\./ { in3 = 1; next }
in3 && /^## / { exit }
in3 && !open && /^```yaml$/ { open = 1; next }
open && /^```$/ { exit }
open { print }
' "$PACKAGE" > "$INGRESS"
}

teardown() {
rm -rf "$ROOT"
}

@test "markets §3: the ingress block is extracted and declares the five role jobs" {
Comment thread
don-petry marked this conversation as resolved.
Resolved
[ -s "$INGRESS" ]
run yq -r '.jobs | keys | sort | join(",")' "$INGRESS"
[ "$status" -eq 0 ]
[ "$output" = "ci-failure-analyst,dev-lead,pr-auto-review,pr-review,pr-review-mention" ]
}

@test "markets §3: validate-ingress-if.sh passes (pure if:, bounded concurrency)" {
VIIF_ROOT="$ROOT" run bash "$SCRIPT_DIR/scripts/validate-ingress-if.sh"
echo "$output"
[ "$status" -eq 0 ]
[[ "$output" == *"ingress-if: OK"* ]]
}

@test "markets §3: every snapshot's recorded uses: target is still the ingress's pin (PINNED-USES)" {
local uses rec n=0
for rec in "$SNAPSHOTS"/*.yml; do
uses="$(sed -n 's/^# PINNED-USES: //p' "$rec")"
yq '.jobs[].uses' "$INGRESS" | grep -qxF "$uses"
Comment thread
don-petry marked this conversation as resolved.
Resolved
Comment thread
don-petry marked this conversation as resolved.
Resolved
n=$((n + 1))
done
[ "$n" -ge 4 ]
}

@test "markets §3: each role job uses the target recorded in its own snapshot" {
local expected
expected="$(sed -n 's/^# PINNED-USES: //p' "$SNAPSHOTS/pr-auto-review-reusable.yml")"
[ -n "$expected" ]
[ "$(yq -r '.jobs["pr-auto-review"].uses' "$INGRESS")" = "$expected" ]

expected="$(sed -n 's/^# PINNED-USES: //p' "$SNAPSHOTS/ci-failure-analyst-reusable.yml")"
[ -n "$expected" ]
[ "$(yq -r '.jobs["ci-failure-analyst"].uses' "$INGRESS")" = "$expected" ]
}

@test "markets §3: validate-caller-inputs.sh passes against the pinned reusables (no collision)" {
VCI_ROOT="$ROOT" VCI_RESOLVE_DIR="$SNAPSHOTS" run bash "$SCRIPT_DIR/scripts/validate-caller-inputs.sh"
Comment thread
don-petry marked this conversation as resolved.
Resolved
Comment thread
don-petry marked this conversation as resolved.
Resolved
Comment thread
don-petry marked this conversation as resolved.
Resolved
echo "$output"
[ "$status" -eq 0 ]
[[ "$output" == *"pr-review' concurrency group does not collide"* ]]
[[ "$output" == *"pr-auto-review' concurrency group does not collide"* ]]
[[ "$output" == *"ci-failure-analyst' concurrency group does not collide"* ]]
}

@test "markets §3: every concurrency group is role-prefixed and every cancel-in-progress is a literal boolean" {
source "$SCRIPT_DIR/scripts/validate-ingress-if.sh"
local job group cancel stem n=0
for job in pr-auto-review pr-review ci-failure-analyst; do
IFS=$'\x1f' read -r group cancel < <(viif_job_concurrency "$INGRESS" "$job")
[ -n "$group" ]
[[ "$cancel" == "true" || "$cancel" == "false" ]]
while IFS= read -r stem; do
[[ "$stem" == "$job"-* ]]
n=$((n + 1))
done < <(viif_group_stems "$group")
done
[ "$n" -ge 3 ]
}

@test "markets §3: no group falls back to github.run_id or the inputs.* context" {
run yq '.jobs[].concurrency.group // ""' "$INGRESS"
[ "$status" -eq 0 ]
[[ "$output" != *"run_id"* ]]
# github.event.inputs.* is the workflow_dispatch payload; a bare inputs.* is not.
! printf '%s\n' "$output" | grep -Eq '(^|[^.[:alnum:]_])inputs\.'
}

@test "markets §3: pr-review's shared fallback slot is not the reusable's pr-review-batch" {
# The collision check compares literal stems (a tripwire, ADR-0010). A caller
# fallback of 'batch' would resolve to the reusable's own 'pr-review-batch'
# group while passing the stem check, so pin the chosen literal here.
run yq '.jobs["pr-review"].concurrency.group' "$INGRESS"
[ "$status" -eq 0 ]
[[ "$output" == pr-review-* ]]
[[ "$output" != *"'batch'"* ]]
# PR-identity branches must stay, in order, ahead of the 'enumerate' fallback.
local re="pull_request\\.number.*check_suite\\.pull_requests\\[0\\]\\.number.*inputs\\.pr_url.*client_payload\\.pr_url.*'enumerate'"
printf '%s' "$output" | tr '\n' ' ' | grep -Eq "$re"
}

@test "markets §3: ci-failure-analyst concurrency is unchanged" {
run yq -r '.jobs["ci-failure-analyst"].concurrency.group' "$INGRESS"
[ "$output" = 'ci-failure-analyst-${{ github.event.check_run.head_sha }}' ]
run yq '.jobs["ci-failure-analyst"].concurrency["cancel-in-progress"]' "$INGRESS"
[ "$output" = "false" ]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# PINNED-USES: petry-projects/.github-private/.github/workflows/ci-failure-analyst-reusable.yml@79747178007d3238bb3afddf7f4d952a293987bd
# SNAPSHOT (trimmed) of petry-projects/.github-private
# .github/workflows/ci-failure-analyst-reusable.yml @ 79747178007d3238bb3afddf7f4d952a293987bd,
# read 2026-10-02 for #2038. The reusable declares NO concurrency group at
# workflow or job level; the markets caller forwards no with: inputs.
name: CI Failure Analyst (reusable)

on:
workflow_call: {}

jobs:
analyze:
runs-on: ubuntu-latest
steps:
- run: echo snapshot
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# PINNED-USES: petry-projects/.github-private/.github/workflows/dev-lead-reusable.yml@dev-lead/v139-stable
# SNAPSHOT (trimmed) of petry-projects/.github-private
# .github/workflows/dev-lead-reusable.yml @ dev-lead/v139-stable, read 2026-10-02
# for #2038. Only the agent_ref input the markets caller forwards is kept; the
# markets dev-lead job declares no caller concurrency group.
name: Dev-Lead (reusable)

on:
workflow_call:
inputs:
agent_ref:
type: string
required: false
default: ""

jobs:
dispatch:
runs-on: ubuntu-latest
steps:
- run: echo snapshot
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# PINNED-USES: petry-projects/.github/.github/workflows/pr-auto-review-reusable.yml@pr-auto-review/v1-stable
# SNAPSHOT (trimmed) of petry-projects/.github
# .github/workflows/pr-auto-review-reusable.yml @ pr-auto-review/v1-stable,
# read 2026-10-02 for #2038. The reusable declares NO concurrency group at
# workflow or job level; the markets caller forwards no with: inputs.
name: PR Auto Review (reusable)

on:
workflow_call: {}

jobs:
ready-check:
runs-on: ubuntu-latest
steps:
- run: echo snapshot
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# PINNED-USES: petry-projects/.github-private/.github/workflows/pr-review.yml@pr-review/stable
# SNAPSHOT (trimmed) of petry-projects/.github-private
# .github/workflows/pr-review.yml @ pr-review/stable (776c9585c8fff87a1ffefd469137791ab6467e61),
# read 2026-10-02 for #2038. Only the parts the two ingress guards read are kept:
# the workflow_call inputs (validate-caller-inputs.sh) and the workflow-level
# concurrency group verbatim (the ADR-0010 collision rule). Re-snapshot if the
# markets §3 pin moves.
Comment thread
don-petry marked this conversation as resolved.
Resolved
name: PR Review Agent

on:
workflow_call:
inputs:
agent_ref:
type: string
required: false
default: ""
pr_url:
type: string
required: false
default: ""
dry_run:
type: string
required: false
default: ""
force_review:
type: string
required: false
default: ""

concurrency:
group: >-
${{
(inputs.pr_url
|| github.event.client_payload.pr_url
|| (github.event.pull_request.number && format('{0}/pull/{1}', github.repository, github.event.pull_request.number))
|| (github.event.check_suite.pull_requests[0].number && format('{0}/pull/{1}', github.repository, github.event.check_suite.pull_requests[0].number)))
&& format('pr-review-pr-{0}{1}',
inputs.pr_url
|| github.event.client_payload.pr_url
|| (github.event.pull_request.number && format('{0}/pull/{1}', github.repository, github.event.pull_request.number))
|| (github.event.check_suite.pull_requests[0].number && format('{0}/pull/{1}', github.repository, github.event.check_suite.pull_requests[0].number)),
(github.event.pull_request.head.sha
|| github.event.check_suite.head_sha
|| github.event.client_payload.sha)
&& format('-{0}',
github.event.pull_request.head.sha
|| github.event.check_suite.head_sha
|| github.event.client_payload.sha)
|| '')
|| 'pr-review-batch'
}}
cancel-in-progress: false

jobs:
review:
runs-on: ubuntu-latest
steps:
- run: echo snapshot
Loading