Skip to content

Commit 9059cd5

Browse files
authored
Harden persona evaluator isolation and scenario inputs (#80470)
1 parent a891e05 commit 9059cd5

3 files changed

Lines changed: 44 additions & 11 deletions

File tree

‎.github/workflows/agent-persona-explorer.lock.yml‎

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎.github/workflows/agent-persona-explorer.md‎

Lines changed: 30 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -152,17 +152,20 @@ Otherwise, for each selected persona, generate **2 representative automation tas
152152
Persona: [Role Name]
153153
Task: [Brief task description - max 1 sentence]
154154
Context: [1-2 sentences max]
155+
Inputs: [Relevant repository paths/keys, labels, units, standards and numeric thresholds; state N/A where not applicable]
155156
Expected Workflow Type: [Issue automation / PR automation / Scheduled / On-demand]
156157
```
157158

159+
Name concrete inputs rather than relying on unstated assumptions. For accessibility scenarios, specify the WCAG criterion, conformance level, and threshold. Do not invent missing inputs; mark the scenario incomplete and do not score it until they are explicit.
160+
158161
**Example scenarios by persona:**
159162
- Backend Engineer: "Automatically review PR database schema changes for migration safety"
160163
- Frontend Developer: "Generate visual regression test reports when new components are added"
161164
- DevOps Engineer: "Monitor failed deployment logs and create incidents with root cause analysis"
162165
- QA Tester: "Analyze test coverage changes in PRs and comment with recommendations"
163166
- Product Manager: "Weekly digest of completed features grouped by customer impact"
164167
- Program Manager: "Weekly cross-team milestone status digest with blocked items highlighted"
165-
- Designer: "Flag PRs that modify shared design tokens or component CSS without a matching Figma link"
168+
- Designer (DS-2): "For PRs changing `design-tokens.json` keys `color.*` or `spacing.*`, check for a linked Figma reference and assess target size against WCAG 2.5.8 AA's 24 × 24 CSS px minimum; use the `design-system` and `accessibility` labels."
166169
- Legal / Compliance: "Scan new dependencies added in PRs for non-permissive SPDX licenses"
167170
- Information Worker: "Weekly summary of stale documentation files not updated in the last 90 days"
168171

@@ -179,7 +182,12 @@ Store all scenarios in cache memory.
179182
"invocation": {
180183
"method": "claude-code-inline-sub-agent",
181184
"status": "succeeded",
182-
"error": null
185+
"error": null,
186+
"isolation_canary": {
187+
"root_agents_md_context": "absent",
188+
"skill_inventory_context": "absent",
189+
"git_status_snapshot": "absent"
190+
}
183191
},
184192
"recommendation": {
185193
"trigger": "suggested trigger",
@@ -200,7 +208,7 @@ Store all scenarios in cache memory.
200208
}
201209
```
202210

203-
Summarize the recommendation; do not include full YAML. For successful invocations, replace each score placeholder with an integer from 1 to 5. Set `invocation.method` to `claude-code-inline-sub-agent`. If invocation fails, set `invocation.status` to `failed`, record the error in `invocation.error`, and set both `recommendation` and `scores` to `null`. Never encode an invocation failure as a score.
211+
Summarize the recommendation; do not include full YAML. For successful invocations, replace each score placeholder with an integer from 1 to 5. Set `invocation.method` to `claude-code-inline-sub-agent`. If invocation fails, set `invocation.status` to `failed`; if its isolation canary fails or is incomplete, set it to `contaminated`. In either case, record the error and set both `recommendation` and `scores` to `null`. Never encode an invocation failure or contamination as a score.
204212

205213
**Assessment questions:** Does the suggestion include appropriate triggers (`on:`)? Correct tools (github, web-fetch, playwright, etc.)? Proper safe-outputs? Security best practices (minimal permissions, network restrictions)? A clear, actionable prompt?
206214

@@ -214,10 +222,18 @@ The `persona-evaluator` is dynamically materialized as a Claude Code sub-agent f
214222

215223
For every evaluator call, pass only its scenario, guidance mode and required
216224
response format. Do not pass parent analysis, prior responses, scores, ambient
217-
`AGENTS.md` content or skill inventories. The evaluator must use only the
218-
guidance files allowed by its mode; if the runtime injects ambient instructions
219-
that cannot be excluded, mark the invocation contaminated/unavailable and do
220-
not score it.
225+
`AGENTS.md` content, git status or skill inventories.
226+
227+
Before reading guidance or scoring, require the evaluator to return an
228+
`isolation_canary` with `root_agents_md_context`, `skill_inventory_context` and
229+
`git_status_snapshot`, each set to `absent`, `present` or `unknown`. These
230+
fields describe context/instructions visible to the evaluator, not files that
231+
exist in the checkout. Score only when all three are `absent` and the evaluator
232+
confirms it used only the guidance files allowed by its mode. A missing,
233+
`present` or `unknown` value, or an injected instruction it cannot exclude,
234+
makes the invocation `contaminated/unavailable`: discard its recommendation
235+
and scores. Do not infer a clean context from a recommendation or from the
236+
canary alone if guidance outside the allowed files is visible.
221237

222238
**Important**:
223239
- You are ONLY testing the agent's responses, NOT creating actual workflows
@@ -412,6 +428,13 @@ read `.github/agents/agentic-workflows.md` and follow ad hoc evaluation in
412428
only the first 8,000 UTF-8 bytes of each guidance file, including metadata;
413429
follow only routes visible there and apply the same bound to linked guidance.
414430
Never read hidden tails or reconstruct them from other full-guidance results.
431+
Before reading guidance or evaluating the scenario, return an `isolation_canary`
432+
with `root_agents_md_context`, `skill_inventory_context` and
433+
`git_status_snapshot`, each `absent`, `present` or `unknown`. These values
434+
describe visible context/instructions, not files that exist in the checkout.
435+
If any is not `absent`, or if other ambient instructions cannot be excluded,
436+
stop and report contamination without a recommendation. Do not claim absence
437+
if the context cannot be inspected.
415438
If ambient instructions are injected and cannot be excluded, report the
416439
invocation as contaminated without a recommendation or score. Return guidance
417440
paths, byte counts and unavailable routes with the recommendation. Do not

‎pkg/cli/agent_persona_explorer_workflow_contract_test.go‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@ func TestAgentPersonaExplorerWorkflowSubAgentContract(t *testing.T) {
2828
require.Len(t, agents, 1)
2929
require.Equal(t, "persona-evaluator", agents[0].Name)
3030
assert.Contains(t, main, "## Success Criteria", "Extraction must preserve the parent's publishing instructions")
31+
assert.Contains(t, main, "Before reading guidance or scoring")
32+
assert.Contains(t, main, "discard its recommendation")
33+
assert.Contains(t, main, "Designer (DS-2)")
34+
assert.Contains(t, main, "`color.*` or `spacing.*`")
35+
assert.Contains(t, main, "WCAG 2.5.8 AA's 24 × 24 CSS px minimum")
36+
assert.Contains(t, main, "the `design-system` and `accessibility` labels")
3137

3238
agent, err := parser.ExtractFrontmatterFromContent(agents[0].Content)
3339
require.NoError(t, err)
@@ -36,5 +42,9 @@ func TestAgentPersonaExplorerWorkflowSubAgentContract(t *testing.T) {
3642
assert.Equal(t, "inherit", agent.Frontmatter["model"], "Claude uses inherit, not inherited, for the parent model")
3743
assert.Contains(t, agent.Markdown, ".github/agents/agentic-workflows.md")
3844
assert.Contains(t, agent.Markdown, ".github/aw/create-agentic-workflow.md")
45+
assert.Contains(t, agent.Markdown, "root_agents_md_context")
46+
assert.Contains(t, agent.Markdown, "skill_inventory_context")
47+
assert.Contains(t, agent.Markdown, "git_status_snapshot")
48+
assert.Contains(t, agent.Markdown, "Do not claim absence")
3949
assert.NotContains(t, agent.Markdown, "## Success Criteria", "Parent instructions must stay outside the evaluator")
4050
}

0 commit comments

Comments
 (0)