Skip to content

fix: use single-line format for summary and activity outputs in Health 75#956

Closed
stranske wants to merge 3 commits intomainfrom
fix/health-75-summary-output-format
Closed

fix: use single-line format for summary and activity outputs in Health 75#956
stranske wants to merge 3 commits intomainfrom
fix/health-75-summary-output-format

Conversation

@stranske
Copy link
Copy Markdown
Owner

@stranske stranske commented Jan 19, 2026

Source: Issue #123

Automated Status Summary

Scope

After merging PR #103 (multi-agent routing infrastructure), we need to:

  1. Validate the CLI agent pipeline works end-to-end with the new task-focused prompts
  2. Add GITHUB_STEP_SUMMARY output so iteration results are visible in the Actions UI
  3. Streamline the Automated Status Summary to reduce clutter when using CLI agents
  4. Clean up comment patterns to avoid a mix of old UI-agent and new CLI-agent comments

Context for Agent

Design Decisions & Constraints

    1. Clean up comment patterns to avoid a mix of old UI-agent and new CLI-agent comments
  • The keepalive loop now:
  • | <!-- keepalive-loop-summary --> | github-actions[bot] | NEW: CLI agent iteration tracking | ✅ Keep for CLI agents |
  • | <!-- keepalive-state:v1 --> | agents-workflows-bot[bot] | State tracking | ⚠️ Multiple copies accumulate |
  • | <!-- keepalive-round: N --> | stranske | OLD: Instruction comment | ❌ CLI agents dont need this |
  • The goal: For CLI agents (agent:* label), we should have exactly one updating comment (<!-- keepalive-loop-summary -->) instead of accumulating 10+ comments per PR.
  • Requires PR #103 to be merged first
  • This round you MUST:
  • Review the Scope/Tasks/Acceptance below, identify the next incomplete task that requires code, implement it, then post a reply comment with the completed items using their exact original text.

Related Issues/PRs

References

Blockers & Dependencies

  • After merging PR #103 (multi-agent routing infrastructure), we need to:
    1. Mark a task checkbox complete ONLY after verifying the implementation works.

Tasks

Pipeline Validation

  • After PR chore(codex): bootstrap PR for issue #101 #103 merges, create a test PR with agent:codex label
  • Verify task appendix appears in Codex prompt (check workflow logs)
  • Verify Codex works on actual tasks (not random infrastructure work)
  • Verify keepalive comment updates with iteration progress

GITHUB_STEP_SUMMARY

  • Add step summary output to agents-keepalive-loop.yml after agent run
  • Include: iteration number, tasks completed, files changed, outcome
  • Ensure summary is visible in workflow run UI

Conditional Status Summary

  • Modify buildStatusBlock() in agents_pr_meta_update_body.js to accept agentType parameter
  • When agentType is set (CLI agent): hide workflow table, hide head SHA/required checks
  • Keep Scope/Tasks/Acceptance checkboxes for all cases
  • Pass agent type from workflow to the update_body job

Comment Pattern Cleanup

  • For CLI agents (agent:* label):
  • Suppress <!-- gate-summary: --> comment posting (use step summary instead)
  • Suppress <!-- keepalive-round: N --> instruction comments (task appendix replaces this)
  • Update <!-- keepalive-loop-summary --> to be the single source of truth
  • Ensure state marker is embedded in the summary comment (not separate)
  • For UI Codex (no agent:* label):
  • Keep existing comment patterns (instruction comments, connector bot reports)
  • Keep <!-- gate-summary: --> comment
  • Add agent_type output to detect job so downstream workflows know the mode
  • Update agents-pr-meta.yml to conditionally skip gate summary for CLI agent PRs

Acceptance criteria

  • CLI agent receives explicit tasks in prompt and works on them
  • Iteration results visible in Actions workflow run summary
  • PR body shows checkboxes but not workflow clutter when using CLI agents
  • UI Codex path (no agent label) continues to show full status summary
  • CLI agent PRs have ≤3 bot comments total (summary, one per iteration update) instead of 10+
  • State tracking is consolidated in the summary comment, not scattered

Head SHA: 2c9b7aa
Latest Runs: ✅ success — Gate
Required: gate: ✅ success

Workflow / Job Result Logs
Agents PR meta manager ❔ in progress View run
Auto-label Dependabot PRs ⏭️ skipped View run
CI Autofix Loop ✅ success View run
Copilot code review ✅ success View run
Gate ✅ success View run
Health 40 Sweep ✅ success View run
Health 44 Gate Branch Protection ✅ success View run
Health 45 Agents Guard ❔ in progress View run
Health 50 Security Scan ✅ success View run
Maint 52 Validate Workflows ✅ success View run
PR 11 - Minimal invariant CI ✅ success View run
Selftest CI ✅ success View run
Validate Sync Manifest ✅ success View run

The EOF heredoc format was adding extra content to the JSON outputs.
Using single-line printf format instead for reliable JSON passing
between steps.
The heredoc format (<<EOF) was causing extra characters to be added
to the JSON outputs when passed between jobs. This affected both:
- summary output in the aggregate step
- activity_json output in the consumer repos step

Changed to single-line printf format which avoids the heredoc issue
that was causing 'Unmatched }' jq parse errors in downstream jobs.
Copilot AI review requested due to automatic review settings January 19, 2026 04:40
@stranske stranske temporarily deployed to agent-high-privilege January 19, 2026 04:40 — with GitHub Actions Inactive
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2c9b7aa5ed

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

echo "$activity_json" >> "$GITHUB_OUTPUT"
echo "EOF" >> "$GITHUB_OUTPUT"
# Use single-line format to avoid heredoc parsing issues
printf 'activity_json=%s\n' "$activity_json" >> "$GITHUB_OUTPUT"
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Ensure activity_json is single-line before GITHUB_OUTPUT

activity_json is built with plain jq (no -c), so once at least one repo entry is appended it becomes pretty-printed with newlines. Writing that value via printf 'activity_json=%s\n' uses the single-line name=value format, which GitHub Actions treats as invalid when the value contains newlines, so the output will be truncated or corrupted and downstream jobs will see empty/invalid JSON. Either compact the JSON when building it (e.g., jq -c) or switch back to the heredoc output format for this value.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes heredoc parsing issues in the Health 75 API Rate Diagnostic workflow by converting all remaining heredoc-style outputs to single-line printf format. This resolves jq parse errors that were occurring in downstream jobs when passing JSON data between GitHub Actions jobs.

Changes:

  • Converted five heredoc outputs (rate_json for GITHUB_TOKEN, PAT, and GitHub App; summary in aggregate step; activity_json in consumer repos) to use printf format
  • Refactored JSON extraction/validation logic in the aggregate step to use a simpler safe_json() function that leverages jq -c for validation
  • Added consistent comments explaining the single-line format change

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

# Extract JSON object - find first { and last } to handle any extra chars
extract_json() {
# Use jq to safely extract and re-emit valid JSON
# The -R flag reads raw input, and we use try-catch to handle invalid JSON
Copy link

Copilot AI Jan 19, 2026

Choose a reason for hiding this comment

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

The comment mentions "The -R flag reads raw input" but the code doesn't use the -R flag with jq. The function uses jq -c which outputs compact JSON. The comment should be updated to accurately reflect what the code does.

Suggested change
# The -R flag reads raw input, and we use try-catch to handle invalid JSON
# Use jq with compact output (-c) and shell-side fallback to handle invalid JSON

Copilot uses AI. Check for mistakes.
@stranske stranske closed this Jan 19, 2026
@stranske stranske deleted the fix/health-75-summary-output-format branch January 19, 2026 04:50
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.

2 participants