fix(opencode): exclude loop-state from agent discovery and deployment#110
fix(opencode): exclude loop-state from agent discovery and deployment#110marcusquinn merged 1 commit intomainfrom
Conversation
- setup.sh: Use rsync to exclude loop-state/ from deployment to ~/.aidevops/agents/ - generate-opencode-agents.sh: Exclude loop-state/ from subagent discovery - generate-opencode-agents.sh: Remove incorrectly created loop-state agent files This fixes 'Loop-State/Quality-Loop.Local' appearing in OpenCode tab cycle. Loop state files are runtime state, not agents.
|
Caution Review failedThe pull request is closed. WalkthroughThe PR excludes runtime loop-state files from agent discovery and deployment processes. It updates the agent generation script to skip loop-state paths and modifies deployment logic to use rsync-based selective copying with fallback handling. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
✨ Finishing touches
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. Comment |
Summary of ChangesHello @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 an issue where local runtime state files, specifically those within the Highlights
Using Gemini Code AssistThe 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
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 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
|
|
🔍 Code Quality Report�[0;35m[MONITOR]�[0m Code Review Monitoring Report �[0;34m[INFO]�[0m Latest Quality Status: �[0;34m[INFO]�[0m Recent monitoring activity: 📈 Current Quality Metrics
Generated on: Sat Jan 17 03:06:22 UTC 2026 Generated by AI DevOps Framework Code Review Monitoring |
🤖 Augment PR SummarySummary: Prevents local runtime loop-state markdown files from being treated as OpenCode agents and deployed to the user agent directory. 🤖 Was this summary useful? React with 👍 or 👎 |
There was a problem hiding this comment.
Code Review
This pull request correctly addresses the issue of loop-state files being treated as agents by excluding them during deployment and discovery. The changes are logical and well-described. I've identified a potential bug in the setup.sh fallback logic that could mask errors during file copy operations, and a point of improvement in generate-opencode-agents.sh to make the cleanup logic more robust. My review includes suggestions to fix these issues.
| else | ||
| # Fallback: copy then remove loop-state | ||
| cp -R "$source_dir"/* "$target_dir/" | ||
| rm -rf "$target_dir/loop-state" 2>/dev/null || true | ||
| fi |
There was a problem hiding this comment.
In the fallback case where rsync is not available, the exit status of the cp command is not correctly propagated. If cp fails, the script will continue as if the deployment was successful because the || true on the rm command masks the error. This could lead to silent failures. You should ensure that a failure in cp is reported by preserving and propagating its exit code.
| else | |
| # Fallback: copy then remove loop-state | |
| cp -R "$source_dir"/* "$target_dir/" | |
| rm -rf "$target_dir/loop-state" 2>/dev/null || true | |
| fi | |
| else | |
| # Fallback: copy then remove loop-state | |
| cp -R "$source_dir"/* "$target_dir/" | |
| local cp_status=$? | |
| if [[ $cp_status -eq 0 ]]; then | |
| rm -rf "$target_dir/loop-state" 2>/dev/null || true | |
| fi | |
| (exit $cp_status) | |
| fi |
| # Remove loop-state files that were incorrectly created as agents | ||
| # These are runtime state files, not agents | ||
| for f in ralph-loop.local.md quality-loop.local.md full-loop.local.md loop-state.md re-anchor.md postflight-loop.md; do | ||
| rm -f "$OPENCODE_AGENT_DIR/$f" | ||
| done |
There was a problem hiding this comment.
This loop cleans up incorrectly created agent files from the root of $OPENCODE_AGENT_DIR. However, the sub-agent generation logic would have also created files inside a loop-state subdirectory within $OPENCODE_AGENT_DIR. To ensure a complete cleanup, you should also remove this directory. The hardcoded list of files is also a bit brittle.
| # Remove loop-state files that were incorrectly created as agents | |
| # These are runtime state files, not agents | |
| for f in ralph-loop.local.md quality-loop.local.md full-loop.local.md loop-state.md re-anchor.md postflight-loop.md; do | |
| rm -f "$OPENCODE_AGENT_DIR/$f" | |
| done | |
| # Remove loop-state files and directory that were incorrectly created as agents | |
| # These are runtime state files, not agents | |
| rm -rf "$OPENCODE_AGENT_DIR/loop-state" | |
| for f in ralph-loop.local.md quality-loop.local.md full-loop.local.md loop-state.md re-anchor.md postflight-loop.md; do | |
| rm -f "$OPENCODE_AGENT_DIR/$f" | |
| done |



Summary
.agent/loop-state/*.md) are runtime state, not agentsChanges
loop-state/from deployment to~/.aidevops/agents/loop-state/from subagent discovery with-not -path "*/loop-state/*"Root Cause
When running Ralph/Quality loops locally in the aidevops repo,
.agent/loop-state/directory is created with state files likequality-loop.local.md. These were being:~/.aidevops/agents/loop-state/by setup.shTesting
After merging, run
./setup.shto deploy the fix. The loop-state files will be excluded from deployment and removed from the OpenCode agent directory.Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.