Skip to content

fix(opencode): resolve command agent ids to registered opencode agents - #2491

Merged
haelyra merged 2 commits into
affaan-m:mainfrom
gaurav0107:fix/2477-opencode-command-agent-scope
Jul 24, 2026
Merged

haelyra merged 2 commits into
affaan-m:mainfrom
gaurav0107:fix/2477-opencode-command-agent-scope

Conversation

@gaurav0107

Copy link
Copy Markdown
Contributor

What Changed

  • Removed the Claude Code plugin namespace (everything-claude-code:) from the
    agent: frontmatter of all 30 .opencode/commands/*.md files, so each
    command references an agent id that opencode actually registers
    (e.g. agent: everything-claude-code:code-reviewer → agent: code-reviewer).
  • Updated the OpenCode command example in .opencode/MIGRATION.md to the same
    unscoped form so the docs stop teaching the failing convention.
  • Rewrote the tests/opencode-config.test.js frontmatter test: it previously
    required the scoped prefix (codifying the bug); it now asserts every
    command's agent id is a key in opencode.json's agent map.

Why This Change

/code-review on opencode failed with
Agent not found: "everything-claude-code:code-reviewer" (issue #2477), while
the reporter's runtime "Available agents" list showed the agents unscoped
(code-reviewer, planner, ...).

Root cause: ECC's opencode integration defines its agents inline in
.opencode/opencode.json's agent map, where they are registered unscoped, and
that file's own command section already references them unscoped
("agent": "code-reviewer"). The command markdown, however, used the Claude
Code plugin namespace. That everything-claude-code: scope resolves under no
opencode configuration — the opencode plugin package is ecc-universal (a plugin
scope would be ecc-universal:), and inline-config agents are bare. subtask: true
commands spawn the named agent in an isolated subtask and hard-fail when it
can't be resolved; non-subtask commands fall back to the default agent and keep
working — which is exactly why "other commands work fine tho." The inconsistency
has existed since the .opencode/ integration was first added, and the test
enforced the wrong invariant so CI never caught it.

This change is confined to .opencode/ (the opencode surface). The top-level
commands/ and docs/<lang>/commands/ — the Claude Code surface where the
everything-claude-code: namespace is correct — are untouched.

Testing Done

  • node tests/run-all.js (clean env): 3105/3105 passed, 0 failed.
  • tests/opencode-config.test.js: the rewritten test fails against the old
    scoped frontmatter (command agent must be an unscoped opencode agent id, got: everything-claude-code:build-error-resolver) and passes after the fix —
    a fails-before / passes-after regression guard for [BUG][OPENCODE] The /code-review command on opencode does not work as expected, other commands works fine tho. #2477.
  • node scripts/ci/validate-commands.js (94 command files) — pass.
  • tests/ci/command-registry.test.js — pass (registry scans top-level
    commands//agents/, unaffected).
  • tests/docs/install-identifiers.test.js — pass.
  • Verified all 13 distinct referenced agent ids are registered in
    opencode.json's agent map (0 unregistered).

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature
  • Breaking change
  • Documentation

Security & Quality Checklist

  • Change limited to opencode command frontmatter + one doc example + one test
  • No behavioral change to the Claude Code command surface (top-level commands/)
  • No new dependencies; no generated files hand-edited
  • Regression test added (fails before, passes after)
  • Full suite green in a clean environment

Documentation

  • Updated the OpenCode command example in .opencode/MIGRATION.md to the
    unscoped agent form. No other docs required changes.

Fixes #2477

affaan-m#2477)

The `.opencode/commands/*.md` frontmatter referenced agents with the Claude
Code plugin namespace (`agent: everything-claude-code:<name>`), but ECC's
opencode integration registers its agents unscoped in `opencode.json`'s
`agent` map (`code-reviewer`, `planner`, ...), and that file's own `command`
section already references them unscoped. The `everything-claude-code:` scope
resolves under no opencode config (the opencode plugin package is
`ecc-universal`, and inline-config agents are bare), so subtask commands like
`/code-review` hard-fail with `Agent not found: everything-claude-code:code-reviewer`.
Non-subtask commands fall back to the default agent and appear to work — which
is why only some commands failed.

Strip the `everything-claude-code:` prefix from all 30 command frontmatter
agent ids so they match the registered agents, fix the MIGRATION.md example,
and replace the test that enforced the broken scoped invariant with one that
asserts each command agent id is a registered opencode agent (fails on the old
scoped ids, passes on the fix).

Fixes affaan-m#2477
@ecc-tools

ecc-tools Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

ECC bundle files are already tracked in this repository. Skipping generation of another bundle PR.

@coderabbitai

coderabbitai Bot commented Jul 10, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 9d0f6cd5-4393-4b61-ad14-7f166ae4e4bd

📥 Commits

Reviewing files that changed from the base of the PR and between 9d1ecb0 and fafc832.

📒 Files selected for processing (1)
  • tests/opencode-config.test.js
📜 Recent review details
⏰ Context from checks skipped due to timeout. (29)
  • GitHub Check: Test (windows-latest, Node 22.x, yarn)
  • GitHub Check: Test (windows-latest, Node 22.x, npm)
  • GitHub Check: Test (windows-latest, Node 20.x, pnpm)
  • GitHub Check: Test (macos-latest, Node 18.x, yarn)
  • GitHub Check: Test (macos-latest, Node 22.x, npm)
  • GitHub Check: Test (windows-latest, Node 22.x, pnpm)
  • GitHub Check: Test (windows-latest, Node 18.x, pnpm)
  • GitHub Check: Test (macos-latest, Node 18.x, npm)
  • GitHub Check: Test (macos-latest, Node 18.x, pnpm)
  • GitHub Check: Test (macos-latest, Node 20.x, yarn)
  • GitHub Check: Test (ubuntu-latest, Node 22.x, npm)
  • GitHub Check: Test (windows-latest, Node 18.x, yarn)
  • GitHub Check: Test (ubuntu-latest, Node 18.x, pnpm)
  • GitHub Check: Test (windows-latest, Node 20.x, npm)
  • GitHub Check: Test (windows-latest, Node 18.x, npm)
  • GitHub Check: Test (windows-latest, Node 20.x, yarn)
  • GitHub Check: Test (ubuntu-latest, Node 18.x, npm)
  • GitHub Check: Test (ubuntu-latest, Node 20.x, yarn)
  • GitHub Check: Test (ubuntu-latest, Node 22.x, bun)
  • GitHub Check: Test (ubuntu-latest, Node 20.x, pnpm)
  • GitHub Check: Test (ubuntu-latest, Node 18.x, yarn)
  • GitHub Check: Test (ubuntu-latest, Node 20.x, npm)
  • GitHub Check: Test (ubuntu-latest, Node 22.x, pnpm)
  • GitHub Check: Test (ubuntu-latest, Node 18.x, bun)
  • GitHub Check: Test (ubuntu-latest, Node 22.x, yarn)
  • GitHub Check: Test (ubuntu-latest, Node 20.x, bun)
  • GitHub Check: Coverage
  • GitHub Check: Greptile Review
  • GitHub Check: CodeRabbit / Review
🧰 Additional context used
📓 Path-based instructions (13)
**/*.{js,ts,jsx,tsx,py,java,cs,go,rb,php,scala,kt}

📄 CodeRabbit inference engine (.cursor/rules/common-coding-style.md)

**/*.{js,ts,jsx,tsx,py,java,cs,go,rb,php,scala,kt}: Always create new objects, never mutate existing ones. Use immutable patterns to prevent hidden side effects and enable safe concurrency
Organize code into many small files (200-400 lines typical, 800 lines max) organized by feature/domain rather than by type
Always handle errors explicitly at every level and never silently swallow errors
Always validate all user input before processing at system boundaries
Use schema-based validation where available
Fail fast with clear error messages when validation fails
Never trust external data (API responses, user input, file content)
Ensure code is readable and well-named
Keep functions small (less than 50 lines)
Keep files focused (less than 800 lines)
Avoid deep nesting (more than 4 levels)
Do not use hardcoded values; use constants or configuration instead

Files:

  • tests/opencode-config.test.js
**/*.{js,ts,jsx,tsx,py,java,cs,rb,go,php,swift,kt,rs,c,cpp,h,hpp}

📄 CodeRabbit inference engine (.cursor/rules/common-security.md)

No hardcoded secrets (API keys, passwords, tokens) - validate before any commit

Files:

  • tests/opencode-config.test.js
**/*.{js,ts,jsx,tsx,py,java,cs,rb,go,php}

📄 CodeRabbit inference engine (.cursor/rules/common-security.md)

**/*.{js,ts,jsx,tsx,py,java,cs,rb,go,php}: All user inputs must be validated
Enable CSRF protection on all state-changing endpoints
Verify authentication and authorization for all protected endpoints
Implement rate limiting on all endpoints to prevent abuse
Ensure error messages do not leak sensitive data in responses

Files:

  • tests/opencode-config.test.js
**/*.{js,ts,jsx,tsx,py,java,cs,rb,go,php,sql}

📄 CodeRabbit inference engine (.cursor/rules/common-security.md)

Use parameterized queries to prevent SQL injection

Files:

  • tests/opencode-config.test.js
**/*.{js,ts,jsx,tsx,html,php,java,cs,rb,go}

📄 CodeRabbit inference engine (.cursor/rules/common-security.md)

Implement XSS prevention by sanitizing HTML output

Files:

  • tests/opencode-config.test.js
**/*.{js,ts,jsx,tsx,py,java,cs,rb,go,php,swift,kt,rs,c,cpp,h,hpp,properties,yml,yaml,json,env,config}

📄 CodeRabbit inference engine (.cursor/rules/common-security.md)

NEVER hardcode secrets in source code - ALWAYS use environment variables or a secret manager

Files:

  • tests/opencode-config.test.js
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (.cursor/rules/typescript-coding-style.md)

**/*.{ts,tsx,js,jsx}: Use spread operator for immutable updates in TypeScript/JavaScript instead of direct mutation
Use async/await with try-catch for error handling in TypeScript/JavaScript
Use Zod for schema-based input validation in TypeScript/JavaScript
No console.log statements in production code; use proper logging libraries instead

**/*.{ts,tsx,js,jsx}: Auto-format JavaScript/TypeScript files using Prettier after edit
Warn about console.log statements in edited files
Check all modified files for console.log statements before session ends

**/*.{ts,tsx,js,jsx}: Use the ApiResponse interface pattern with generic type parameter: interface ApiResponse<T> { success: boolean; data?: T; error?: string; meta?: { total: number; page: number; limit: number; } }
Implement custom React hooks following the pattern: export a named function with use prefix, generic type parameters, and proper useEffect cleanup for side effects

**/*.{ts,tsx,js,jsx}: Never hardcode secrets; always use environment variables for sensitive credentials like API keys
Throw an error when required environment variables are not configured to fail fast and ensure security prerequisites are met

Use Playwright as the E2E testing framework for critical user flows in TypeScript/JavaScript

Files:

  • tests/opencode-config.test.js
**/*.{test,spec}.{js,ts,jsx,tsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

**/*.{test,spec}.{js,ts,jsx,tsx}: Write tests before implementation (test-driven development); target 80%+ coverage
Achieve minimum 80% test coverage across all three layers: Unit, Integration, and E2E
Use AAA structure (Arrange / Act / Assert) in tests with descriptive test names that explain behavior under test

Files:

  • tests/opencode-config.test.js
**/*.{js,ts,jsx,tsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

**/*.{js,ts,jsx,tsx}: Always create new objects and never mutate in place; return new copies instead
Keep files between 200–400 lines typical, with a maximum of 800 lines
Extract helpers when a file exceeds 200 lines
Handle errors explicitly at every level; never swallow errors silently
Validate all user input before processing; use schema-based validation where available
Never trust external data (API responses, file content, query params); always validate
All user inputs must be validated and sanitized
Error messages must be scrubbed of sensitive internals
Use readable, well-named identifiers in all code
Keep functions under 50 lines
Keep files under 800 lines
Avoid nesting deeper than 4 levels
Implement comprehensive error handling in all code
Do not hardcode values; use constants or environment configuration instead
Do not use in-place mutation; always return new objects or state

Files:

  • tests/opencode-config.test.js
**/*.{js,ts,jsx,tsx,json,env*}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Do not hardcode secrets, API keys, passwords, or tokens

Files:

  • tests/opencode-config.test.js
**/*.{js,ts}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

**/*.{js,ts}: Use parameterized queries for all database writes (no string interpolation)
Auth/authz must be checked server-side for every sensitive path
Rate limiting must be applied to all public endpoints

Files:

  • tests/opencode-config.test.js
**/*.{jsx,tsx,js,ts}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

HTML output must be sanitized where applicable

Files:

  • tests/opencode-config.test.js
**/*.{js,ts,env*}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Required environment variables must be validated at startup

Files:

  • tests/opencode-config.test.js
🔇 Additional comments (1)
tests/opencode-config.test.js (1)

99-108: LGTM!


📝 Walkthrough

Summary by CodeRabbit

  • Bug Fixes

    • Updated command routing so planning, building, testing, reviewing, security, and documentation workflows use the correct registered agents.
    • Improved command configuration validation to detect invalid or unavailable agent assignments.
  • Tests

    • Expanded automated checks to verify every command uses an existing, unscoped agent configuration.

Walkthrough

All OpenCode command agent references were changed from plugin-scoped names to registered unscoped IDs. The configuration test now verifies that command agents are unscoped and exist in the registered agent map.

Changes

OpenCode agent identifier migration

Layer / File(s) Summary
Update command agent mappings
.opencode/MIGRATION.md, .opencode/commands/*
Command frontmatter now references unscoped agents such as planner, build, code-reviewer, and tdd-guide.
Validate registered agent references
tests/opencode-config.test.js
Tests collect registered agent IDs and verify command agent values are unscoped and registered.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: affaan-m, daltino

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly states the main fix: resolving OpenCode command agent IDs to registered agents.
Description check ✅ Passed The description matches the changeset and explains the agent-id fix, docs update, and test rewrite.
Linked Issues check ✅ Passed The changes remove the scoped prefix so /code-review resolves the registered code-reviewer agent, matching #2477.
Out of Scope Changes check ✅ Passed The touched files all relate to OpenCode command agent IDs, the example doc, or the matching regression test.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install failed. For unrecoverable errors, disable the tool in CodeRabbit configuration.


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.

@gaurav0107
gaurav0107 marked this pull request as ready for review July 10, 2026 04:19
@gaurav0107
gaurav0107 requested a review from affaan-m as a code owner July 10, 2026 04:19
@gaurav0107

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 10, 2026 •

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

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 `@tests/opencode-config.test.js`:
- Around line 104-110: Update the unscoped agent ID assertion in the
command-agent validation test to reject any colon-containing identifier, rather
than only the legacy “everything-claude-code:” prefix; retain the existing
registeredAgents check and update the failure message if needed to reflect the
general no-colon contract.
🪄 Autofix (Beta)

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: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: b0a6df03-acd4-460c-b0d1-c512a36d296a

📥 Commits

Reviewing files that changed from the base of the PR and between 4092795 and 9d1ecb0.

📒 Files selected for processing (32)
  • .opencode/MIGRATION.md
  • .opencode/commands/build-fix.md
  • .opencode/commands/checkpoint.md
  • .opencode/commands/code-review.md
  • .opencode/commands/e2e.md
  • .opencode/commands/eval.md
  • .opencode/commands/evolve.md
  • .opencode/commands/go-build.md
  • .opencode/commands/go-review.md
  • .opencode/commands/go-test.md
  • .opencode/commands/instinct-export.md
  • .opencode/commands/instinct-import.md
  • .opencode/commands/instinct-status.md
  • .opencode/commands/learn.md
  • .opencode/commands/orchestrate.md
  • .opencode/commands/plan.md
  • .opencode/commands/projects.md
  • .opencode/commands/promote.md
  • .opencode/commands/refactor-clean.md
  • .opencode/commands/rust-build.md
  • .opencode/commands/rust-review.md
  • .opencode/commands/rust-test.md
  • .opencode/commands/security-scan.md
  • .opencode/commands/security.md
  • .opencode/commands/setup-pm.md
  • .opencode/commands/skill-create.md
  • .opencode/commands/tdd.md
  • .opencode/commands/test-coverage.md
  • .opencode/commands/update-codemaps.md
  • .opencode/commands/update-docs.md
  • .opencode/commands/verify.md
  • tests/opencode-config.test.js
📜 Review details
⏰ Context from checks skipped due to timeout. (21)
  • GitHub Check: CodeRabbit / Review
  • GitHub Check: Greptile Review
  • GitHub Check: CodeRabbit / Review
  • GitHub Check: Test (ubuntu-latest, Node 18.x, yarn)
  • GitHub Check: Test (ubuntu-latest, Node 18.x, npm)
  • GitHub Check: Test (ubuntu-latest, Node 18.x, pnpm)
  • GitHub Check: Test (macos-latest, Node 22.x, bun)
  • GitHub Check: Test (windows-latest, Node 22.x, pnpm)
  • GitHub Check: Test (windows-latest, Node 18.x, npm)
  • GitHub Check: Test (windows-latest, Node 20.x, npm)
  • GitHub Check: Test (windows-latest, Node 20.x, pnpm)
  • GitHub Check: Test (macos-latest, Node 18.x, yarn)
  • GitHub Check: Test (windows-latest, Node 22.x, yarn)
  • GitHub Check: Test (windows-latest, Node 18.x, pnpm)
  • GitHub Check: Test (macos-latest, Node 18.x, npm)
  • GitHub Check: Test (windows-latest, Node 22.x, npm)
  • GitHub Check: Test (windows-latest, Node 20.x, yarn)
  • GitHub Check: Test (windows-latest, Node 18.x, yarn)
  • GitHub Check: Test (macos-latest, Node 18.x, bun)
  • GitHub Check: Test (macos-latest, Node 20.x, yarn)
  • GitHub Check: Coverage
🧰 Additional context used
📓 Path-based instructions (13)
**/*.{js,ts,jsx,tsx,py,java,cs,go,rb,php,scala,kt}

📄 CodeRabbit inference engine (.cursor/rules/common-coding-style.md)

**/*.{js,ts,jsx,tsx,py,java,cs,go,rb,php,scala,kt}: Always create new objects, never mutate existing ones. Use immutable patterns to prevent hidden side effects and enable safe concurrency
Organize code into many small files (200-400 lines typical, 800 lines max) organized by feature/domain rather than by type
Always handle errors explicitly at every level and never silently swallow errors
Always validate all user input before processing at system boundaries
Use schema-based validation where available
Fail fast with clear error messages when validation fails
Never trust external data (API responses, user input, file content)
Ensure code is readable and well-named
Keep functions small (less than 50 lines)
Keep files focused (less than 800 lines)
Avoid deep nesting (more than 4 levels)
Do not use hardcoded values; use constants or configuration instead

Files:

  • tests/opencode-config.test.js
**/*.{js,ts,jsx,tsx,py,java,cs,rb,go,php,swift,kt,rs,c,cpp,h,hpp}

📄 CodeRabbit inference engine (.cursor/rules/common-security.md)

No hardcoded secrets (API keys, passwords, tokens) - validate before any commit

Files:

  • tests/opencode-config.test.js
**/*.{js,ts,jsx,tsx,py,java,cs,rb,go,php}

📄 CodeRabbit inference engine (.cursor/rules/common-security.md)

**/*.{js,ts,jsx,tsx,py,java,cs,rb,go,php}: All user inputs must be validated
Enable CSRF protection on all state-changing endpoints
Verify authentication and authorization for all protected endpoints
Implement rate limiting on all endpoints to prevent abuse
Ensure error messages do not leak sensitive data in responses

Files:

  • tests/opencode-config.test.js
**/*.{js,ts,jsx,tsx,py,java,cs,rb,go,php,sql}

📄 CodeRabbit inference engine (.cursor/rules/common-security.md)

Use parameterized queries to prevent SQL injection

Files:

  • tests/opencode-config.test.js
**/*.{js,ts,jsx,tsx,html,php,java,cs,rb,go}

📄 CodeRabbit inference engine (.cursor/rules/common-security.md)

Implement XSS prevention by sanitizing HTML output

Files:

  • tests/opencode-config.test.js
**/*.{js,ts,jsx,tsx,py,java,cs,rb,go,php,swift,kt,rs,c,cpp,h,hpp,properties,yml,yaml,json,env,config}

📄 CodeRabbit inference engine (.cursor/rules/common-security.md)

NEVER hardcode secrets in source code - ALWAYS use environment variables or a secret manager

Files:

  • tests/opencode-config.test.js
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (.cursor/rules/typescript-coding-style.md)

**/*.{ts,tsx,js,jsx}: Use spread operator for immutable updates in TypeScript/JavaScript instead of direct mutation
Use async/await with try-catch for error handling in TypeScript/JavaScript
Use Zod for schema-based input validation in TypeScript/JavaScript
No console.log statements in production code; use proper logging libraries instead

**/*.{ts,tsx,js,jsx}: Auto-format JavaScript/TypeScript files using Prettier after edit
Warn about console.log statements in edited files
Check all modified files for console.log statements before session ends

**/*.{ts,tsx,js,jsx}: Use the ApiResponse interface pattern with generic type parameter: interface ApiResponse<T> { success: boolean; data?: T; error?: string; meta?: { total: number; page: number; limit: number; } }
Implement custom React hooks following the pattern: export a named function with use prefix, generic type parameters, and proper useEffect cleanup for side effects

**/*.{ts,tsx,js,jsx}: Never hardcode secrets; always use environment variables for sensitive credentials like API keys
Throw an error when required environment variables are not configured to fail fast and ensure security prerequisites are met

Use Playwright as the E2E testing framework for critical user flows in TypeScript/JavaScript

Files:

  • tests/opencode-config.test.js
**/*.{test,spec}.{js,ts,jsx,tsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

**/*.{test,spec}.{js,ts,jsx,tsx}: Write tests before implementation (test-driven development); target 80%+ coverage
Achieve minimum 80% test coverage across all three layers: Unit, Integration, and E2E
Use AAA structure (Arrange / Act / Assert) in tests with descriptive test names that explain behavior under test

Files:

  • tests/opencode-config.test.js
**/*.{js,ts,jsx,tsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

**/*.{js,ts,jsx,tsx}: Always create new objects and never mutate in place; return new copies instead
Keep files between 200–400 lines typical, with a maximum of 800 lines
Extract helpers when a file exceeds 200 lines
Handle errors explicitly at every level; never swallow errors silently
Validate all user input before processing; use schema-based validation where available
Never trust external data (API responses, file content, query params); always validate
All user inputs must be validated and sanitized
Error messages must be scrubbed of sensitive internals
Use readable, well-named identifiers in all code
Keep functions under 50 lines
Keep files under 800 lines
Avoid nesting deeper than 4 levels
Implement comprehensive error handling in all code
Do not hardcode values; use constants or environment configuration instead
Do not use in-place mutation; always return new objects or state

Files:

  • tests/opencode-config.test.js
**/*.{js,ts,jsx,tsx,json,env*}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Do not hardcode secrets, API keys, passwords, or tokens

Files:

  • tests/opencode-config.test.js
**/*.{js,ts}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

**/*.{js,ts}: Use parameterized queries for all database writes (no string interpolation)
Auth/authz must be checked server-side for every sensitive path
Rate limiting must be applied to all public endpoints

Files:

  • tests/opencode-config.test.js
**/*.{jsx,tsx,js,ts}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

HTML output must be sanitized where applicable

Files:

  • tests/opencode-config.test.js
**/*.{js,ts,env*}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Required environment variables must be validated at startup

Files:

  • tests/opencode-config.test.js
🪛 ast-grep (0.44.1)
tests/opencode-config.test.js

[warning] 89-89: Filesystem path is not a string literal; a request-/variable-derived path can enable path traversal. Validate and normalize the path before use.
Context: fs.readFileSync(path.join(commandsDir, entry), 'utf8')
Note: [CWE-22] Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal').

(detect-non-literal-fs-filename)

🔇 Additional comments (31)
.opencode/MIGRATION.md (1)

187-187: LGTM!

.opencode/commands/build-fix.md (1)

3-3: LGTM!

.opencode/commands/checkpoint.md (1)

3-3: LGTM!

.opencode/commands/code-review.md (1)

3-3: LGTM!

.opencode/commands/security-scan.md (1)

3-3: LGTM!

.opencode/commands/security.md (1)

3-3: LGTM!

.opencode/commands/setup-pm.md (1)

3-3: LGTM!

.opencode/commands/skill-create.md (1)

3-3: LGTM!

.opencode/commands/e2e.md (1)

3-3: LGTM!

.opencode/commands/eval.md (1)

3-3: LGTM!

.opencode/commands/evolve.md (1)

3-3: LGTM!

.opencode/commands/go-build.md (1)

3-3: LGTM!

.opencode/commands/go-review.md (1)

3-3: LGTM!

.opencode/commands/tdd.md (1)

3-3: LGTM!

.opencode/commands/test-coverage.md (1)

3-3: LGTM!

.opencode/commands/update-codemaps.md (1)

3-3: LGTM!

.opencode/commands/go-test.md (1)

3-3: LGTM!

.opencode/commands/instinct-export.md (1)

3-3: LGTM!

.opencode/commands/instinct-import.md (1)

3-3: LGTM!

.opencode/commands/instinct-status.md (1)

3-3: LGTM!

.opencode/commands/learn.md (1)

3-3: LGTM!

.opencode/commands/update-docs.md (1)

3-3: LGTM!

.opencode/commands/verify.md (1)

3-3: LGTM!

.opencode/commands/orchestrate.md (1)

3-3: LGTM!

.opencode/commands/plan.md (1)

3-3: LGTM!

.opencode/commands/projects.md (1)

3-3: LGTM!

.opencode/commands/promote.md (1)

3-3: LGTM!

.opencode/commands/refactor-clean.md (1)

3-3: LGTM!

.opencode/commands/rust-build.md (1)

3-3: LGTM!

.opencode/commands/rust-review.md (1)

3-3: LGTM!

.opencode/commands/rust-test.md (1)

3-3: LGTM!

Comment thread tests/opencode-config.test.js
@greptile-apps

greptile-apps Bot commented Jul 10, 2026 •

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes issue #2477 by removing the incorrect everything-claude-code: plugin-namespace prefix from the agent: frontmatter in all 30 .opencode/commands/*.md files, aligning them with how opencode actually registers agents (unscoped, inline in opencode.json). The regression that caused /code-review to hard-fail with "Agent not found" on subtask: true commands is now properly guarded by a rewritten test.

  • 30 command files updated: agent: everything-claude-code:<name> → agent: <name> in every .opencode/commands/*.md frontmatter field.
  • Test rewritten: opencode-config.test.js now verifies (a) no scoped : separator in agent ids and (b) every referenced agent id exists as a key in opencode.json's agent map — the opposite of the old test, which enforced the bug.
  • MIGRATION.md updated: the inline example is corrected to the unscoped form so documentation no longer teaches the broken convention.

Confidence Score: 5/5

Safe to merge — the change is a straightforward text substitution in frontmatter files, all 30 referenced agent ids are confirmed registered in opencode.json, and the rewritten test will catch any future regression.

All 30 updated agent ids were verified against opencode.json's agent map and every one resolves correctly. The change is confined to .opencode/ and does not touch the Claude Code surface (commands/). The test now enforces the right invariant (unscoped + must exist in registry) rather than the wrong one. No logic errors, no behavioral regressions.

No files require special attention.

Important Files Changed

Filename Overview
tests/opencode-config.test.js Test rewritten to assert correct invariant: agent ids must be unscoped and registered in opencode.json's agent map; non-.md entries now skipped; regression guard added for #2477.
.opencode/commands/code-review.md agent: everything-claude-code:code-reviewer → agent: code-reviewer; fixes the reported hard-fail on /code-review (subtask: true command).
.opencode/commands/plan.md agent: everything-claude-code:planner → agent: planner; planner is confirmed registered in opencode.json.
.opencode/MIGRATION.md Example updated from scoped to unscoped agent form; aligns docs with the corrected command convention.

Sequence Diagram

%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
    participant User
    participant OpenCode
    participant AgentRegistry as opencode.json agent map
    participant SubAgent as SubAgent (e.g. code-reviewer)

    Note over User,SubAgent: Before fix — subtask commands hard-fail
    User->>OpenCode: /code-review
    OpenCode->>AgentRegistry: resolve "everything-claude-code:code-reviewer"
    AgentRegistry-->>OpenCode: ❌ Agent not found
    OpenCode-->>User: "Error #2477"

    Note over User,SubAgent: After fix — agent resolves correctly
    User->>OpenCode: /code-review
    OpenCode->>AgentRegistry: resolve "code-reviewer"
    AgentRegistry-->>OpenCode: ✅ Found (mode: subagent)
    OpenCode->>SubAgent: spawn isolated subtask
    SubAgent-->>User: Code review output
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
    participant User
    participant OpenCode
    participant AgentRegistry as opencode.json agent map
    participant SubAgent as SubAgent (e.g. code-reviewer)

    Note over User,SubAgent: Before fix — subtask commands hard-fail
    User->>OpenCode: /code-review
    OpenCode->>AgentRegistry: resolve "everything-claude-code:code-reviewer"
    AgentRegistry-->>OpenCode: ❌ Agent not found
    OpenCode-->>User: "Error #2477"

    Note over User,SubAgent: After fix — agent resolves correctly
    User->>OpenCode: /code-review
    OpenCode->>AgentRegistry: resolve "code-reviewer"
    AgentRegistry-->>OpenCode: ✅ Found (mode: subagent)
    OpenCode->>SubAgent: spawn isolated subtask
    SubAgent-->>User: Code review output
Loading

Reviews (2): Last reviewed commit: "test(opencode): reject any namespace-sco..." | Re-trigger Greptile

…t the legacy prefix (affaan-m#2477)

Address review: the frontmatter guard only rejected the `everything-claude-code:`
prefix, so a hypothetical future `<other-plugin>:agent` value could slip through.
opencode registers its inline agents unscoped, so assert the id carries no `:` at
all — rejecting the whole scoped class — alongside the existing
registered-agent-map membership check.
@ecc-tools

ecc-tools Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

ECC bundle files are already tracked in this repository. Skipping generation of another bundle PR.

@haelyra

haelyra commented Jul 24, 2026

Copy link
Copy Markdown
Collaborator

Thank you for this! This cleanly aligns OpenCode command frontmatter with the agent IDs actually registered in opencode.json, and the regression test now rejects any namespace-scoped ID. All checks are green, and the combined current-main test run passes in full, so I’m merging it now. We appreciate the thorough follow-up on the review feedback.

@haelyra
haelyra merged commit 8512dc6 into affaan-m:main Jul 24, 2026
41 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.

[BUG][OPENCODE] The /code-review command on opencode does not work as expected, other commands works fine tho.

2 participants