Skip to content

Wire validateGoalEvaluation into the stage-11 validation path (#196)#198

Merged
richard-devbot merged 3 commits into
mainfrom
feat/goal-eval-wiring-196
Jul 6, 2026
Merged

Wire validateGoalEvaluation into the stage-11 validation path (#196)#198
richard-devbot merged 3 commits into
mainfrom
feat/goal-eval-wiring-196

Conversation

@richard-devbot

@richard-devbot richard-devbot commented Jul 6, 2026

Copy link
Copy Markdown
Owner

Summary

Runtime enforcement of the agent-11 goal contract — the last prompt-text-only promise from PR #195's adversarial review (finding 6), which product goal 1 forbids.

  • New shared harness API validateStageGoalEvaluation({ runDir, stageIds }) in src/core/harness/goal-check.js (same shared-API-then-delegate pattern as validateBuilderCompleteness, [BLE-2.1] Enforce builder contract completeness #118/feat(harness): builder contract completeness as a shared harness capability #154; same {ok, checks, issues} contract shape). Exported from src/index.js.
  • Goal-active detection is structured state only: a goal.json in the run dir, or the pinned loop events (loop_iteration_started/goal_evaluated) that prove a pipeline loop --goal <recipe> context — the recipe file lives outside the run dir, so goal.json absence alone never means "no goal".
  • Wired into sdlc_validate (src/integrations/pi/rstack-sdlc.ts): on a goal-driven run, a task targeting 11-feedback-loop FAILs validation when feedback.json is missing or its goal_evaluation section is malformed — the named shape checks land in validation.json and the FAIL routes through the existing retry policy, instead of silently degrading to ASK_USER at loop time. The model-free pipeline run/loop bridge drives the same tool, so both paths are covered. Stage targets derive via taskStageIds (the rollup's own derivation), so the gate and the loop's stage reset can never disagree.
  • No enforcement without a goal: runs with no active goal record a single informational goal_evaluation_not_required PASS; tasks that never target stage 11 see no goal checks at all.
  • Docs: one surgical paragraph in the HARNESS.md goal-contract section.

Acceptance criteria (from #196)

  • Stage-11 validation path invokes validateGoalEvaluation when a goal definition is active (goal.json present / --goal recipe context)
  • Missing or malformed goal_evaluation on a goal-driven run = validation FAIL with checks/issues recorded in validation.json
  • No enforcement when the run has no active goal — the section stays optional
  • Tests cover both paths: unit tests in tests/harness-goal-check.test.js (missing artifact, absent section, malformed section, well-formed pass, loop-event detection, junk shapes) + end-to-end tests/extension-goal-gate.test.js through the mock-Pi sdlc_validate (all five transitions)

Verification

  • npm test — 487/487 pass
  • npm run lint — pass
  • npm run validate — pass (exit 0, all 196 agents)
  • node scripts/security-audit.mjs — baseline OK, 0 blocking
  • git diff --check — clean

Closes #196

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Added validation for stage-11 feedback goals during run validation, with clear checks recorded when required goal-evaluation details are missing or malformed.
    • Goal-related feedback is now read from the expected stage-specific location, with support for an older fallback location.
  • Bug Fixes

    • Runs without an active goal now skip goal-evaluation requirements instead of failing.
    • Tasks that do not target stage 11 no longer receive goal-specific validation checks.

richardsongunde and others added 3 commits July 6, 2026 12:23
…tract gate (#196)

When a goal is active for the run (goal.json in the run dir, or pinned
loop events proving a --goal recipe context), a task targeting
11-feedback-loop must ship a well-formed goal_evaluation section:
missing/malformed FAILs with the named shape checks. No active goal or
no stage-11 target = no enforcement, the section stays optional.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
sdlc_validate now delegates to validateStageGoalEvaluation (same
shared-harness pattern as validateBuilderCompleteness, #118/#154): on a
goal-driven run a stage-11 task with a missing or malformed
goal_evaluation FAILs validation with the named checks recorded in
validation.json. The model-free pipeline run/loop bridge drives the same
tool, so the gate covers both paths.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@coderabbitai

coderabbitai Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: fdab4121-eda8-4242-bc17-33458c96c7f9

📥 Commits

Reviewing files that changed from the base of the PR and between 269d303 and 3d4ae23.

📒 Files selected for processing (6)
  • docs/HARNESS.md
  • src/core/harness/goal-check.js
  • src/index.js
  • src/integrations/pi/rstack-sdlc.ts
  • tests/extension-goal-gate.test.js
  • tests/harness-goal-check.test.js

📝 Walkthrough

Walkthrough

This PR adds a Stage-11 validation gate that enforces the goal_evaluation contract at sdlc_validate time for goal-driven runs targeting 11-feedback-loop. It adds validateStageGoalEvaluation in the harness, wires it into the SDLC extension, updates docs, and adds tests.

Changes

Stage-11 Goal Evaluation Gate

Layer / File(s) Summary
Feedback path resolution and gate logic
src/core/harness/goal-check.js, src/index.js
Adds feedbackArtifactPath to resolve canonical or legacy feedback file locations, and adds validateStageGoalEvaluation to detect active goals and validate goal_evaluation shape, returning PASS/FAIL checks; re-exports are touched in src/index.js.
SDLC validation wiring
src/integrations/pi/rstack-sdlc.ts
Imports the new gate and stage-id helper, invokes validateStageGoalEvaluation during sdlc_validate, appends its checks, and forces overall FAIL when the gate fails.
Documentation
docs/HARNESS.md
Documents the new gate's enforcement conditions, failure behavior, and optionality when no goal is active or stage 11 isn't targeted.
Unit tests
tests/harness-goal-check.test.js
Adds tests for validateStageGoalEvaluation covering no-stage-11, no-active-goal, missing/malformed feedback, well-formed evaluation, and loop-event-driven goal detection.
Integration tests
tests/extension-goal-gate.test.js
Adds an end-to-end test exercising sdlc_validate across pass/fail scenarios including missing goal, missing feedback artifact, malformed and valid goal_evaluation, and untargeted stage tasks.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Possibly related issues

Possibly related PRs

Poem

A rabbit hopped through stage eleven's door,
checking feedback files it never saw before.
No goal, no fuss — a gentle PASS,
But malformed shapes won't ever pass! 🐰
Now every check is locked in tight,
validation.json sleeps easy tonight. ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly states the main change: wiring validateGoalEvaluation into the stage-11 validation path.
Linked Issues check ✅ Passed The PR enforces stage-11 goal evaluation only for active-goal runs and records validation failures, matching #196.
Out of Scope Changes check ✅ Passed The changes stay within goal-contract validation work plus related docs/tests, with no unrelated functionality added.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/goal-eval-wiring-196

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@richard-devbot richard-devbot merged commit 8c62b99 into main Jul 6, 2026
8 checks passed
@richard-devbot richard-devbot deleted the feat/goal-eval-wiring-196 branch July 6, 2026 07:27
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.

Wire validateGoalEvaluation into the stage-11 validation path (runtime enforcement of the goal contract)

2 participants