Skip to content

fix(monitor): parse multiline health output - #769

Merged
proerror77 merged 2 commits into
mainfrom
codex/collector-monitor-multiline-json-738
Aug 9, 2026
Merged

proerror77 merged 2 commits into
mainfrom
codex/collector-monitor-multiline-json-738

Conversation

@proerror77

@proerror77 proerror77 commented Aug 9, 2026

Copy link
Copy Markdown
Owner

Issue relationship

Refs #738

Summary

  • Parses the complete Base64-decoded Cloud Assistant output as one JSON object instead of truncating pretty-printed JSON to its opening brace.
  • Preserves healthy ok:true, unhealthy ok:false breach routing, and fail-closed handling for command failure, missing InvokeId, empty output, invalid Base64, malformed JSON, and missing or non-boolean ok.
  • Adds deterministic Base64 multiline fixtures for both healthy and unhealthy snapshots.

Root cause

The old first-matching-line filter returned only the opening brace of a pretty-printed object. The later boolean check therefore received an incomplete object and misclassified a valid ok:false breach as a monitor invocation failure.

Validation

  • Focused red before fix: collector monitor does not parse the complete multiline health JSON
  • Collector monitor contract: PASS
  • ShellCheck: PASS
  • YAML parse: PASS
  • git diff --check: PASS
  • Independent static review: PASS
  • actionlint: unavailable locally
  • Agent worktree preflight: unavailable because the known large-worktree pipeline exits 141 without output; branch, HEAD, status, private manifest, and allowed files were read back manually.

Runtime boundary

Repository code and contract tests only. This PR does not modify Aliyun or GitHub configuration, does not rerun the monitor, and does not perform Gate, shadow, cutover, restart, or reload operations.

Summary by CodeRabbit

  • Bug Fixes

    • Improved health snapshot parsing for complete multiline JSON output.
    • Invalid, empty, or malformed health data is now correctly treated as an invocation failure.
    • Health checks now report failures only when execution succeeds and the health status is explicitly unhealthy.
  • Tests

    • Added coverage for healthy, unhealthy, empty, invalid Base64, and invalid JSON responses.

@coderabbitai

coderabbitai Bot commented Aug 9, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@proerror77, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 47 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: f7bf384c-4335-40cf-9e73-bc30550e6173

📥 Commits

Reviewing files that changed from the base of the PR and between 4ee45b5 and 1ea8f0b.

📒 Files selected for processing (2)
  • .github/scripts/test-monitor-collector-host.sh
  • .github/workflows/monitor-collector-host.yml
📝 Walkthrough

Walkthrough

The monitor checks now decode complete multiline health JSON, validate its structure, and distinguish unhealthy results from invocation failures. The workflow uses strict jq parsing and applies the updated failure condition.

Changes

Health output validation

Layer / File(s) Summary
Health decoding and classification
.github/scripts/test-monitor-collector-host.sh
The tests decode base64 output, validate JSON objects and boolean .ok values, and classify empty or malformed output as invocation failures.
Workflow health snapshot integration
.github/workflows/monitor-collector-host.yml, .github/scripts/test-monitor-collector-host.sh
The workflow uses jq to extract a valid JSON health snapshot. Unhealthy runs fail only when the health invocation succeeds; invocation failures remain checked separately.

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

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description explains the change and validation, but it omits several required template sections, including dependencies, rollout, rollback, and scope exception. Add all required template headings and provide values, using None where a section does not apply.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: parsing multiline health output.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ 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 codex/collector-monitor-multiline-json-738

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/monitor-collector-host.yml:
- Line 136: Update the health_json assignment in
.github/workflows/monitor-collector-host.yml at lines 136-136 to fail on any
Base64 decode or JSON parse error and accept only exactly one complete top-level
JSON object; remove the unconditional success fallback. In
.github/scripts/test-monitor-collector-host.sh lines 63-104, keep the test
helper aligned with this strict parsing behavior and add fixtures covering
concatenated objects, trailing garbage, and invalid Base64 suffixes.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: d0e13257-44d9-4487-b3a2-8ab36b5e3630

📥 Commits

Reviewing files that changed from the base of the PR and between cea732d and 4ee45b5.

📒 Files selected for processing (2)
  • .github/scripts/test-monitor-collector-host.sh
  • .github/workflows/monitor-collector-host.yml

Comment thread .github/workflows/monitor-collector-host.yml Outdated

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

Copy link
Copy Markdown

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: 4ee45b5213

ℹ️ 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".

Comment thread .github/workflows/monitor-collector-host.yml Outdated
@proerror77
proerror77 merged commit e2a66fc into main Aug 9, 2026
49 checks passed
@proerror77
proerror77 deleted the codex/collector-monitor-multiline-json-738 branch August 9, 2026 08:18
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.

1 participant