fix(agent-mention): accept upstream /opencode and /oc trigger aliases - #1537
fix(agent-mention): accept upstream /opencode and /oc trigger aliases#1537seonghobae wants to merge 9 commits into
Conversation
Owner-flagged gap: OpenCode's own GitHub Action documents /opencode and /oc as its trigger phrases, but this repo's agent_mention_router.py only recognized the locally-invented @opencode-agent mention. A commenter following OpenCode's public docs would silently trigger nothing. Widen the existing "opencode-agent" MENTION_PATTERNS regex to accept /opencode and /oc as aliases of the same request (agent_mention_sweep.py picks this up transitively since it imports the same matcher), and add the same substrings to agent-mention-router.yml's cheap pre-filter. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KPmJErfkcHer4UVEgrQxUX
|
Generated by Claude Code |
|
Warning Review limit reachedNext included review available in 37 minutes. View limit detailsLimit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughChangesOpenCode 별칭 라우팅
스케줄러 동작 검증
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: 🔵 Low · up to The new aliases can be detected inside URL query strings, so a trusted commenter posting a link containing '/oc' or '/opencode' could unintentionally invoke the review agent; the PR is otherwise mergeable, but this bounded automation risk should be fixed or explicitly accepted. Suggested reviewers: Sequence Diagram(s)sequenceDiagram
participant PR 댓글
participant agent-mention-router.yml
participant agent_mention_router.py
participant opencode-agent
PR 댓글->>agent-mention-router.yml: `@opencode-agent`, /opencode 또는 /oc 포함
agent-mention-router.yml->>agent_mention_router.py: 라우팅 조건 통과
agent_mention_router.py->>opencode-agent: opencode-agent 요청 전달
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 76.92% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 13 functions across 4 files. (3 skipped: 3 unsupported.) ✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
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 |
…ntion-oc-alias # Conflicts: # CHANGELOG.md
main currently sits at 99% coverage (fail_under = 100), not caused by this branch: pr_review_fix_scheduler.py's inspect_pr() has two unexercised skip paths for a conflicted PR (draft, and not-authorized-for-repair), and pr_review_merge_scheduler.py's fetch_workflow_names_by_check_suite_rest() (added by #1541, never directly tested) has no coverage for a non- permission RuntimeError propagating, a row with a check_suite_id but no workflow name being skipped, or pagination continuing past a full page. Verified the same 99% gap reproduces on origin/main alone before writing these tests. Carried onto this branch so #1537 can pass its own 100% coverage gate without waiting on a separate fix PR to merge first; also opening that fix directly against main.
… match Devin review finding on #1537: the mention regex's negative lookbehind excluded a preceding letter/digit/underscore/hyphen but not a preceding slash, so a documentation link like https://opencode.ai/docs (where "/opencode" immediately follows the scheme's own "//") satisfied the lookbehind and could launch an unintended review. Added "/" to the excluded lookbehind character class, verified against the existing accept/reject cases plus the new URL-substring regression. Also updates docs/automation/review-agent-comment-invocation.md's operator guide (Devin's second finding) to list /opencode and /oc alongside @opencode-agent, matching the now-accepted trigger phrases.
Devin review finding on #1537: the prior fix's slash-exclusion lookbehind applied to the whole @opencode-agent|/opencode|/oc alternation, so a maintainer separating two requested agents with a bare slash and no space (@cwl-noema-review/@opencode-agent) silently lost the OpenCode request -- the same lookbehind that correctly rejects a documentation-link false positive like https://opencode.ai now also rejected the intended @mention. Split the lookbehind per Devin's suggested fix: the slash exclusion applies only to the bare /opencode and /oc forms; @opencode-agent keeps its original lookbehind, unaffected by a preceding slash.
…eparator Devin review finding on #1537 (second round): the previous fix exempted the @opencode-agent form entirely from the slash-preceded exclusion so that @cwl-noema-review/@opencode-agent (a bare-slash separator) would still dispatch OpenCode. That reopened the exact false-positive class the first fix closed, just for the @ form instead of the /opencode //oc forms: a trusted comment sharing a link like https://youtube.com/@opencode-agent, or even an ordinary path segment like docs/@opencode-agent, would satisfy the same shape and launch an unintended review. Replaced the blanket exemption with a narrow third alternative: /@opencode-agent is recognized only when the slash is immediately preceded by the other pattern's exact literal mention text, @cwl-noema-review, not by an arbitrary preceding word. This keeps the deliberate separator case working while URL paths and ordinary text no longer qualify.
CodeRabbit review finding on #1537: the bare /opencode and /oc forms' slash-exclusion lookbehind did not also exclude a preceding "=", so a URL query string such as https://example.com/?next=/opencode or ?next=/oc still matched and could dispatch an unintended review. Added "=" to the excluded lookbehind character class alongside the existing letter/digit/ underscore/hyphen/slash exclusions.
…tor literal The @cwl-noema-review/@opencode-agent bare-slash separator alternative checked only that the slash immediately preceding /@opencode-agent was preceded by the literal text @cwl-noema-review, without checking that occurrence's own left boundary. Invalid pasted text embedding the Noema mention in a larger token (foo@cwl-noema-review/@opencode-agent, docs/@cwl-noema-review/@opencode-agent, an email-like local part) still dispatched an unintended OpenCode review. Reported directly by the repository owner with exact reproduction and a suggested direction; verified the owner's literal suggested regex still failed one of their own listed cases (docs/@cwl-noema-review/@opencode-agent) because it omitted "/" from the excluded lookbehind class. Fixed by matching the whole @cwl-noema-review/@opencode-agent literal under the same left-boundary exclusion already used by the standalone @opencode-agent alternative, verified against the full existing accept/reject matrix plus the three new cases before touching the source file. Full suite: 2246 passed, 1 skipped, 21 subtests passed. 100% coverage and 100% docstrings maintained.
|
@opencode-agent review exact head |
|
Superseded by #1558 after #1546 advanced protected main. Before salvage, the router, workflow, router-test, and invocation-doc base blobs were proven byte-identical between this PR's protected base and current |
Pull request was closed
built and CI-green, genuinely unreachable pending the sandbox Corrected an initial wrong instinct first: naruon's own "noema_agent.py" looked like a DDD naming collision with the CI review agent's Noema, but docs/CWL-MASTER-CONTEXT.md explicitly defines Noema as one shared agent runtime across three consumers (CI review agent, naruon's do-anything agent, wardnet's AI SOC quarantine sandbox) -- owner-confirmed per naruon#1527. Checked the master context before concluding two same-named components were separate, per this session's own established lesson from an earlier mistake of exactly that kind. Found: naruon already has a real, tested, CI-green agent + plugin- registry system (services/noema_agent.py, services/agent_registry.py, four open PRs #1527/#1486/#1516/#1537, none authored by either active peer session) matching the platform plan's own documented registry architecture almost exactly. The confirmed gap: nothing in the API or frontend layer ever calls it -- the agent, registry, and manifests are mutually consistent and fully tested but completely unreachable, and have been since the agent's original commit two months ago. This connects directly to item 6: the master context has this agent running inside quarantine-sandbox-runtime, which a peer session is separately, actively building (still early-stage, confirmed via direct coordination) -- wiring the agent to a real trigger before that sandbox exists would ship an unsandboxed, writeback-capable LLM agent against the documented design, not merely ship an incomplete feature. Not implemented this tick pending that dependency. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…in Review)
commits/{sha}/status only reflects the legacy Status API, not GitHub's
Checks API that every workflow in this org actually posts through.
Re-checked with commits/{sha}/check-runs: metadata-only gate evaluation
fails on all 4 (expected — real code changes, not eligible for that
script's fast path, and already excluded from this org's own failed-check
enumeration). noema-review genuinely failed on #1527/#1537 — pulled the
job log for #1527 and logged a new, concrete review-failure case (a JSON
repair failure) for item 23's aggregation ask. strix was cancelled on
#1486/#1537, consistent with the already-documented repo-wide
concurrency-group starvation, not a new finding.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Root cause
Owner-flagged (on
.github#1506): "@opencode-agent라고 부르면 호출되는 기능도 인터넷 가이드에는/oc라고 나와있기 때문에 이 점도 확인해 보는 게 좋겠습니다" — the internet's own guide for invoking OpenCode uses/oc, not@opencode-agent.Verified against OpenCode's actual public documentation (open-code.ai/en/docs/github): its GitHub Action integration triggers on
/opencodeor/ocin a comment, not an@mention. This repo'sscripts/ci/agent_mention_router.py— the single source of truth for mention detection, imported by both the comment-triggered router andagent_mention_sweep.py's scheduled organization sweep — only recognized@opencode-agent. A commenter following OpenCode's own public docs would type/ocand silently trigger nothing.Fix
Widen the existing
"opencode-agent"entry inMENTION_PATTERNSto accept/opencodeand/ocas aliases of the same request (word-boundary-anchored, case-insensitive, same as the existing@opencode-agentpattern), and add the same substrings toagent-mention-router.yml's cheapcontains()pre-filter so the job isn't skipped before the precise regex ever runs. No new agent identity, no downstream dispatch-logic change —/opencode//ocresolve to the same"opencode-agent"key as before.Verification
tests/test_agent_mention_router.py: 8 new parametrized cases —/opencode//oc(plus case variants/OC,/OpenCode) dispatch correctly; longer tokens that merely start with/oc//opencode(/occupied,/oceanography,/opencode-docs) correctly do not match.coverage run -m pytest tests && coverage report --show-missing: 2135 passed, 1 skipped, 100% coverage onscripts/ci/(agent_mention_router.py: 275/275 statements, 112/112 branches).interrogate: 100% docstrings.python3 -c "import yaml; yaml.safe_load(open('.github/workflows/agent-mention-router.yml'))"→ OK.tests/test_agent_mention_sweep.py,test_agent_mention_workflow_contract.py,test_agent_mention_review_regressions.py,test_agent_mention_idempotency.py— 25 passed, confirming the sweep and workflow contract are unaffected.Developer experience
Anyone following OpenCode's own public documentation can now successfully trigger a re-review, instead of the comment silently doing nothing.
User experience
No user-facing change beyond the new accepted trigger phrases — purely additive.
Generated by Claude Code
Summary by CodeRabbit
새 기능
@opencode-agent뿐 아니라/opencode및/oc명령어로도 동일한 에이전트 요청을 실행할 수 있습니다.문서
테스트