Skip to content

fix(quality-loop): output options as YAML object instead of string#101

Merged
marcusquinn merged 1 commit intomainfrom
bugfix/yaml-options-format
Jan 15, 2026
Merged

fix(quality-loop): output options as YAML object instead of string#101
marcusquinn merged 1 commit intomainfrom
bugfix/yaml-options-format

Conversation

@marcusquinn
Copy link
Owner

@marcusquinn marcusquinn commented Jan 14, 2026

Summary

  • Fix YAML frontmatter parsing error in quality-loop state files
  • The options field was output as a string "auto_fix=true" but OpenCode expects a YAML object
  • Now properly converts comma-separated key=value pairs to YAML object format

Problem

OpenCode failed to launch with error:

Configuration is invalid at .opencode/agent/loop-state/quality-loop.local.md
Invalid input: expected record, received string options

Solution

Changed create_state() function to output:

options:
  auto_fix: true

Instead of:

options: "auto_fix=true"

Test plan

  • Verified OpenCode launches successfully after fix
  • Preflight linters pass

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chores
    • Improved internal configuration handling with enhanced type support for boolean, numeric, and string values.
    • Updated state file generation for better compatibility with structured configuration formats.

✏️ Tip: You can customize this high-level summary in your review settings.

The create_state function was outputting options as a quoted string
(e.g., options: "auto_fix=true") which caused OpenCode to fail parsing
the YAML frontmatter with "expected record, received string" error.

Now converts comma-separated key=value pairs to proper YAML object:
  options:
    auto_fix: true

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 14, 2026

Walkthrough

The quality-loop-helper script now properly converts comma-separated key=value configuration parameters into YAML format with appropriate type coercion, replacing direct string embedding. The script's state file path reference is also updated to reflect the new directory structure.

Changes

Cohort / File(s) Summary
Configuration Parsing Enhancement
\.agent/scripts/quality-loop-helper.sh``
Renamed options parameter to options_str, implemented YAML conversion logic with boolean/numeric/string type coercion, updated state file path from .claude/quality-loop.local.md to .agent/loop-state/quality-loop.local.md, replaced direct string embedding with proper YAML block formatting

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

A script that was rigid, now bends with care,
Parsing key-values into YAML fair,
Booleans coerced, strings in their place,
Types flowing right through the automation space! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix(quality-loop): output options as YAML object instead of string' accurately summarizes the main change: converting options from a quoted string format to a YAML object format in the quality-loop helper script.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

🧹 Recent nitpick comments
.agent/scripts/quality-loop-helper.sh (1)

239-252: Edge case: Values containing double quotes would corrupt YAML output.

The type coercion logic is solid for typical use cases. However, if a string value contains embedded double quotes (e.g., message=Hello "World"), the resulting YAML would be malformed:

  message: "Hello "World""

Given the current usage patterns (boolean flags and simple values), this is unlikely to occur, but consider escaping quotes for robustness.

♻️ Optional: Escape embedded quotes in string values
             if [[ "$value" == "true" || "$value" == "false" || "$value" =~ ^[0-9]+$ ]]; then
                 echo "  $key: $value"
             else
-                echo "  $key: \"$value\""
+                # Escape embedded double quotes for valid YAML
+                local escaped_value="${value//\"/\\\"}"
+                echo "  $key: \"$escaped_value\""
             fi

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 11e8f78 and 9ced438.

📒 Files selected for processing (1)
  • .agent/scripts/quality-loop-helper.sh
🧰 Additional context used
📓 Path-based instructions (1)
.agent/scripts/*.sh

⚙️ CodeRabbit configuration file

.agent/scripts/*.sh: Automation scripts - focus on:

  • Reliability and robustness
  • Clear logging and feedback
  • Proper exit codes
  • Error recovery mechanisms

Files:

  • .agent/scripts/quality-loop-helper.sh
🧠 Learnings (1)
📚 Learning: 2026-01-06T15:57:56.027Z
Learnt from: CR
Repo: marcusquinn/aidevops PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-06T15:57:56.027Z
Learning: Applies to **/.agent/scripts/linters-local.sh : Run quality checks before committing using .agent/scripts/linters-local.sh

Applied to files:

  • .agent/scripts/quality-loop-helper.sh
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Codacy Static Code Analysis
🔇 Additional comments (3)
.agent/scripts/quality-loop-helper.sh (3)

229-237: LGTM! Clear parameter documentation and path consistency.

The comment accurately describes the new options_str parameter format and the updated side-effect path correctly reflects the STATE_FILE constant at line 35.


254-268: LGTM! Core fix correctly implements YAML object format.

This change directly addresses the PR objective. The heredoc now produces properly structured YAML:

options:
  auto_fix: true
  wait_for_ci: false

One behavioral note: when options_str is empty, options: will have a null value rather than an empty object {}. This is valid YAML and should work with OpenCode's parser, but worth keeping in mind if strict object typing is ever required.


519-519: YAML conversion integration verified across all call sites.

All create_state callers (lines 519, 782, 975) pass well-formed options strings containing only booleans, numeric values, and simple identifiers. The conversion logic in create_state() correctly handles each:

  • Booleans (true/false) and numbers render unquoted
  • Other values render with quotes

No edge cases present—integration is solid.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.


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 and usage tips.

@gemini-code-assist
Copy link

Summary of Changes

Hello @marcusquinn, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request resolves a critical issue preventing OpenCode from launching due to an invalid YAML configuration in quality-loop state files. Previously, the options field was generated as a simple string, which OpenCode's YAML parser rejected. The changes introduce robust parsing logic to transform a comma-separated key=value string into a structured YAML object, thereby ensuring correct configuration interpretation and restoring OpenCode's functionality.

Highlights

  • YAML Parsing Fix: Resolved a critical YAML parsing error in quality-loop state files where the options field was incorrectly output as a string, leading to OpenCode launch failures.
  • Dynamic YAML Object Generation: Implemented new logic within the create_state() function to convert a comma-separated string of key=value pairs into a properly formatted YAML object, handling boolean, numeric, and string values appropriately.
  • OpenCode Compatibility: Ensured OpenCode can now correctly parse the options configuration, preventing the Invalid input: expected record, received string options error and restoring functionality.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@sonarqubecloud
Copy link

@github-actions
Copy link

🔍 Code Quality Report

�[0;35m[MONITOR]�[0m Code Review Monitoring Report

�[0;34m[INFO]�[0m Latest Quality Status:
SonarCloud: 0 bugs, 0 vulnerabilities, 261 code smells

�[0;34m[INFO]�[0m Recent monitoring activity:
Wed Jan 14 23:23:25 UTC 2026: Code review monitoring started
Wed Jan 14 23:23:25 UTC 2026: SonarCloud - Bugs: 0, Vulnerabilities: 0, Code Smells: 261
Wed Jan 14 23:23:25 UTC 2026: Qlty - 0 issues found, auto-formatting applied
Wed Jan 14 23:23:27 UTC 2026: Codacy analysis completed with auto-fixes

📈 Current Quality Metrics

  • BUGS: 0
  • CODE SMELLS: 261
  • VULNERABILITIES: 0

Generated on: Wed Jan 14 23:24:07 UTC 2026


Generated by AI DevOps Framework Code Review Monitoring

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request correctly fixes a YAML parsing issue by converting the options from a string to a YAML object in the state file. The approach of parsing the comma-separated key-value pairs is sound. I have one suggestion to improve the robustness of string handling by escaping special characters, which will prevent potential YAML validation errors for complex option values.

if [[ "$value" == "true" || "$value" == "false" || "$value" =~ ^[0-9]+$ ]]; then
echo " $key: $value"
else
echo " $key: \"$value\""

Choose a reason for hiding this comment

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

high

The current implementation for quoting string values is not fully robust. It will produce invalid YAML if an option's value contains a double quote (") or a backslash (\). This could lead to YAML parsing errors, similar to the issue this PR aims to resolve. To make the value handling more robust, you should escape backslashes and double quotes before wrapping the value in quotes.

Suggested change
echo " $key: \"$value\""
value=${value//\\/\\\\}
value=${value//\"/\\\"}
echo " $key: \"$value\""

@augmentcode
Copy link

augmentcode bot commented Jan 14, 2026

🤖 Augment PR Summary

Summary: Fixes quality-loop state frontmatter by emitting options as a YAML mapping instead of a string, matching OpenCode’s expected schema.
Changes: Parses comma-separated key=value option strings into properly typed YAML entries when creating .agent/loop-state/quality-loop.local.md.

🤖 Was this summary useful? React with 👍 or 👎

Copy link

@augmentcode augmentcode bot left a comment

Choose a reason for hiding this comment

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

Review completed. 2 suggestions posted.

Fix All in Augment

Comment augment review to trigger a new review at any time.

status: running
started_at: "$(date -u +%Y-%m-%dT%H:%M:%SZ)"
options: "$options"
options:
Copy link

Choose a reason for hiding this comment

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

If options_str is empty, this will emit options: with a null value; if OpenCode strictly expects a record/mapping here, this may still fail schema validation in the no-options case.

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎

if [[ "$value" == "true" || "$value" == "false" || "$value" =~ ^[0-9]+$ ]]; then
echo " $key: $value"
else
echo " $key: \"$value\""
Copy link

Choose a reason for hiding this comment

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

value is double-quoted but not YAML-escaped, so values containing " or newlines could produce invalid frontmatter; consider sanitizing/escaping if any option values can be user-controlled.

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎

@marcusquinn marcusquinn merged commit 7a09a2e into main Jan 15, 2026
15 of 17 checks passed
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