Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 11 additions & 12 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@
tests/test_validate_interaction_model.bats \
tests/verify_persona_teams.bats \
tests/persona_runner.bats \
tests/resolve_persona_identity.bats \
tests/persona_reach_check.bats \
tests/test_dev_lead_concurrency_guard.bats \
tests/test_validate_workflow_schedules.bats \
Expand Down Expand Up @@ -240,7 +241,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 244 in .github/workflows/lint.yml

View workflow job for this annotation

GitHub Actions / Lint

244: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 Expand Up @@ -341,13 +342,12 @@
[ "$fail" -eq 0 ] || exit 1

validate-personas:
# Validate every personas/<id>/persona.yml against the canonical persona
# manifest schema (owned by petry-projects/.github, read the same way any
# consumer reads a published standard) plus the cross-invariants the schema
# can't express (id==dir==canary.agent, layer paths exist, vendor_pin ↔
# VENDOR.md, evals splits present, non-draft ⇒ canary-rings entry).
# NOTE: the schema is fetched from petry-projects/.github @ main, so this job
# only goes green once that repo's persona schema is on main (PR #670).
# Validate every personas/<id>/persona.yml against the persona manifest
# schema plus the cross-invariants the schema can't express (id==dir==canary.agent,
# layer paths exist, vendor_pin ↔ VENDOR.md, evals splits present, non-draft ⇒
# canary-rings entry). Uses a local ADR-0006-conformant schema (standards/personas/
# persona.schema.json) that properly distinguishes shared-runtime personas (which
# MUST NOT have canary blocks per ADR-0006) from dedicated-reusable personas.
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
Expand All @@ -357,12 +357,11 @@
run: pip3 install --quiet 'jsonschema>=4' pyyaml

- name: Validate persona manifests
# Read the canonical schema from petry-projects/.github. Prefer a
# same-named branch there (so companion PRs developed on a shared branch
# validate against each other before either merges); the validator falls
# back to main automatically, which is the steady state.
# Use local schema that implements ADR-0006: shared-runtime personas
# (runtime.reusable == .github/workflows/persona-runner-reusable.yml) MUST
# NOT have a canary block, while dedicated-reusable personas MUST have one.
env:
PERSONA_SCHEMA_REF: ${{ github.head_ref || github.ref_name }}
PERSONA_SCHEMA_FILE: standards/personas/persona.schema.json
run: python3 personas/validate-personas.py personas

validate-eval-cases:
Expand Down
106 changes: 92 additions & 14 deletions .github/workflows/persona-runner-reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,26 @@
# The AGENT gathers context and PRINTS the advisory between sentinels — it runs
# with github.token, which reads the (public) source repo but CANNOT post to
# it (that token is scoped to THIS repo). The WORKFLOW then enforces the marker
# and posts, using GH_PAT_WORKFLOWS. So an agent that forgets the marker cannot
# post an unmarked comment, because it cannot post at all. Prompt-only marker
# enforcement is how .github-private#860 happened (1,481 acks in 4.5h).
# and posts, using the persona's declared posting PAT. So an agent that forgets
# the marker cannot post an unmarked comment, because it cannot post at all.
# Prompt-only marker enforcement is how .github-private#860 happened (1,481 acks
# in 4.5h).
#
# Posting identity (per persona, from the manifest — NOT a repo-wide default):
# Which account a persona's advisory posts as is read from that persona's
# personas/<id>/persona.yml runtime.identity (account + credential), the
# #1316/#1317 pattern. Advisory personas post as the machine user donpetry-bot
# (DON_PETRY_BOT_GH_PAT), never a human maintainer — a human byline halves the
# router's recursion guard and carries owner author_association
# (.github-private#1650). The runner holds only the PATs for the sanctioned
# posting identities and fails loudly on any other declared credential.
#
# Requires:
# CLAUDE_CODE_OAUTH_TOKEN — org secret, the engine credential
# GH_PAT_WORKFLOWS — org PAT: the WORKFLOW uses it to post the comment on
# the cross-repo item. The agent never sees it.
# DON_PETRY_BOT_GH_PAT — org PAT: the WORKFLOW uses it to post the comment as
# donpetry-bot on the cross-repo item. The agent never
# sees it. (dev-lead advisories still post via
# GH_PAT_DON_PETRY pending its identity split.)
name: Persona Runtime — Reusable

on:
Expand Down Expand Up @@ -53,13 +65,19 @@
secrets:
CLAUDE_CODE_OAUTH_TOKEN:
required: true
DON_PETRY_BOT_GH_PAT:
# donpetry-bot's PAT — the machine account advisory personas post as. Which
# PAT is used is chosen per persona from runtime.identity.credential, not a
# repo-wide default (.github-private#1650). Grandfathered credential name.
required: false
GH_PAT_DON_PETRY:
# don-petry's PAT — the account the persona comment-poster authenticates as.
# Canonical name (GH_PAT_<ACCOUNT> schema); supersedes GH_PAT_WORKFLOWS below.
# don-petry's PAT — used only by a persona that still declares it as its
# posting identity (currently dev-lead, whose commit-vs-advisory identity
# split is tracked separately). Advisory-only personas post as donpetry-bot.
required: false
GH_PAT_WORKFLOWS:
# DEPRECATED alias of GH_PAT_DON_PETRY — kept during the rename migration.
required: true
# GH_PAT_WORKFLOWS removed (#1650): the broadly-scoped workflows PAT is no

Check warning on line 78 in .github/workflows/persona-runner-reusable.yml

View workflow job for this annotation

GitHub Actions / Lint

78:7 [comments-indentation] comment not indented like content
# longer a posting fallback here — least privilege, and posting under it
# attributed advisories to a human owner account.

permissions: {}

Expand All @@ -76,8 +94,8 @@
timeout-minutes: 15
permissions:
contents: read # checkout THIS repo's tooling + prompts. The agent reads
# the public source repo with github.token; the comment is

Check warning on line 97 in .github/workflows/persona-runner-reusable.yml

View workflow job for this annotation

GitHub Actions / Lint

97:24 [comments-indentation] comment not indented like content
# posted by the workflow with GH_PAT_WORKFLOWS.
# posted by the workflow with the persona's manifest PAT.
steps:
- name: Checkout persona tooling + prompts
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
Expand Down Expand Up @@ -119,6 +137,32 @@
;;
esac

- name: Resolve the persona's posting identity from its manifest
# Source of truth for who a persona posts as: personas/<id>/persona.yml
# runtime.identity (the #1316/#1317 pattern). The runner honors the
# manifest rather than a repo-wide default — a persona posting under a
# human maintainer's PAT is exactly what #1650 removes. The runner holds
# PATs only for the sanctioned posting identities; any other declared
# credential fails loudly rather than silently borrowing a default.
id: identity
if: steps.resolve.outputs.skip == 'false'
env:
PERSONA: ${{ inputs.persona }}
run: |
set -euo pipefail
account="$(bash scripts/lib/resolve-persona-identity.sh "$PERSONA" personas account)"
credential="$(bash scripts/lib/resolve-persona-identity.sh "$PERSONA" personas credential)"
case "$credential" in
DON_PETRY_BOT_GH_PAT | GH_PAT_DON_PETRY) ;;
*)
echo "::error::persona '${PERSONA}' declares posting credential '${credential}', which this runner holds no PAT for. Add it to the reusable's secrets: block and the token map in the post step."
exit 1
;;
esac
echo "account=${account}" >> "$GITHUB_OUTPUT"
echo "credential=${credential}" >> "$GITHUB_OUTPUT"
echo "resolved posting identity for '${PERSONA}': ${account} (${credential})"

- name: Install Claude Code
if: steps.resolve.outputs.skip == 'false'
env:
Expand All @@ -136,7 +180,7 @@
env:
CLAUDE_CODE_OAUTH_TOKEN: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
# github.token: reads the PUBLIC source repo, cannot post to it (scoped
# to THIS repo). The agent deliberately never receives GH_PAT_WORKFLOWS.
# to THIS repo). The agent deliberately never receives a posting PAT.
GH_TOKEN: ${{ github.token }}
PERSONA: ${{ inputs.persona }}
SOURCE_REPO: ${{ inputs.source_repo }}
Expand Down Expand Up @@ -183,16 +227,50 @@
- name: Enforce marker and post the comment (workflow — the only writer)
if: steps.resolve.outputs.skip == 'false' && steps.advise.outputs.skip_post == 'false'
env:
# The PAT lives ONLY here. The agent step above never had it.
GH_TOKEN: ${{ secrets.GH_PAT_DON_PETRY || secrets.GH_PAT_WORKFLOWS }}
# The PAT lives ONLY here. The agent step above never had it. WHICH
# PAT is used is driven by the persona manifest
# (runtime.identity.credential), resolved in the "identity" step —
# never a repo-wide default. The resolve step already constrained
# credential to this known set.
BOT_PAT: ${{ secrets.DON_PETRY_BOT_GH_PAT }}
OWNER_PAT: ${{ secrets.GH_PAT_DON_PETRY }}
PERSONA: ${{ inputs.persona }}
POSTING_ACCOUNT: ${{ steps.identity.outputs.account }}
POSTING_CREDENTIAL: ${{ steps.identity.outputs.credential }}
SOURCE_REPO: ${{ inputs.source_repo }}
ITEM_NUMBER: ${{ inputs.item_number }}
run: |
set -euo pipefail
# shellcheck source=scripts/lib/persona-runner.sh
source scripts/lib/persona-runner.sh

# Select the appropriate PAT based on the persona's manifest identity
if [ "$POSTING_CREDENTIAL" = "DON_PETRY_BOT_GH_PAT" ]; then
GH_TOKEN="${BOT_PAT}"
else
GH_TOKEN="${OWNER_PAT}"
fi
export GH_TOKEN

if [ -z "${GH_TOKEN:-}" ]; then
echo "::error::no PAT available to post as '${POSTING_ACCOUNT}' (credential '${POSTING_CREDENTIAL}') — is that secret set on this repo/org?"
exit 1
fi

# Defense in depth: the selected token MUST authenticate as the
# manifest-declared account. If the chosen secret is unset, we
# could silently post under the wrong identity — the exact #1650
# regression. Fail closed (a future mention retries) rather than
# post under the wrong identity.
actual_login="$(gh api user -q .login 2>/dev/null || true)"
if [ "$actual_login" != "$POSTING_ACCOUNT" ]; then
msg="posting token authenticates as '${actual_login:-<unknown>}', "
msg="${msg}not the manifest identity '${POSTING_ACCOUNT}' "
msg="${msg}(credential '${POSTING_CREDENTIAL}') — refusing to post"
echo "::error::${msg} under the wrong identity"
exit 1
fi

raw="$(cat "$RUNNER_TEMP/agent-out.txt")"
body="$(pr_extract_advisory "$raw")"
if [ -z "${body//[[:space:]]/}" ]; then
Expand Down
10 changes: 6 additions & 4 deletions personas/business-analyst/persona.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,14 @@ trust:

# --- Runtime identity (§5.1) ------------------------------------------------
# Advisory-only (producers under prompts/incubation, consumed by path and the
# persona runner). On the comment path it posts as `don-petry` (the runner
# authenticates with that account's PAT). No dedicated reusable yet.
# persona runner). On the comment path it posts as the machine user
# `donpetry-bot`, NOT the human owner — an advisory must be identifiably a bot in
# the audit trail (.github-private#1650). No dedicated reusable yet.
runtime:
identity:
account: don-petry
credential: GH_PAT_DON_PETRY
account: donpetry-bot
credential: DON_PETRY_BOT_GH_PAT
reusable: .github/workflows/persona-runner-reusable.yml

evals:
required_before: stable
Expand Down
7 changes: 7 additions & 0 deletions personas/dev-lead/persona.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,13 @@ trust:
# git-identity.sh then attributes commits to it. Distinct from address.handle
# (petry-projects/dev-lead, the mention team). This decoupling is the fix for
# the donpetry-bot regression (.github-private#1316).
#
# NOTE (.github-private#1650): this single identity field serves BOTH paths —
# the code-commit path (must be the owner) and the persona-runner advisory path
# (should be a bot, like every other advisory persona). Those pull in opposite
# directions, so unlike the other advisory personas this is NOT a mechanical flip
# to donpetry-bot: it needs a commit-vs-advisory identity split. Filed as a
# follow-up; dev-lead advisories keep posting via GH_PAT_DON_PETRY until then.
runtime:
# dev-lead ships its OWN reusable, so ADR-0002 applies in full: it is a
# registered ring agent (agents.dev-lead in canary-rings.json) and therefore
Expand Down
10 changes: 6 additions & 4 deletions personas/devops-lead/persona.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,14 @@ trust:

# --- Runtime identity (§5.1) ------------------------------------------------
# Advisory-only: devops-lead ships no dedicated reusable/stub in this pilot.
# It is consumed by path and is human-invocable. On the comment path it posts
# as `don-petry` (the persona runner authenticates with that account's PAT).
# It is consumed by path and is human-invocable. On the comment path it posts as
# the machine user `donpetry-bot`, NOT the human owner — an advisory must be
# identifiably a bot in the audit trail (.github-private#1650).
runtime:
identity:
account: don-petry
credential: GH_PAT_DON_PETRY
account: donpetry-bot
credential: DON_PETRY_BOT_GH_PAT
reusable: .github/workflows/persona-runner-reusable.yml

evals:
required_before: stable
Expand Down
1 change: 1 addition & 0 deletions personas/pr-review/persona.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ runtime:
identity:
account: donpetry-bot
credential: DON_PETRY_BOT_GH_PAT
reusable: .github/workflows/persona-runner-reusable.yml

# pr-review wraps two skills (deep-review + triage); their cases are combined
# under evals/pr-review/ to satisfy the schema's single-path constraint.
Expand Down
18 changes: 12 additions & 6 deletions personas/qa-lead/persona.yml
Original file line number Diff line number Diff line change
Expand Up @@ -147,14 +147,20 @@ trust:

# qa-lead ships no dedicated reusable/stub in this pilot — it is consumed by
# path (e.g. by the initiative-planner) and is human-invocable via the persona
# runner. It declares only `runtime.identity`: on the advisory/comment path it
# posts as `don-petry` (the persona runner authenticates with that account's
# PAT). Add the rest of `runtime` + a canary-rings.json entry when a dedicated
# advisory workflow is wired.
# runner. It declares only `runtime.identity`: on the advisory/comment path the
# persona runner authenticates with this account's PAT. It is the machine user
# `donpetry-bot`, NOT the human owner `don-petry` — a persona advisory must be
# identifiably a bot in the audit trail, and posting under a human account halved
# the router's recursion guard (only the marker axis protected it) and carried
# owner `author_association` (.github-private#1650). `donpetry-bot` is already in
# the router's bot-actor exclusion, so posting as it restores two-axis protection.
# Add the rest of `runtime` + a canary-rings.json entry when a dedicated advisory
# workflow is wired.
runtime:
identity:
account: don-petry
credential: GH_PAT_DON_PETRY
account: donpetry-bot
credential: DON_PETRY_BOT_GH_PAT
reusable: .github/workflows/persona-runner-reusable.yml

evals:
required_before: stable
Expand Down
10 changes: 6 additions & 4 deletions personas/scrum-master/persona.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,14 @@ trust:

# --- Runtime identity (§5.1) ------------------------------------------------
# Advisory-only (consumed by the initiative-planner and the persona runner). On
# the comment path it posts as `don-petry` (the runner authenticates with that
# account's PAT). No dedicated reusable yet.
# the comment path it posts as the machine user `donpetry-bot`, NOT the human
# owner — an advisory must be identifiably a bot in the audit trail
# (.github-private#1650). No dedicated reusable yet.
runtime:
identity:
account: don-petry
credential: GH_PAT_DON_PETRY
account: donpetry-bot
credential: DON_PETRY_BOT_GH_PAT
reusable: .github/workflows/persona-runner-reusable.yml

evals:
required_before: stable
Expand Down
10 changes: 6 additions & 4 deletions personas/security-lead/persona.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,14 @@ trust:

# --- Runtime identity (§5.1) ------------------------------------------------
# Advisory-only: security-lead ships no dedicated reusable/stub in this pilot.
# It is consumed by path and is human-invocable. On the comment path it posts
# as `don-petry` (the persona runner authenticates with that account's PAT).
# It is consumed by path and is human-invocable. On the comment path it posts as
# the machine user `donpetry-bot`, NOT the human owner — an advisory must be
# identifiably a bot in the audit trail (.github-private#1650).
runtime:
identity:
account: don-petry
credential: GH_PAT_DON_PETRY
account: donpetry-bot
credential: DON_PETRY_BOT_GH_PAT
reusable: .github/workflows/persona-runner-reusable.yml

evals:
required_before: stable
Expand Down
10 changes: 6 additions & 4 deletions personas/solution-architect/persona.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,14 @@ trust:
# --- Runtime identity (§5.1) ------------------------------------------------
# Present from birth. Advisory-only: solution-architect ships no dedicated
# reusable/stub in this pilot. It is consumed by path and is human-invocable. On
# the comment path it posts as `don-petry` (the persona runner authenticates
# with that account's PAT).
# the comment path it posts as the machine user `donpetry-bot`, NOT the human
# owner — an advisory must be identifiably a bot in the audit trail
# (.github-private#1650).
runtime:
identity:
account: don-petry
credential: GH_PAT_DON_PETRY
account: donpetry-bot
credential: DON_PETRY_BOT_GH_PAT
reusable: .github/workflows/persona-runner-reusable.yml

evals:
required_before: stable
Expand Down
10 changes: 6 additions & 4 deletions personas/sre-lead/persona.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,14 @@ trust:

# --- Runtime identity (§5.1) ------------------------------------------------
# Advisory-only: sre-lead ships no dedicated reusable/stub in this pilot.
# It is consumed by path and is human-invocable. On the comment path it posts
# as `don-petry` (the persona runner authenticates with that account's PAT).
# It is consumed by path and is human-invocable. On the comment path it posts as
# the machine user `donpetry-bot`, NOT the human owner — an advisory must be
# identifiably a bot in the audit trail (.github-private#1650).
runtime:
identity:
account: don-petry
credential: GH_PAT_DON_PETRY
account: donpetry-bot
credential: DON_PETRY_BOT_GH_PAT
reusable: .github/workflows/persona-runner-reusable.yml

evals:
required_before: stable
Expand Down
Loading
Loading