Skip to content

fix(adapter-claude): 支持适配器多实例启用#887

Merged
dingyi222666 merged 1 commit into
ChatLunaLab:v1-devfrom
Procyon-Nan:fix/claude-adapter-reusable
May 28, 2026
Merged

fix(adapter-claude): 支持适配器多实例启用#887
dingyi222666 merged 1 commit into
ChatLunaLab:v1-devfrom
Procyon-Nan:fix/claude-adapter-reusable

Conversation

@Procyon-Nan
Copy link
Copy Markdown
Contributor

在 Claude 适配器入口导出 reusable = true ,该变更使 Koishi 允许同一插件创建多份配置实例,避免第二份 Claude 配置被判定为不可重用而无法正常启用。

影响文件:packages/adapter-claude/src/index.ts

另外也对其他的adapter进行了一轮排查,没有发现类似问题

在 Claude 适配器入口导出 reusable = true。

该变更使 Koishi 允许同一插件创建多份配置实例,避免第二份 Claude 配置被判定为不可重用而无法正常启用。

影响文件:packages/adapter-claude/src/index.ts。

多实例仍需使用不同的 platform 配置,以避免 ChatLuna 平台注册名称冲突。
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 28, 2026

Review Change Stack

Caution

Review failed

Pull request was closed or merged during review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: d168e368-516c-45f4-aa7f-09a0270a0c24

📥 Commits

Reviewing files that changed from the base of the PR and between 4351694 and 12e7be1.

📒 Files selected for processing (1)
  • packages/adapter-claude/src/index.ts

Walkthrough

Claude 适配器模块新增导出常量 reusable = true,用于标识该适配器支持可重用性。其余模块逻辑(apply 初始化、配置及 Schema 定义、依赖注入与插件元信息)保持不变。

Changes

Claude 适配器可重用性标记

层级 / 文件 摘要
导出可重用常量
packages/adapter-claude/src/index.ts
在模块顶层新增导出常量 reusable,赋值为 true,标识 Claude 适配器支持可重用性。

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Suggested reviewers

  • dingyi222666

Poem

🐰 Claude 的旗帜升起来,
reusable 标记闪闪闪,
适配器今日添新衣,
可重用的梦想启航去!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed 标题准确地反映了变更内容,即为Claude适配器添加reusable标记以支持多实例启用。
Description check ✅ Passed 描述清晰地解释了变更目的、受影响的文件、多实例使用注意事项,以及作者的审查工作。
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

Copy link
Copy Markdown
Contributor

@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 enables multi-instance support for the Claude adapter by exporting reusable = true. However, a critical issue was identified: because logger is declared as a module-level global variable, initializing multiple instances will overwrite it, potentially causing unexpected behavior or memory leaks in older instances. It is recommended to avoid using a global logger and instead bind it to individual instances or pass the context directly.

Comment thread packages/adapter-claude/src/index.ts
@dingyi222666 dingyi222666 merged commit 96b7711 into ChatLunaLab:v1-dev May 28, 2026
4 of 5 checks passed
@Procyon-Nan Procyon-Nan deleted the fix/claude-adapter-reusable branch May 28, 2026 06:43
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.

2 participants