Skip to content

refactor(skills): make HVE behavior testing a final one-shot gate - #2821

Closed
Allen Greaves (agreaves-ms) wants to merge 9 commits into
mainfrom
feat/hve-builder-tester-improvements
Closed

refactor(skills): make HVE behavior testing a final one-shot gate#2821
Allen Greaves (agreaves-ms) wants to merge 9 commits into
mainfrom
feat/hve-builder-tester-improvements

Conversation

@agreaves-ms

@agreaves-ms Allen Greaves (agreaves-ms) commented Aug 31, 2026

Copy link
Copy Markdown
Collaborator

Description

This PR changed HVE Builder and HVE Builder Tester so behavior testing occurs once against a frozen final candidate instead of recurring during small correction loops. It also reduced always-loaded authoring guidance, retained independent static review and evidence grading, and added advisory conformance coverage for the final-gate decisions.

Final-candidate lifecycle

  • HVE Builder completed known source changes, local validation, and one fresh-context static review before freezing the candidate.
  • Minor and Medium changes recorded a supported behavior-test skip. Major mutations and behavior-bearing reviews invoked HVE Builder Tester at most once.
  • A non-Pass behavior report ended the current run and could seed a later HVE Builder invocation, rather than authorizing a same-run edit and retest.

One-run tester and focused guidance

  • HVE Builder Tester performed one complete black-box run with explicit simulation or native fidelity, containment evidence, and one independent grade.
  • The always-loaded HVE Builder instruction was reduced from 289 to 71 lines. Detailed lifecycle and review guidance moved to on-demand references.
  • Bounded authoring and local validation remained parent-owned; open-ended research and independent review retained isolated dispatch paths.

Regression and documentation

  • The HVE final-gate stimulus required the atomic choices after-candidate-freeze, zero-or-one, and stop-and-defer.
  • Direct and generated documentation were synchronized with the new lifecycle.
  • Behavior-conformance grader guidance and inventory were corrected to match current runtime and source data.

Related Issue(s)

None.

Type of Change

Select all that apply:

Code & Documentation:

  • Bug fix (non-breaking change fixing an issue)
  • New feature (non-breaking change adding functionality)
  • Breaking change (fix or feature causing existing functionality to change)
  • Documentation update

Infrastructure & Configuration:

  • GitHub Actions workflow
  • Linting configuration (markdown, PowerShell, etc.)
  • Security configuration
  • DevContainer configuration
  • Dependency update

AI Artifacts:

  • Reviewed contribution with hve-builder and addressed all actionable findings
  • Copilot instructions (.github/instructions/*.instructions.md)
  • Copilot prompt (.github/prompts/*.prompt.md)
  • Copilot agent (.github/agents/*.agent.md)
  • Copilot skill (.github/skills/*/SKILL.md)
  • Copilot hook (.github/hooks/*/*.json)
  • Eval spec added/updated for changed AI artifacts (evals/)

Note for AI Artifact Contributors:

  • Agents: Research, indexing/referencing other project (using standard VS Code GitHub Copilot/MCP tools), planning, and general implementation agents likely already exist. Review .github/agents/ before creating new ones.
  • Skills: Must include both bash and PowerShell scripts. See Skills.
  • Model Versions: Contributions MUST target models listed in the model catalog (scripts/linting/model-catalog.json) whose provider appears in providerAllowlist and whose status is ga or preview. Run npm run lint:models to validate references.
  • See Agents Not Accepted and Model Version Requirements.

Other:

  • Script/automation (.ps1, .sh, .py)
  • Other (please describe):

Sample Prompts (for AI Artifact Contributions)

User Request:

Improve an existing Copilot skill, gather all known changes before testing, and validate the final behavior without repeatedly rerunning the behavior tester.

Execution Flow:

  1. HVE Builder resolved the mode, targets, requirements, write boundary, and applicable conventions.
  2. It completed bounded authoring and local mechanical validation.
  3. One fresh-context static review returned a complete finding set; HVE Builder applied one correction batch and reran affected checks.
  4. It froze and classified the final candidate.
  5. Eligible Minor or Medium changes recorded Satisfied-and-skipped; a Major or behavior-bearing target invoked HVE Builder Tester once.
  6. The tester designed black-box scenarios, executed each once at explicit fidelity, obtained an independent grade, and returned terminal evidence.

Output Artifacts:

  • Updated prompt, instruction, agent, subagent, or skill targets within the approved write boundary
  • HVE Builder authoring, static-review, validation, and behavior evidence under the configured evidence root
  • One HVE Artifact Test Report for a tested Major candidate, or a documented supported skip

Success Indicators:

  • All known source and mechanical findings were complete before source freeze.
  • Static review and required local validation passed.
  • A Major candidate had no more than one HVE Builder Tester invocation.
  • The tested source revision did not change after tester dispatch.
  • The final response separated validation, behavior disposition, fidelity, execution status, verdict, and limitations.

For detailed contribution requirements, see:

Testing

The branch was rebased onto current main, and both npm package roots were restored from their lockfiles.

Passed local validation:

  • npm run validate:docs (10 Jest suites, 78 tests, and 11 Mermaid accessibility tests)
  • npm run spell-check
  • Plugin synchronization and validation, generated asset documentation checks, extension preparation, and extension naming
  • Static eval lint, schema, text, and safety lanes
  • Final-gate deterministic controls with three valid and fourteen invalid response shapes
  • Every validate:local constituent check after the link step, including Python lint across 17 projects after their locked uv environments were provisioned
  • The PR CI-equivalent Markdown link scope: external links in changed files plus repository-wide internal links

npm run validate:local and the standalone npm run lint:md-links stopped on six external URLs in two files unchanged from main. The changed-file link scope used by hosted PR CI passed. HVE Builder Tester was not run during this change. Hosted behavior-conformance evidence remains advisory CI output.

Checklist

Required Checks

  • Documentation is updated (if applicable)
  • Files follow existing naming conventions
  • Changes are backwards compatible (N/A — behavior-test timing and same-run retest behavior intentionally changed)
  • Tests added for new functionality (if applicable)

AI Artifact Contributions

  • Used hve-builder review mode to review contribution
  • Addressed all actionable findings from the hve-builder review
  • Verified contribution follows common standards and type-specific requirements

Required Local Checks

The following local-safe validation commands must pass before merging:

  • Local validation aggregate: npm run validate:local (inherited full-link baseline; all other constituent checks passed)
  • Documentation validation (if docs changed): npm run validate:docs
  • Spell checking: npm run spell-check
  • Link validation: npm run lint:md-links (inherited full-link baseline; hosted PR scope passed)

Security Considerations

  • This PR does not contain any sensitive or NDA information
  • Any new dependencies have been reviewed for security issues (N/A — no dependency files changed)
  • Security-related scripts follow the principle of least privilege (N/A — no security scripts changed)

Additional Notes

  • No GHCP artifact was added or removed, so plugin membership did not change.
  • The branch was rebased onto current main; one generated instruction-index date conflict was resolved to 2026-08-31.
  • PR preparation replaced one unrecognized eval word with equivalent wording after the post-rebase spell check identified it.
  • Behavior execution was intentionally not claimed as local evidence. The advisory hosted eval lane remains the source for model-backed calibration.

@agreaves-ms
Allen Greaves (agreaves-ms) requested a review from a team as a code owner August 31, 2026 23:06
@codecov-commenter

Codecov Comments Bot (codecov-commenter) commented Aug 31, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.23%. Comparing base (2be7fc3) to head (ebdd731).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2821      +/-   ##
==========================================
+ Coverage   83.11%   83.23%   +0.11%     
==========================================
  Files         183      184       +1     
  Lines       34068    34449     +381     
  Branches       25       25              
==========================================
+ Hits        28317    28672     +355     
- Misses       5748     5774      +26     
  Partials        3        3              
Flag Coverage Δ
docusaurus 89.92% <ø> (ø)
pester 84.19% <ø> (+0.33%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.
see 6 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions

Copy link
Copy Markdown
Contributor

Eval Execution

Status: Passed

  • Artifacts evaluated: 3
  • Specs run: 3
  • Assertions passed: 21
  • Assertions failed (blocking): 0
  • Assertions failed (advisory): 0
  • Failed specs (merge-blocking): 0
Artifact Kind Status Specs Passed Failed (blocking) Failed (advisory)
hve-builder instruction ❌ fail 1 0 0 0
hve-builder-tester skill ✅ pass 1 3 0 0
hve-builder skill ✅ pass 1 18 0 0

Legend — ✅ clean · ⚠️ advisory failures only (non-blocking) · ⏭️ skipped · ❌ merge-blocking failure

Only Failed specs (merge-blocking) gates this PR. Advisory assertion failures are signal-quality checks captured during iteration; review them, but they do not block merge and may be acceptable.

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.

Thanks for the rewrite, this should improve the cycles and repeated testing.
A few comments inline which may be worth reviewing.

3. Research only when needed. Use the `rpi-research` bridge in [stage-dispatch.md](stage-dispatch.md) for open-ended exploration, non-obvious reuse or extension discovery, and decision-critical evidence gaps. Do not substitute local discovery.
4. Author the candidate. The lifecycle lead edits approved targets directly. Gather current requirements and findings before each coherent batch. Return to scope before a type change, artifact split, capability-surface change, or new support artifact outside the boundary.
5. Validate the candidate. Run known non-mutating local checks, gather their complete in-scope finding set, and close those findings as a coherent batch before independent review. Do not invoke the behavior tester while validation remains open.
6. Review and close static findings. Dispatch one fresh-context Medium-profile static review against the mechanically valid candidate. Apply its complete in-scope finding set in one correction batch, then run targeted static closure and every validation check affected by the corrections. If either remains open, stop Revise. If the assessed boundary changes, return to scope rather than claiming closure.

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 extension reference still promises that a discovered, registered specialist reviewer is dispatched alongside generic static review. The rewritten lifecycle only defines one generic reviewer and contains no step that invokes an approved extension subagent by name.

A host can register Terraform Module Reviewer and have rpi-research discover it, but HVE Builder proceeds directly to the generic reviewer. The specialized checks never run even though the extension remains documented as supported.

Restore an explicit step that dispatches approved extension reviewers alongside the generic reviewer and merges their bounded findings before correction and candidate freeze, or remove the unsupported extension promise.

Suggested change
6. Review and close static findings. Dispatch one fresh-context Medium-profile static review against the mechanically valid candidate. Apply its complete in-scope finding set in one correction batch, then run targeted static closure and every validation check affected by the corrections. If either remains open, stop Revise. If the assessed boundary changes, return to scope rather than claiming closure.
6. Review and close static findings. Dispatch one fresh-context Medium-profile generic static review and every discovered, approved extension reviewer against the mechanically valid candidate. Merge their bounded findings, apply the complete in-scope finding set in one correction batch, then run targeted static closure and every validation check affected by the corrections. If either remains open, stop Revise. If the assessed boundary changes, return to scope rather than claiming closure.

Comment on lines +96 to +97
| `Deferred` | A required stage or CI result is unavailable, behavior execution is Partial or Deferred, or the behavior verdict is Not available |
| `Revise` | Static findings remain, validation fails, behavior verdict is Revise, or an acceptance criterion is unmet |

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 outcome table uses first-match ordering and maps every Partial behavior execution to Deferred before it considers a behavior verdict of Revise. If one scenario exposes an artifact defect and another fails after usable evidence is produced, the independent grader can return Revise while execution is Partial. HVE Builder then reports Deferred and sends the next owner toward an unchanged rerun instead of the actionable defect.

Give a graded Revise or Blocked verdict precedence over Partial execution. Map Partial to Deferred only when unavailable capability prevented completion and no actionable graded verdict determines the outcome.

Suggested change
| `Deferred` | A required stage or CI result is unavailable, behavior execution is Partial or Deferred, or the behavior verdict is Not available |
| `Revise` | Static findings remain, validation fails, behavior verdict is Revise, or an acceptance criterion is unmet |
| `Revise` | Static findings remain, validation fails, behavior verdict is Revise, or an acceptance criterion is unmet |
| `Deferred` | A required stage or CI result is unavailable, behavior execution is Partial or Deferred, or the behavior verdict is Not available |

pair based on the skill's behavior:
`Timing:` `after-candidate-freeze` | `before-candidate-freeze`
`Invocations:` `repeat-until-pass` | `zero-or-one`
`Revise:` `stop-and-defer` | `correct-and-retest`

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 stimulus requires Revise: stop-and-defer, but the workflow contract keeps Revise and Deferred as distinct terminal outcomes. An actionable behavior finding resolves to Revise; Deferred is reserved for unavailable evidence or execution. The eval therefore rewards the wrong caller-facing disposition.

Replace stop-and-defer with stop-and-revise or equivalent Revise-preserving language in both the choices and regex.

Suggested change
`Revise:` `stop-and-defer` | `correct-and-retest`
`Revise:` `stop-and-revise` | `correct-and-retest`

- type: output-matches
name: final-candidate-decisions
config:
pattern: '(?i)^[ \t]*Timing:[ \t]*after-candidate-freeze[ \t]*\r?\n[ \t]*Invocations:[ \t]*zero-or-one[ \t]*\r?\n[ \t]*Revise:[ \t]*stop-and-defer[ \t]*(?:\r?\n)?(?![\s\S])'

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.

Companion fix for the Revise disposition above: keep the grader pattern aligned with the corrected choice.

Suggested change
pattern: '(?i)^[ \t]*Timing:[ \t]*after-candidate-freeze[ \t]*\r?\n[ \t]*Invocations:[ \t]*zero-or-one[ \t]*\r?\n[ \t]*Revise:[ \t]*stop-and-defer[ \t]*(?:\r?\n)?(?![\s\S])'
pattern: '(?i)^[ \t]*Timing:[ \t]*after-candidate-freeze[ \t]*\r?\n[ \t]*Invocations:[ \t]*zero-or-one[ \t]*\r?\n[ \t]*Revise:[ \t]*stop-and-revise[ \t]*(?:\r?\n)?(?![\s\S])'

Design and grading run at the higher of Medium and the target profile, so the grader is never weaker than the executor it assesses. A Low target keeps design and grading at Medium; a High target raises both to High. This preserves independent semantic coverage and grading rather than pinning a fixed tier.
1. Resolve targets, types, purpose, requirements, profile, requested fidelity, isolation and together sets, sandbox root, candidate revision, and report path. If no runtime behavior exists, write a supported skip report and return.
2. Select fidelity through the methodology preconditions. Default to simulation. When requested native execution is unsupported or unsafe, use simulation only with caller acceptance; otherwise return Deferred with the rerun condition.
3. Capture pre-run workspace state and create a unique sandbox containing `run-state.md`. Record the candidate revision, profile and model, fidelity, groupings, purpose, requirements, containment controls, and requirement map.

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.

Flow step 3 requires run-state.md to contain a requirement map. Step 4 creates the scenario IDs and maps requirements to observable outcomes. A new run must therefore invent mappings before scenarios exist, leave a required field incomplete, or rewrite the earlier evidence contract silently.

Keep the requirement inventory in run-state.md and make test-design.md the sole owner of the requirement-to-scenario map.

Suggested change
3. Capture pre-run workspace state and create a unique sandbox containing `run-state.md`. Record the candidate revision, profile and model, fidelity, groupings, purpose, requirements, containment controls, and requirement map.
3. Capture pre-run workspace state and create a unique sandbox containing `run-state.md`. Record the candidate revision, profile and model, fidelity, groupings, purpose, requirements, and containment controls.

Comment on lines 44 to +45
| # | Action | Mapped dimension | Artifact | Profile | Evidence class | Severity | Evidence | Resolving change |
|---|--------|------------------|----------|---------|----------------|----------|----------|------------------|
|---|---|---|---|---|---|---|---|---|

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 reference requires every finding to record both fidelity and evidence class, but the canonical Findings table has only Evidence class. These are not equivalent: native or simulation identifies how the target ran, while observed, simulated, or emulated classifies the evidence.

Add a Fidelity column to the canonical Findings table and preserve it separately from Evidence class.

Suggested change
| # | Action | Mapped dimension | Artifact | Profile | Evidence class | Severity | Evidence | Resolving change |
|---|--------|------------------|----------|---------|----------------|----------|----------|------------------|
|---|---|---|---|---|---|---|---|---|
| # | Action | Mapped dimension | Artifact | Profile | Fidelity | Evidence class | Severity | Evidence | Resolving change |
|---|---|---|---|---|---|---|---|---|---|

3. Run fresh-context static review and one behavior gate with route-specific execution: Major mutations and behavior-bearing review targets execute testing, while eligible no-runtime review targets and Minor or Medium mutations are satisfied-and-skipped
3. Complete all known edits, fresh-context static review, and local validation before freezing the candidate and resolving one final behavior gate. Major mutations and behavior-bearing review targets invoke HVE Builder Tester at most once; eligible no-runtime review targets and Minor or Medium mutations are satisfied-and-skipped. A behavior finding ends the current run and becomes input to a later invocation rather than a same-run edit and retest
4. Keep known target files and caller-supplied canonical references as bounded lifecycle reads; activate `rpi-research` for open-ended exploration and decision-critical research
5. Run non-mutating host validation and resolve one overall outcome

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.

Step 3 places local validation before candidate freeze and the final behavior gate. Step 5 then tells readers to run non-mutating host validation afterward. The workflow contract forbids validation after tester dispatch in the same run, so the public sequence can invalidate the frozen-boundary evidence.

Move all host validation before freeze and make the final step outcome resolution only.

Suggested change
5. Run non-mutating host validation and resolve one overall outcome
5. Resolve one overall outcome

| `prompts.eval.yaml` | 3p | Advisory | 51 | `behavior-conformance` | Active (Phase 9) |
| `instructions.eval.yaml` | 3i | Advisory | 62 | `behavior-conformance` | Active (Phase 11) |
| `skill-behavior.eval.yaml` | 3s | Advisory | 219 | `behavior-conformance` | Active (Phase 13) |
| `instructions.eval.yaml` | 3i | Advisory | 64 | `behavior-conformance` | Active (Phase 11) |

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 README reports 64 stimuli, but direct counts show 65 total entries: 63 instruction-tagged plus two backlog-management entries.

Suggested change
| `instructions.eval.yaml` | 3i | Advisory | 64 | `behavior-conformance` | Active (Phase 11) |
| `instructions.eval.yaml` | 3i | Advisory | 65 | `behavior-conformance` | Active (Phase 11) |

The maintained `prompts.eval.yaml` inventory contains 51 stimuli across 48 prompt subjects. Coverage includes RPI orchestration, security review and planning, Design Thinking, Git and pull request operations, evaluation authoring, and VEX workflows. Backlog and work-item coverage moved to `skill-behavior.eval.yaml` when those workflows became skills.

The maintained `instructions.eval.yaml` inventory contains 62 stimuli across 46 instruction subjects. Coverage spans:
The maintained `instructions.eval.yaml` inventory contains 64 stimuli: 62 instruction-tagged stimuli across 46 instruction subjects, plus two `backlog-management` skill stimuli. Coverage spans:

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.

Keep the prose inventory aligned with the corrected table and direct counts.

Suggested change
The maintained `instructions.eval.yaml` inventory contains 64 stimuli: 62 instruction-tagged stimuli across 46 instruction subjects, plus two `backlog-management` skill stimuli. Coverage spans:
The maintained `instructions.eval.yaml` inventory contains 65 stimuli: 63 instruction-tagged stimuli across 46 instruction subjects, plus two `backlog-management` skill stimuli. Coverage spans:

- converge edits and validation before behavior testing
- simplify tester execution and always-loaded guidance
- add final-candidate conformance coverage

♻️ - Generated by Copilot
- reject contradictory timing, invocation, and revise outputs
- align declared stimulus total with the parsed inventory

🧪 - Generated by Copilot
- constrain output to three opposing choices
- prevent partial grader scores from passing

🧪 - Generated by Copilot
- document current deterministic and LLM grader use
- distinguish eval graders from hygiene checks

📝 - Generated by Copilot
- report all 64 instruction stimuli
- align skill subject count with source tags

📝 - Generated by Copilot
@agreaves-ms
Allen Greaves (agreaves-ms) force-pushed the feat/hve-builder-tester-improvements branch from 9ff4f67 to f5b2d5e Compare September 2, 2026 19:25

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for consolidating HVE Builder around a frozen final candidate and one terminal behavior gate. The comprehensive review found two blocking contract issues before this can merge. Native fidelity can currently be authorized without verifying the target's effective tool and external-action authority, so its read-only or contained precondition is not enforceable. The tester also has no contract-valid recoverable state when execution completes but independent grading is temporarily unavailable. Please address those blockers, then bind the frozen candidate to its test evidence, restore isolation for scenario design, and add tester behavior evidence. For specialist integration, please add a generic pre-freeze assurance envelope so domain-owned RAI, Privacy, and Accessibility adapters can reuse adequate accepted evidence for unchanged obligations, run targeted checks for bounded impact, and require full review or defer when impact is material or indeterminate. The branch should also be updated from main, required checklist evidence completed, and open review threads resolved before re-review.

@agreaves-ms

Copy link
Copy Markdown
Collaborator Author

Addressed comments in #2843 closing this PR as that one replaces this one.

@agreaves-ms
Allen Greaves (agreaves-ms) deleted the feat/hve-builder-tester-improvements branch September 5, 2026 04:29
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.

5 participants