Skip to content

Fix Requirements Reviewer + Tagline Update #54

Description

@sylvansys

Branch: 54-fix/take-a-look-at-prs-49-53-and-see-how-we-
Plan file: /home/ben/.claude/plans/warm-squishing-newt.md


Fix Requirements Reviewer + Tagline Update

Tasks

  1. Fix requirements reviewer JSON extraction - still failing despite multi-strategy fix
  2. Update tagline - change to "PR review updates from your Constellos agents. Based on linked issue(s), context files, and committed changes."
  3. Improve issue linking - detect any #123 reference in PR description (not just closing keywords)

Task 1: Fix Requirements Reviewer

Current Status

  • Multi-strategy extraction already implemented but still fails
  • Code Quality: Works (4 passed, 1 failed)
  • Requirements: RESULT_JSON: empty, shows "0 passed • 0 failed • 0 skipped"

Root Cause (from CI logs)

Claude ran successfully for requirements (1 turn, ~5s, $0.03) and saved output to execution file, but extraction still fails. This means:

  1. Either ALL_TEXT is empty (jq extraction from execution file fails)
  2. Or Claude's response doesn't contain JSON in any extractable format

Fix: Add Debug Logging + Robust Extraction

File: .github/actions/requirements-reviewer/action.yml

Add debug logging to see what's in ALL_TEXT:

# Debug: Show what we're working with
echo "DEBUG: Checking execution file..."
if [ -f "$EXEC" ]; then
  echo "DEBUG: File exists, size: $(wc -c < "$EXEC") bytes"
  echo "DEBUG: Message types in file:"
  jq -r '.[].type' "$EXEC" 2>/dev/null | sort | uniq -c || echo "DEBUG: jq failed"
fi

ALL_TEXT=$(jq -r '[.[] | select(.type=="assistant") | .message.content[]? | select(.type=="text") | .text] | join("\n")' "$EXEC" 2>/dev/null || echo "")
echo "DEBUG: ALL_TEXT length: ${#ALL_TEXT}"
echo "DEBUG: ALL_TEXT preview: ${ALL_TEXT:0:500}"

Also add Strategy 4 - extract JSON using Python for better multiline handling:

# Strategy 4: Use Python for robust JSON extraction
if ! echo "$JSON" | jq . >/dev/null 2>&1; then
  JSON=$(python3 -c "
import re, sys
text = '''$ALL_TEXT'''
match = re.search(r'\{[^{}]*\"checks\"[^{}]*\[.*?\][^{}]*\}', text, re.DOTALL)
if match: print(match.group())
" 2>/dev/null)
fi

Task 2: Update Tagline

File: .github/actions/review-comment/action.yml (line 197)

Change:

echo "Updates on your PR checks from AI reviewers."

To:

echo "PR review updates from your Constellos agents. Based on linked issue(s), context files, and committed changes."

Task 3: Improve Issue Linking

Current behavior: Only detects issues from:

  1. Branch name pattern (54-fix/...)
  2. Closing keywords (Closes #X, Fixes #X, Resolves #X)
  3. GitHub's closingIssuesReferences API

Improvement: Also detect any #123 mention in PR description.

File: .github/actions/requirements-reviewer/action.yml (context step)

Add after the closing keywords check:

# Fallback 3: Find any issue reference (#123) in PR body
if [ -z "$ISSUE" ]; then
  ISSUE=$(echo "$PR_BODY" | grep -oP '#\K[0-9]+' | head -1 || echo "")
fi

Files to Modify

  1. .github/actions/requirements-reviewer/action.yml - debug logging + extraction fixes + issue linking
  2. .github/actions/review-comment/action.yml - tagline update

Verification

  1. Push changes
  2. Check CI logs for DEBUG output showing what ALL_TEXT contains
  3. Requirements section should show 3 checks (Completeness, Scope, Traceability)
  4. Tagline should update in PR comment
  5. Issue linking should work with any #N reference in PR description

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions