Skip to content

feat: add OpenCode GitHub/GitLab integration support#5

Merged
marcusquinn merged 1 commit intomainfrom
feature/opencode-github-gitlab-integration
Dec 22, 2025
Merged

feat: add OpenCode GitHub/GitLab integration support#5
marcusquinn merged 1 commit intomainfrom
feature/opencode-github-gitlab-integration

Conversation

@marcusquinn
Copy link
Copy Markdown
Owner

@marcusquinn marcusquinn commented Dec 22, 2025

Summary

  • Adds documentation and tooling for OpenCode's native GitHub/GitLab integrations
  • Enables AI-powered issue fixing and PR review directly from GitHub/GitLab comments

Changes

File Purpose
opencode-github.md GitHub App setup, /oc trigger docs
opencode-gitlab.md GitLab CI integration docs
opencode-github-setup-helper.sh Auto-detect setup status
opencode-github-workflow.yml GitHub Actions template
opencode-gitlab-ci.yml GitLab CI template

Usage

# Check status
~/.aidevops/agents/scripts/opencode-github-setup-helper.sh check

# Setup
opencode github install

Then use /oc fix this in any issue or PR comment.

Summary by CodeRabbit

  • New Features

    • Added OpenCode integration for GitHub with automated setup detection and configuration helpers.
    • Added OpenCode integration for GitLab with CI/CD setup guidance and automation templates.
    • Included ready-to-use workflow templates for both GitHub Actions and GitLab CI/CD pipelines.
  • Documentation

    • Added comprehensive setup and usage guides for both GitHub and GitLab integrations, including troubleshooting and security considerations.

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

- Add opencode-github.md with GitHub App setup and /oc trigger docs
- Add opencode-gitlab.md with GitLab CI integration docs
- Add opencode-github-setup-helper.sh for auto-detection of setup status
- Add workflow templates for GitHub Actions and GitLab CI
- Update git.md and AGENTS.md with integration references

Enables AI-powered issue/PR automation via OpenCode's native integrations.
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Dec 22, 2025

Note

.coderabbit.yaml has unrecognized properties

CodeRabbit is using all valid settings from your configuration. Unrecognized properties (listed below) have been ignored and may indicate typos or deprecated fields that can be removed.

⚠️ Parsing warnings (1)
Validation error: Unrecognized key(s) in object: 'path_instructions', 'path_filters'
⚙️ Configuration instructions
  • Please see the configuration documentation for more information.
  • You can also validate your configuration using the online YAML validator.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Walkthrough

Introduces OpenCode integration support for GitHub and GitLab platforms with documentation, setup automation, and workflow templates. Adds configuration files for GitHub Actions and GitLab CI, platform detection script, comprehensive documentation for both platforms, and updates existing agent/tool documentation.

Changes

Cohort / File(s) Summary
Setup and Configuration Documentation
\.agent/AGENTS\.md, \.agent/tools/git\.md
Updated agent and tool documentation to reference new OpenCode GitHub/GitLab integration sections with setup commands, usage examples, and links to detailed integration guides.
OpenCode Integration Documentation
\.agent/tools/git/opencode-github\.md, \.agent/tools/git/opencode-gitlab\.md
Added comprehensive integration guides covering setup (automated/manual), workflow installation, usage examples, token/secret management, permissions, troubleshooting, security considerations, and integration with aidevops for both platforms.
Platform Detection and Setup Script
\.agent/scripts/opencode-github-setup-helper\.sh
New Bash utility that detects Git remote type (GitHub, GitLab, Gitea, Bitbucket), inspects OpenCode integration status, validates AI provider secrets, and provides platform-specific setup workflows via check, setup, create-workflow, and help commands.
Workflow and CI Templates
configs/mcp-templates/opencode-github-workflow\.yml, configs/mcp-templates/opencode-gitlab-ci\.yml
Added GitHub Actions workflow template triggered on issue/PR comments with /oc or /opencode guards, and GitLab CI pipeline template with multi-stage setup, dependency installation, OpenCode execution, and post-run git commit/push workflows.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~35 minutes

  • Bash script logic: Platform detection, remote parsing, conditional checks for secrets and workflow files warrant careful validation
  • GitHub workflow permissions and triggers: Verify correct scopes (id-token, contents, pull-requests, issues) and guard clause implementation (/oc or /opencode trigger)
  • GitLab CI template complexity: Multi-stage setup, environment variable handling, conditional execution logic, and git push behavior need review
  • Documentation accuracy: Cross-references between GitHub and GitLab docs, setup instructions, and security considerations should be verified for consistency and completeness

Poem

🐰 Hop, skip, and a script so fine,
GitHub and GitLab now intertwine!
OpenCode flows through workflows bright,
AI comments dancing left and right,
Setup helpers ease the way—let's code with might! ✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and concisely summarizes the main change: adding OpenCode GitHub/GitLab integration support. It directly matches the changeset's primary objective.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/opencode-github-gitlab-integration

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
Copy Markdown

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 significantly expands the OpenCode platform's capabilities by introducing native integrations for GitHub and GitLab. It allows developers to leverage AI for automated issue resolution and pull request reviews directly from their version control system's comment sections. The changes include new documentation, a setup helper script, and CI/CD templates, all designed to simplify the adoption and configuration of these powerful AI-driven workflows.

Highlights

  • New OpenCode Integrations: Introduces comprehensive support for OpenCode's AI-powered features within GitHub and GitLab environments.
  • AI-Powered Automation: Enables AI to fix issues and review pull requests directly through comments in GitHub and GitLab.
  • Setup Helper Script: Adds a new shell script (opencode-github-setup-helper.sh) to assist users in checking and setting up their OpenCode GitHub integration.
  • Dedicated Documentation: Provides detailed markdown documentation (opencode-github.md, opencode-gitlab.md) for both GitHub and GitLab integrations, covering installation, usage, and troubleshooting.
  • CI/CD Templates: Includes new GitHub Actions (opencode-github-workflow.yml) and GitLab CI (opencode-gitlab-ci.yml) templates to streamline the deployment of OpenCode automation.
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
Copy Markdown

@github-actions
Copy link
Copy Markdown
Contributor

🔍 Code Quality Report

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

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

�[0;34m[INFO]�[0m Recent monitoring activity:
Mon Dec 22 01:18:46 UTC 2025: Code review monitoring started
Mon Dec 22 01:18:46 UTC 2025: SonarCloud - Bugs: 0, Vulnerabilities: 0, Code Smells: 144
Mon Dec 22 01:18:46 UTC 2025: Qlty - 0 issues found, auto-formatting applied
Mon Dec 22 01:18:48 UTC 2025: Codacy analysis completed with auto-fixes

📈 Current Quality Metrics

  • BUGS: 0
  • CODE SMELLS: 144
  • VULNERABILITIES: 0

Generated on: Mon Dec 22 01:19:20 UTC 2025


Generated by AI DevOps Framework Code Review Monitoring

Copy link
Copy Markdown

@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 introduces OpenCode integration for GitHub and GitLab, adding documentation, helper scripts, and CI/CD templates. The changes are well-structured and comprehensive. My review focuses on improving the robustness and maintainability of the new scripts and CI/CD templates, particularly around dependency management and scripting best practices. I've suggested pinning dependency versions in CI configurations to ensure stable and reproducible builds, and made some recommendations for improving the shell script's clarity and adherence to best practices.

Comment on lines +97 to +102
- npm install --global opencode-ai
- apt-get update && apt-get install -y git
# Install glab CLI
- |
curl -sL https://github.com/profclems/glab/releases/latest/download/glab_Linux_x86_64.tar.gz | tar xz
mv glab /usr/local/bin/
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

high

In the .gitlab-ci.yml example, npm install --global opencode-ai and the script to install glab both fetch the latest versions. This can cause your pipeline to break unexpectedly if a new version with breaking changes is released. It's a best practice to pin dependencies to specific versions for more stable and reproducible builds.

For example:

- npm install --global opencode-ai@1.2.3
- |
  GLAB_VERSION="v1.39.1" # Or any other specific version
  curl -sL "https://github.com/profclems/glab/releases/download/${GLAB_VERSION}/glab_${GLAB_VERSION#v}_Linux_x86_64.tar.gz" | tar xz
  mv glab /usr/local/bin/

fetch-depth: 1

- name: Run OpenCode
uses: sst/opencode/github@latest
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

high

Using @latest for GitHub Actions can lead to unexpected workflow failures if a new major version with breaking changes is released. It is a best practice to pin the action to a specific version (e.g., @v1) or a commit SHA to ensure workflow stability and reproducibility.

        uses: sst/opencode/github@v1 # Pin to a major version for stability


before_script:
# Install OpenCode CLI
- npm install --global opencode-ai
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

high

The npm install command does not specify a version for opencode-ai. This can lead to non-reproducible builds and unexpected failures if a new version with breaking changes is released. It's a best practice in CI/CD to pin dependencies to specific versions.

    - npm install --global opencode-ai@1.0.0 # Pin to a specific version

Comment on lines +39 to +42
- |
GLAB_VERSION=$(curl -s https://api.github.com/repos/profclems/glab/releases/latest | grep tag_name | cut -d '"' -f 4)
curl -sL "https://github.com/profclems/glab/releases/download/${GLAB_VERSION}/glab_${GLAB_VERSION#v}_Linux_x86_64.tar.gz" | tar xz
mv glab /usr/local/bin/
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

high

This script block to install glab has two issues:

  1. It fetches the latest version, which can cause pipeline instability if breaking changes are introduced. It's better to pin to a specific version.
  2. It parses the GitHub API's JSON response using grep and cut, which is fragile. A small change in the API output could break this script.

For a robust CI pipeline, you should use a fixed version and avoid fragile parsing.

    - |
      GLAB_VERSION="v1.39.1" # Pin to a specific version of glab
      curl -sL "https://github.com/profclems/glab/releases/download/${GLAB_VERSION}/glab_${GLAB_VERSION#v}_Linux_x86_64.tar.gz" | tar xz
      mv glab /usr/local/bin/

Comment on lines +28 to +32
print_info() {
local msg="$1"
echo -e "${BLUE}[INFO]${NC} $msg"
return 0
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The explicit return 0 is redundant in this shell function. By default, a function's return status is the exit status of the last command executed. Since echo will return 0 on success, the explicit return is not needed. Removing it makes the code more idiomatic. This advice applies to print_success, print_warning, and print_error as well.

Suggested change
print_info() {
local msg="$1"
echo -e "${BLUE}[INFO]${NC} $msg"
return 0
}
print_info() {
local msg="$1"
echo -e "${BLUE}[INFO]${NC} $msg"
}

Comment on lines +139 to +154
check_github_secrets() {
local repo_path="$1"

if ! command -v gh &> /dev/null; then
return 1
fi

# Check if ANTHROPIC_API_KEY secret exists
local secrets
secrets=$(gh secret list 2>/dev/null) || return 1

if echo "$secrets" | grep -q "ANTHROPIC_API_KEY\|OPENAI_API_KEY\|GOOGLE_API_KEY"; then
return 0
fi
return 1
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The repo_path parameter is unused in this function, as gh secret list automatically targets the current repository. It's good practice to remove unused parameters for cleaner code. Also, using grep -E with single quotes for the pattern is slightly more robust and standard for alternations.

Don't forget to update the call to this function in check_github_status (line 247) by removing the $repo_path argument.

Suggested change
check_github_secrets() {
local repo_path="$1"
if ! command -v gh &> /dev/null; then
return 1
fi
# Check if ANTHROPIC_API_KEY secret exists
local secrets
secrets=$(gh secret list 2>/dev/null) || return 1
if echo "$secrets" | grep -q "ANTHROPIC_API_KEY\|OPENAI_API_KEY\|GOOGLE_API_KEY"; then
return 0
fi
return 1
}
check_github_secrets() {
if ! command -v gh &> /dev/null; then
return 1
fi
# Check if an AI provider API key secret exists
local secrets
secrets=$(gh secret list 2>/dev/null) || return 1
if echo "$secrets" | grep -qE 'ANTHROPIC_API_KEY|OPENAI_API_KEY|GOOGLE_API_KEY'; then
return 0
fi
return 1
}

@augmentcode
Copy link
Copy Markdown

augmentcode bot commented Dec 22, 2025

🤖 Augment PR Summary

Summary: Adds first-class documentation and templates for OpenCode’s GitHub/GitLab integrations so issues/PRs/MRs can trigger AI automation via comments.

Changes:

  • Updated agent and tool docs to reference OpenCode GitHub/GitLab integrations
  • Added .agent/scripts/opencode-github-setup-helper.sh to detect platform and check installation/workflow/secrets/CI status
  • Added dedicated integration guides for GitHub (/oc, /opencode) and GitLab (@opencode)
  • Added reusable CI templates: GitHub Actions workflow and GitLab CI job under configs/mcp-templates/

Technical Notes: Workflows run OpenCode on your CI runners and require configuring an AI provider API key (e.g., ANTHROPIC_API_KEY) plus platform-specific auth (GitHub App / GitLab token).

🤖 Was this summary useful? React with 👍 or 👎

Copy link
Copy Markdown

@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. 4 suggestions posted.

Fix All in Augment

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

# Check if OpenCode app is installed on the repo
# This checks for any app installations on the repo
local installations
installations=$(gh api "repos/$repo_path/installation" 2>/dev/null) || {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

check_github_app() currently treats the presence of any GitHub App installation (via repos/$repo_path/installation) as “OpenCode App installed”, which can yield false positives if the repo has a different app installed.

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎

jobs:
opencode:
# Only run if comment contains /oc or /opencode
if: |
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This workflow triggers on any comment containing /oc or /opencode and runs with write permissions; consider ensuring only trusted commenters can trigger it (otherwise external commenters could potentially drive automated changes/cost).

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎

fetch-depth: 1

- name: Run OpenCode
uses: sst/opencode/github@latest
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Using sst/opencode/github@latest is a supply-chain/reproducibility risk for a workflow that can write to the repo; pinning to a specific version/SHA helps ensure runs are deterministic (also applies to other workflow snippets in this PR).

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎

# Install glab CLI for GitLab operations
- |
GLAB_VERSION=$(curl -s https://api.github.com/repos/profclems/glab/releases/latest | grep tag_name | cut -d '"' -f 4)
curl -sL "https://github.com/profclems/glab/releases/download/${GLAB_VERSION}/glab_${GLAB_VERSION#v}_Linux_x86_64.tar.gz" | tar xz
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The glab tarball typically extracts to a nested path (commonly bin/glab), so mv glab /usr/local/bin/ may fail in CI unless the extracted binary path is referenced correctly (also applies to the GitLab doc snippet in this PR).

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (2)
.agent/tools/git/opencode-gitlab.md (1)

246-246: Minor: Fix capitalization in table.

The word "github" in the table should be capitalized as "GitHub" (official product name).

🔎 Proposed fix
-| Auto-setup | `opencode github install` | Manual |
+| Auto-setup | `opencode GitHub install` | Manual |
configs/mcp-templates/opencode-gitlab-ci.yml (1)

39-42: Add error handling for glab CLI installation.

The dynamic version fetching from GitHub API could fail due to network issues or API rate limits. Consider adding error handling or falling back to a known stable version.

🔎 Proposed enhancement
     # Install glab CLI for GitLab operations
     - |
-      GLAB_VERSION=$(curl -s https://api.github.com/repos/profclems/glab/releases/latest | grep tag_name | cut -d '"' -f 4)
+      GLAB_VERSION=$(curl -s https://api.github.com/repos/profclems/glab/releases/latest | grep tag_name | cut -d '"' -f 4 || echo "v1.36.0")
+      echo "Installing glab version: $GLAB_VERSION"
       curl -sL "https://github.com/profclems/glab/releases/download/${GLAB_VERSION}/glab_${GLAB_VERSION#v}_Linux_x86_64.tar.gz" | tar xz
       mv glab /usr/local/bin/
+      glab version || { echo "glab installation failed"; exit 1; }
📜 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 595a060 and 918ac04.

📒 Files selected for processing (7)
  • .agent/AGENTS.md
  • .agent/scripts/opencode-github-setup-helper.sh
  • .agent/tools/git.md
  • .agent/tools/git/opencode-github.md
  • .agent/tools/git/opencode-gitlab.md
  • configs/mcp-templates/opencode-github-workflow.yml
  • configs/mcp-templates/opencode-gitlab-ci.yml
🧰 Additional context used
📓 Path-based instructions (2)
.agent/scripts/*-helper.sh

📄 CodeRabbit inference engine (AGENTS.md)

.agent/scripts/*-helper.sh: Use consistent function naming patterns in Bash scripts following [service]-helper.sh model where service names are lowercase with hyphens
Document service-specific integration using the pattern: ./.agent/scripts/[service]-helper.sh [command] [account/instance] [target] [options]
Implement standard commands for all services: help, accounts|instances, monitor|audit|status using consistent parameter handling

Files:

  • .agent/scripts/opencode-github-setup-helper.sh
.agent/**/*.md

📄 CodeRabbit inference engine (AGENTS.md)

.agent/**/*.md: Always include AI-CONTEXT-START and AI-CONTEXT-END comment markers in documentation files to separate condensed AI-friendly content from verbose human documentation
Use lowercase filenames with hyphens for all markdown documentation files in .agent/ directory (e.g., hostinger.md, api-integrations.md)

Files:

  • .agent/tools/git/opencode-github.md
  • .agent/tools/git.md
  • .agent/tools/git/opencode-gitlab.md
  • .agent/AGENTS.md
🧠 Learnings (17)
📓 Common learnings
Learnt from: CR
Repo: marcusquinn/aidevops PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-29T04:35:16.725Z
Learning: Applies to .agent/scripts/{github,gitlab,gitea}-cli-helper.sh : Use helper scripts (github-cli-helper.sh, gitlab-cli-helper.sh, gitea-cli-helper.sh) for multi-account Git platform management with consistent CLI integration
📚 Learning: 2025-11-29T04:35:16.725Z
Learnt from: CR
Repo: marcusquinn/aidevops PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-29T04:35:16.725Z
Learning: Applies to .agent/scripts/{github,gitlab,gitea}-cli-helper.sh : Use helper scripts (github-cli-helper.sh, gitlab-cli-helper.sh, gitea-cli-helper.sh) for multi-account Git platform management with consistent CLI integration

Applied to files:

  • .agent/scripts/opencode-github-setup-helper.sh
  • .agent/tools/git.md
  • .agent/tools/git/opencode-gitlab.md
  • .agent/AGENTS.md
📚 Learning: 2025-11-29T04:35:16.725Z
Learnt from: CR
Repo: marcusquinn/aidevops PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-29T04:35:16.725Z
Learning: Applies to .agent/scripts/quality-*.sh : Organize code quality scripts into consistent categories: quality-check.sh for validation, quality-fix.sh for automated remediation, pre-commit-hook.sh for continuous assurance

Applied to files:

  • .agent/scripts/opencode-github-setup-helper.sh
📚 Learning: 2025-11-29T04:35:16.725Z
Learnt from: CR
Repo: marcusquinn/aidevops PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-29T04:35:16.725Z
Learning: Applies to .agent/scripts/*-helper.sh : Document service-specific integration using the pattern: ./.agent/scripts/[service]-helper.sh [command] [account/instance] [target] [options]

Applied to files:

  • .agent/scripts/opencode-github-setup-helper.sh
📚 Learning: 2025-11-29T04:35:16.725Z
Learnt from: CR
Repo: marcusquinn/aidevops PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-29T04:35:16.725Z
Learning: Applies to .agent/scripts/*-helper.sh : Implement standard commands for all services: help, accounts|instances, monitor|audit|status using consistent parameter handling

Applied to files:

  • .agent/scripts/opencode-github-setup-helper.sh
📚 Learning: 2025-11-29T04:35:16.725Z
Learnt from: CR
Repo: marcusquinn/aidevops PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-29T04:35:16.725Z
Learning: Applies to .agent/**/*.md : Always include AI-CONTEXT-START and AI-CONTEXT-END comment markers in documentation files to separate condensed AI-friendly content from verbose human documentation

Applied to files:

  • .agent/tools/git/opencode-github.md
  • .agent/tools/git/opencode-gitlab.md
  • .agent/AGENTS.md
📚 Learning: 2025-11-29T04:34:27.147Z
Learnt from: CR
Repo: marcusquinn/aidevops PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-29T04:34:27.147Z
Learning: All instructions, documentation, and operational guidance should be maintained in AGENTS.md as the single source of truth

Applied to files:

  • .agent/tools/git/opencode-github.md
  • .agent/AGENTS.md
📚 Learning: 2025-11-29T04:35:16.725Z
Learnt from: CR
Repo: marcusquinn/aidevops PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-29T04:35:16.725Z
Learning: Never duplicate instructions across multiple documentation files; maintain single source of truth in ~/git/aidevops/AGENTS.md with minimal templates elsewhere

Applied to files:

  • .agent/tools/git/opencode-github.md
  • .agent/AGENTS.md
📚 Learning: 2025-11-29T04:35:25.058Z
Learnt from: CR
Repo: marcusquinn/aidevops PR: 0
File: templates/home/AGENTS.md:0-0
Timestamp: 2025-11-29T04:35:25.058Z
Learning: Reference ~/git/aidevops/AGENTS.md for all detailed AI assistant instructions and working directory specifications

Applied to files:

  • .agent/tools/git/opencode-github.md
📚 Learning: 2025-11-29T04:34:24.044Z
Learnt from: CR
Repo: marcusquinn/aidevops PR: 0
File: .cursorrules:0-0
Timestamp: 2025-11-29T04:34:24.044Z
Learning: This appears to be a reference to an AGENTS.md file

Applied to files:

  • .agent/AGENTS.md
📚 Learning: 2025-11-29T04:34:30.730Z
Learnt from: CR
Repo: marcusquinn/aidevops PR: 0
File: GEMINI.md:0-0
Timestamp: 2025-11-29T04:34:30.730Z
Learning: Maintain all instructions, documentation, and operational guidance in AGENTS.md as the single source of truth

Applied to files:

  • .agent/AGENTS.md
📚 Learning: 2025-11-29T04:34:42.024Z
Learnt from: CR
Repo: marcusquinn/aidevops PR: 0
File: AGENT.md:0-0
Timestamp: 2025-11-29T04:34:42.024Z
Learning: Reference AGENTS.md (authoritative) instead of AGENT.md for AI assistant guidance

Applied to files:

  • .agent/AGENTS.md
📚 Learning: 2025-11-29T04:34:37.574Z
Learnt from: CR
Repo: marcusquinn/aidevops PR: 0
File: .windsurfrules:0-0
Timestamp: 2025-11-29T04:34:37.574Z
Learning: Applies to **/*agent*.md : Document agent capabilities, limitations, and decision-making processes

Applied to files:

  • .agent/AGENTS.md
📚 Learning: 2025-11-29T04:35:16.725Z
Learnt from: CR
Repo: marcusquinn/aidevops PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-29T04:35:16.725Z
Learning: Applies to .agent/**/*.md : Use lowercase filenames with hyphens for all markdown documentation files in .agent/ directory (e.g., hostinger.md, api-integrations.md)

Applied to files:

  • .agent/AGENTS.md
📚 Learning: 2025-11-29T04:34:30.730Z
Learnt from: CR
Repo: marcusquinn/aidevops PR: 0
File: GEMINI.md:0-0
Timestamp: 2025-11-29T04:34:30.730Z
Learning: Reference AGENTS.md for authoritative AI assistant guidance instead of GEMINI.md

Applied to files:

  • .agent/AGENTS.md
📚 Learning: 2025-11-29T04:35:16.725Z
Learnt from: CR
Repo: marcusquinn/aidevops PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-29T04:35:16.725Z
Learning: Always reference ~/git/aidevops/AGENTS.md as the authoritative source for AI assistant instructions; never duplicate instructions in other AGENTS.md files

Applied to files:

  • .agent/AGENTS.md
📚 Learning: 2025-11-29T04:35:16.725Z
Learnt from: CR
Repo: marcusquinn/aidevops PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-29T04:35:16.725Z
Learning: Run quality checks before every commit: SonarCloud status verification, CodeFactor validation, ShellCheck compliance on modified files

Applied to files:

  • .agent/AGENTS.md
🧬 Code graph analysis (1)
.agent/scripts/opencode-github-setup-helper.sh (5)
.agent/scripts/github-release-helper.sh (1)
  • main (180-235)
setup.sh (1)
  • setup_git_clis (58-133)
.agent/scripts/quality-feedback-helper.sh (3)
  • cmd_codacy (169-213)
  • main (379-444)
  • cmd_status (56-91)
.agent/scripts/quality-check.sh (1)
  • main (251-289)
.agent/scripts/pre-commit-hook.sh (1)
  • main (145-212)
🪛 LanguageTool
.agent/tools/git/opencode-github.md

[uncategorized] ~21-~21: The official name of this software platform is spelled with a capital “H”.
Context: ...T --> ## Quick Reference - Setup: opencode github install (automated) - Trigger: `/o...

(GITHUB)


[uncategorized] ~76-~76: The official name of this software platform is spelled with a capital “H”.
Context: .... #### 2. Create Workflow File Create .github/workflows/opencode.yml: ```yaml name:...

(GITHUB)

.agent/tools/git/opencode-gitlab.md

[style] ~228-~228: Consider an alternative adverb to strengthen your wording.
Context: ...orrectly 2. Verify auth.json is created properly 3. Check pipeline logs for specific err...

(PROPERLY_THOROUGHLY)


[uncategorized] ~246-~246: The official name of this software platform is spelled with a capital “H”.
Context: ... (Files tab) | Limited | | Auto-setup | opencode github install | Manual | ## Related - **Gi...

(GITHUB)

⏰ 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 (12)
.agent/AGENTS.md (2)

117-131: LGTM! OpenCode integration section is well-structured.

The documentation clearly explains the integration workflow with practical examples and proper cross-references to detailed documentation files.


198-198: LGTM! Table entry is consistent.

The tools/git table entry correctly references the new OpenCode integration documentation files.

.agent/tools/git/opencode-gitlab.md (1)

1-252: Excellent documentation structure and completeness.

The documentation provides comprehensive coverage of OpenCode GitLab integration including setup, usage, configuration, security, and troubleshooting. The AI-CONTEXT section follows coding guidelines and provides a clear quick reference.

configs/mcp-templates/opencode-github-workflow.yml (2)

1-68: Well-structured GitHub Actions workflow template.

The workflow correctly triggers on issue and PR comments, has appropriate permissions, and includes clear documentation for users.


44-44: Pin the OpenCode action to a commit SHA to comply with security requirements.

The workflow currently uses sst/opencode/github@latest, which violates GitHub Actions security compliance. All third-party actions must be pinned to a full-length commit SHA (never mutable tags like @latest or version tags).

To fix this, replace @latest with the commit SHA of the OpenCode release you intend to use, along with the human-readable tag as a comment for auditability. For example:

uses: sst/opencode/github@<full-commit-sha> # v<version>

Verify the SHA from the OpenCode GitHub Action repository and pin accordingly.

⛔ Skipped due to learnings
Learnt from: CR
Repo: marcusquinn/aidevops PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-29T04:35:16.743Z
Learning: Applies to .github/workflows/*.yml : All GitHub Actions workflows must pin to commit SHA, never use mutable tags, to maintain security compliance
configs/mcp-templates/opencode-gitlab-ci.yml (1)

1-114: Well-designed GitLab CI template with comprehensive setup.

The template provides both full and minimal configurations, includes necessary dependencies, and handles authentication properly. The caching strategy for npm packages is a nice optimization.

.agent/scripts/opencode-github-setup-helper.sh (3)

1-50: Excellent script structure and compliance with coding guidelines.

The script follows the *-helper.sh naming pattern, uses consistent color constants, and implements clear utility functions for user feedback. The use of set -euo pipefail and explicit return values demonstrates good Bash practices.

Based on learnings: Consistent with helper script patterns for Git platform management.


174-443: Well-implemented command structure following coding guidelines.

The script implements standard commands (check, setup, help) as required by coding guidelines for *-helper.sh scripts. The command routing is clear, and platform-specific logic is properly separated.

Based on learnings: Implements standard commands for services (help, status/check) with consistent parameter handling.


346-377: Workflow template generation is well-implemented.

The embedded template is consistent with the separate template file and includes all required permissions and triggers. The heredoc approach maintains good readability.

.agent/tools/git.md (1)

38-40: LGTM! OpenCode integration is well-integrated into git tools documentation.

The additions provide clear overview information and proper cross-references to the detailed OpenCode documentation files. The structure is consistent with the existing documentation style.

Also applies to: 169-197, 206-207

.agent/tools/git/opencode-github.md (2)

1-295: Excellent comprehensive documentation for OpenCode GitHub integration.

The documentation is thorough, well-organized, and covers all necessary topics including installation (automated and manual), usage examples, configuration options, permissions, troubleshooting, and security. The AI-CONTEXT section follows coding guidelines and provides an effective quick reference.

Note: The LanguageTool suggestions about "github" capitalization are false positives—these are actual command names that must be lowercase.


264-288: Strong security guidance and aidevops integration examples.

The security section appropriately emphasizes that code runs on user-controlled runners, and the aidevops integration examples show how to customize OpenCode behavior to match project conventions.

@marcusquinn marcusquinn merged commit ffd388b into main Dec 22, 2025
8 of 9 checks passed
@marcusquinn marcusquinn deleted the feature/opencode-github-gitlab-integration branch December 22, 2025 01:24
marcusquinn added a commit that referenced this pull request Dec 22, 2025
- Add yaml-language-server schema reference
- Move path_instructions under reviews (was at root level)
- Change path_filters from object to array of strings with ! prefix
- Move review_instructions to tone_instructions (correct field name)
- Add TypeScript path instructions

Addresses feedback from PR #1, #3, #5 about unrecognized properties
marcusquinn added a commit that referenced this pull request Dec 22, 2025
- Add file header with description, usage, commands, examples
- Add docstrings to all functions explaining purpose, arguments, returns
- Improves docstring coverage from 33% toward 80% threshold

Addresses CodeRabbit feedback from PR #5
marcusquinn added a commit that referenced this pull request Mar 9, 2026
- Consolidate 4 separate jq calls for user profile into single pass with
  tab-delimited output, remove stderr suppression (Gemini #6)
- Consolidate own repos loop into single jq pass, eliminating per-row
  jq invocations (Gemini #2)
- Replace sequential N+1 gh api calls for fork parent URLs with parallel
  xargs -P 6 batch fetch (Gemini #1)
- Add _sanitize_md() and _sanitize_url() helpers to sanitize user-controlled
  fields (display_name, bio, blog, twitter) before embedding in markdown,
  preventing markdown injection and javascript: URI attacks (Gemini #4, #5)

Ref: PR #3962 review comments from gemini-code-assist
marcusquinn added a commit that referenced this pull request Mar 9, 2026
…#3963)

* fix: address Gemini code review feedback on profile README generation

- Consolidate 4 separate jq calls for user profile into single pass with
  tab-delimited output, remove stderr suppression (Gemini #6)
- Consolidate own repos loop into single jq pass, eliminating per-row
  jq invocations (Gemini #2)
- Replace sequential N+1 gh api calls for fork parent URLs with parallel
  xargs -P 6 batch fetch (Gemini #1)
- Add _sanitize_md() and _sanitize_url() helpers to sanitize user-controlled
  fields (display_name, bio, blog, twitter) before embedding in markdown,
  preventing markdown injection and javascript: URI attacks (Gemini #4, #5)

Ref: PR #3962 review comments from gemini-code-assist

* fix: address second round of Gemini review feedback

- Remove 2>/dev/null from xargs fork fetch (|| true suffices)
- Tighten _sanitize_url to reject markdown-breaking chars in URLs
  using glob patterns (bash regex [^...] with escaped parens is
  unreliable across bash versions)
- Strip tabs/newlines from jq user profile output to prevent
  tab-delimiter injection in bio/description fields
- Sanitize repo names and descriptions in both own repos (jq gsub)
  and fork repos (_sanitize_md) before markdown embedding
- Keep printf '%s\n' for own_repos (bash $() strips trailing
  newlines, so the explicit \n is needed for section spacing)

Ref: PR #3963 review comments from gemini-code-assist
marcusquinn added a commit that referenced this pull request Mar 21, 2026
- Fix data corruption in cmd_archive/cmd_remove: collect all section
  headers into an immutable snapshot before any deletions, then delete
  in reverse order so earlier line offsets remain valid (fixes #1)
- Fix sed error suppression: remove '|| true', capture exit status,
  only increment archived/removed counters on success (fixes #2)
- Fix check_todo_completed: remove '|| echo 0' fallback that caused
  duplicate zero output; grep -c already returns 0 on no match (fixes #3)
- Fix agent-deploy.sh: remove 2>/dev/null suppression on plans_cleanup
  invocation, log failures via print_warn instead of silencing (fixes #4)
- Fix agent-deploy.sh: pass explicit PLANS_FILE/ARCHIVE_FILE/TODO_FILE
  env vars so plans_cleanup targets the repo dir, not cwd; use deployed
  copy of script from target_dir (fixes #5)
- Fix setup.sh: gate standalone archive confirm_step to only run when
  deploy_aidevops_agents was skipped; deploy already runs cleanup
  internally, so running it again would be a double-run (fixes #6)
- Fix PLANS.md: change 'MERGED' to 'CLOSED' for issue references in
  Issues summary line (fixes #7)
alex-solovyev pushed a commit that referenced this pull request Mar 21, 2026
…5355)

* chore: archive completed plans from PLANS.md and add cleanup helper

All 16 plans in PLANS.md had Status: Planning but all their tasks
were completed and issues closed upstream. Updated status to Completed.

Added plans-cleanup-helper.sh to automate detection and archiving
of completed plans. Wired into setup.sh and agent-deploy.sh so
new installs get a clean PLANS.md with only active work.

Commands:
- check: show completion status of all plans
- archive: move completed plans to PLANS-ARCHIVE.md
- remove: delete completed plans entirely
- status: JSON summary

Fixes stale 'Planning' status for:
- Restore OpenAI Codex (t1483, GH#4656)
- Agent Runtime Sync (t1453, GH#4205)
- gh Mutation Fix (t1434, GH#4122)
- Grith Security (t1428, GH#4025)
- Convos Agent (t1414, GH#3126)
- URL Skill Updates (t1415, GH#3131)
- Recursive Decomposition (t1408, GH#2983)
- LLM Evaluation Suite (t1393-1396)
- Runaway Memory Fix (t1398, GH#2854)
- Prompt Injection Scanner (t1375)
- Vector Search Agent (t1370)
- UI/UX Inspiration (t1371-1374)
- PaddleOCR (t1369)
- Multi-Model Orchestration (t1364)
- Mission System (t1357)
- Conversational Memory (t1363)

* fix: address CodeRabbit review findings on plans-cleanup PR #5355

- Fix data corruption in cmd_archive/cmd_remove: collect all section
  headers into an immutable snapshot before any deletions, then delete
  in reverse order so earlier line offsets remain valid (fixes #1)
- Fix sed error suppression: remove '|| true', capture exit status,
  only increment archived/removed counters on success (fixes #2)
- Fix check_todo_completed: remove '|| echo 0' fallback that caused
  duplicate zero output; grep -c already returns 0 on no match (fixes #3)
- Fix agent-deploy.sh: remove 2>/dev/null suppression on plans_cleanup
  invocation, log failures via print_warn instead of silencing (fixes #4)
- Fix agent-deploy.sh: pass explicit PLANS_FILE/ARCHIVE_FILE/TODO_FILE
  env vars so plans_cleanup targets the repo dir, not cwd; use deployed
  copy of script from target_dir (fixes #5)
- Fix setup.sh: gate standalone archive confirm_step to only run when
  deploy_aidevops_agents was skipped; deploy already runs cleanup
  internally, so running it again would be a double-run (fixes #6)
- Fix PLANS.md: change 'MERGED' to 'CLOSED' for issue references in
  Issues summary line (fixes #7)

---------

Co-authored-by: Rob M <robi@MacBookPro.attlocal.net>
Co-authored-by: marcusquinn <6428977+marcusquinn@users.noreply.github.com>
alex-solovyev added a commit that referenced this pull request Mar 23, 2026
Address CodeRabbit review comment #5 on PR #5529: cross-process race
condition between oauth-pool.mjs and oauth-pool-helper.sh.

- savePool() now uses temp-file + renameSync for atomic writes,
  matching the pattern in the shell script's save_pool()
- Add withPoolLock() wrapper that opens the same .lock file used by
  the shell script's fcntl.flock(), enabling future coordination
  when Node.js gains native flock support
- Wrap all 6 read-modify-write operations (upsertAccount,
  savePendingToken, assignPendingToken, removeAccount, patchAccount,
  reset-cooldowns) with withPoolLock()
- Primary defense is atomic writes (prevents corruption); advisory
  locking is best-effort coordination (prevents lost updates)
marcusquinn added a commit that referenced this pull request Mar 23, 2026
…concile MCP parity (#5529)

* feat: add rotate and status commands to oauth-pool-helper.sh

Add rotate command that switches the active account in OpenCode's
auth.json by reading the pool file, identifying the current account,
and writing the next available account's tokens. Also adds status
command for pool rotation statistics.

Reconcile MCP model-accounts-pool tool description with the shell
helper by updating the oauth-pool.mjs header comment to document
both interfaces and their supported commands.

Closes #5528

* feat: add assign-pending command and reconcile MCP/shell parity (GH#5528)

Closes #5528

- assign-pending <provider> [email]: assigns a pending unidentified token
  (saved when email could not be resolved during OAuth) to a named account.
  Without email arg, shows pending token info and available accounts.
- Updated header comment and help text to include assign-pending
- Updated main() dispatch to route assign-pending to cmd_assign_pending
- Reconciled MCP model-accounts-pool tool description to note shell helper
  parity: both now support rotate, status, assign-pending, check, list,
  remove, add (GH#5528)

* fix: resolve colon delimiter bug and add advisory locking in rotate command

- Change Python output from colon-delimited to newline-delimited format
  to prevent parsing breakage when email addresses contain colons
- Replace cut -d: parsing with sed -n line extraction in bash
- Add fcntl.flock advisory lock around the read-modify-write cycle for
  both oauth-pool.json and auth.json to prevent concurrent write races

* fix: anchor grep error patterns to end-of-line in assign-pending (GH#5528)

* fix: use count_provider_accounts helper in cmd_add_cursor for consistency (GH#5529)

* fix: address CodeRabbit review feedback on oauth-pool-helper (GH#5529)

- Use os.replace() instead of os.rename() for atomic file writes in
  cmd_rotate (auth.json and pool file) for cross-platform robustness
- Extract get_now_ms() helper to deduplicate Python one-liner across
  4 call sites (cmd_add, cmd_add_cursor, cmd_check, cmd_status)
- Fix 'available' count in cmd_status to only include active/idle
  accounts not on cooldown, matching cmd_rotate's candidate selection

* fix: use atomic temp+os.replace writes in cmd_rotate Python block (GH#5528)

* fix: use atomic temp+renameSync in savePool() in oauth-pool.mjs (GH#5528)

Replace direct writeFileSync to POOL_FILE with a write-to-temp + renameSync
pattern so a mid-write crash cannot corrupt the pool file. Matches the
atomic write pattern already used by save_pool() in oauth-pool-helper.sh.

* fix: atomic writes and lock coordination in oauth-pool.mjs (GH#5528)

Address CodeRabbit review comment #5 on PR #5529: cross-process race
condition between oauth-pool.mjs and oauth-pool-helper.sh.

- savePool() now uses temp-file + renameSync for atomic writes,
  matching the pattern in the shell script's save_pool()
- Add withPoolLock() wrapper that opens the same .lock file used by
  the shell script's fcntl.flock(), enabling future coordination
  when Node.js gains native flock support
- Wrap all 6 read-modify-write operations (upsertAccount,
  savePendingToken, assignPendingToken, removeAccount, patchAccount,
  reset-cooldowns) with withPoolLock()
- Primary defense is atomic writes (prevents corruption); advisory
  locking is best-effort coordination (prevents lost updates)

---------

Co-authored-by: marcusquinn <6428977+marcusquinn@users.noreply.github.com>
marcusquinn added a commit that referenced this pull request Mar 28, 2026
- Correct Electron SharedArrayBuffer requirement from 28+ to 11.0+
- Mark Tauri (webview) as unconfirmed/not in upstream PGlite docs
- Mark Browser extension (MV3) as unconfirmed in official docs
- Add gotcha #5 noting Tauri and MV3 support is unverified upstream
marcusquinn added a commit that referenced this pull request Mar 28, 2026
* docs: tighten pglite-local-first.md from 233 to 203 lines

Consolidate redundant content while preserving all institutional knowledge:
- Merge 5 schema-related comparison rows into 2 (same information, less repetition)
- Merge 4 performance rows into 1 with inline benchmarks
- Replace server.ts code block with prose (not PGlite-specific)
- Replace renderer IPC code block with prose (derivable boilerplate)
- Trim extension code block imports (duplicated from earlier blocks)
- Remove Runtime column from platform table (derivable from Platform)
- Compress pgvector example (remove redundant PGlite import)
- Add Persistence Modes table (consolidates patterns scattered across code blocks)
- Merge Platform Compatibility and Gotchas sections

All URLs, package names, gotchas, security notes, and cross-references preserved.
Verified: zero markdownlint errors.

Closes #11888

* fix: use promise-based single-flight init in extension getDb() example

Addresses CodeRabbit review: concurrent calls to getDb() could race
and create multiple PGlite clients before the first one finishes
initializing. The promise-based pattern ensures only one initialization
runs regardless of concurrent callers.

* fix: address CodeRabbit review on pglite platform compatibility table

- Correct Electron SharedArrayBuffer requirement from 28+ to 11.0+
- Mark Tauri (webview) as unconfirmed/not in upstream PGlite docs
- Mark Browser extension (MV3) as unconfirmed in official docs
- Add gotcha #5 noting Tauri and MV3 support is unverified upstream

* fix: address CodeRabbit review — persistence note, Electron version, platform confidence

- Extensions snippet: show persisted constructor (idb://), add note about
  in-memory default to prevent data-loss footgun
- Platform table: correct Electron SharedArrayBuffer requirement from 28+
  to 14+ (Chrome 92+ site isolation)
- Mark Tauri and MV3 browser extension rows as community-reported (not in
  upstream PGlite docs)

---------

Co-authored-by: marcusquinn <6428977+marcusquinn@users.noreply.github.com>
marcusquinn added a commit that referenced this pull request Apr 1, 2026
…ns, watchdog, timeout, stdout)

Bug #1: Fix step-start vs step_start event type mismatch in
output_has_activity() and watchdog grep — mismatched event names caused
false negatives in activity detection during slow MCP startup.

Bug #2: Use pkill -P for process tree kill in watchdog — previously
only killed the subshell PID, leaving opencode and tee as orphans
consuming CPU+memory.

Bug #3: Add timeout wrapper to non-sandbox execution path — the
non-sandbox path had no overall timeout, risking indefinite hangs if
the worker produced initial activity but then stalled.

Bug #4 (critical): Add --stream-stdout to sandbox-exec-helper.sh —
the sandbox's store-and-replay pattern captured child stdout to a temp
file, so the activity watchdog (reading tee output) saw nothing and
killed every sandboxed worker at ~93s. Now child stdout flows through
the pipe to tee in real-time when called from headless dispatch.

Bug #5: Redirect subshell stdout/stderr to /dev/null — the
backgrounded subshell inherited parent FDs, blocking Claude Code's
bash tool (which waits for all FDs to close) on /runners dispatches.

Closes #15180
marcusquinn added a commit that referenced this pull request Apr 1, 2026
…ns, watchdog, timeout, stdout) (#15188)

Bug #1: Fix step-start vs step_start event type mismatch in
output_has_activity() and watchdog grep — mismatched event names caused
false negatives in activity detection during slow MCP startup.

Bug #2: Use pkill -P for process tree kill in watchdog — previously
only killed the subshell PID, leaving opencode and tee as orphans
consuming CPU+memory.

Bug #3: Add timeout wrapper to non-sandbox execution path — the
non-sandbox path had no overall timeout, risking indefinite hangs if
the worker produced initial activity but then stalled.

Bug #4 (critical): Add --stream-stdout to sandbox-exec-helper.sh —
the sandbox's store-and-replay pattern captured child stdout to a temp
file, so the activity watchdog (reading tee output) saw nothing and
killed every sandboxed worker at ~93s. Now child stdout flows through
the pipe to tee in real-time when called from headless dispatch.

Bug #5: Redirect subshell stdout/stderr to /dev/null — the
backgrounded subshell inherited parent FDs, blocking Claude Code's
bash tool (which waits for all FDs to close) on /runners dispatches.

Closes #15180
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