fix: use single-line format for summary and activity outputs in Health 75#956
fix: use single-line format for summary and activity outputs in Health 75#956
Conversation
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.
There was a problem hiding this comment.
💡 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" |
There was a problem hiding this comment.
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 👍 / 👎.
There was a problem hiding this comment.
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_jsonfor GITHUB_TOKEN, PAT, and GitHub App;summaryin aggregate step;activity_jsonin consumer repos) to useprintfformat - Refactored JSON extraction/validation logic in the aggregate step to use a simpler
safe_json()function that leveragesjq -cfor 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 |
There was a problem hiding this comment.
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.
| # 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 |
Automated Status Summary
Scope
After merging PR #103 (multi-agent routing infrastructure), we need to:
GITHUB_STEP_SUMMARYoutput so iteration results are visible in the Actions UIContext for Agent
Design Decisions & Constraints
<!-- keepalive-loop-summary -->| github-actions[bot] | NEW: CLI agent iteration tracking | ✅ Keep for CLI agents |<!-- keepalive-state:v1 -->| agents-workflows-bot[bot] | State tracking |<!-- keepalive-round: N -->| stranske | OLD: Instruction comment | ❌ CLI agents dont need this |agent:*label), we should have exactly one updating comment (<!-- keepalive-loop-summary -->) instead of accumulating 10+ comments per PR.Related Issues/PRs
References
Blockers & Dependencies
Tasks
Pipeline Validation
agent:codexlabelGITHUB_STEP_SUMMARY
agents-keepalive-loop.ymlafter agent runConditional Status Summary
buildStatusBlock()inagents_pr_meta_update_body.jsto acceptagentTypeparameteragentTypeis set (CLI agent): hide workflow table, hide head SHA/required checksComment Pattern Cleanup
agent:*label):<!-- gate-summary: -->comment posting (use step summary instead)<!-- keepalive-round: N -->instruction comments (task appendix replaces this)<!-- keepalive-loop-summary -->to be the single source of truthagent:*label):<!-- gate-summary: -->commentagent_typeoutput to detect job so downstream workflows know the modeagents-pr-meta.ymlto conditionally skip gate summary for CLI agent PRsAcceptance criteria
Head SHA: 2c9b7aa
Latest Runs: ✅ success — Gate
Required: gate: ✅ success