Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

copilotkit project select rewrites INTELLIGENCE_API_KEY to CPK_INTELLIGENCE_API_KEY, which OpenDots never reads

已关闭 适合新手
#55 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 2 天内回复

@charan-rathore 已经在做这个了。

开始于 2026年10月4日。

  • #72 来自 @charan-rathore —— 未关闭

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
85/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
typescript

调研方向

先从 src/server/index.ts 中的环境键处理开始,然后检查 src/server/platform-config.ts 和 src/server/platform.ts 中的相关检查。使用 .env.example 重现 docs/SETUP.md 中记录的流程,并确认 CLI 写入的键能够被识别、设置警告会消失,以及设置说明解释了受支持的名称和优先级。

由索引模型根据 Issue 内容生成。

描述

Summary

npx copilotkit@latest project select deletes the INTELLIGENCE_API_KEY line from .env and writes CPK_INTELLIGENCE_API_KEY instead. OpenDots reads only the unprefixed name and has no fallback, so the "Connect your Dot" banner stays and chat remains disabled even after a successful CLI login — with no error anywhere pointing at the name mismatch.

Verified against OpenDots c2569bb (2026-10-02) and [email protected].

OpenDots reads only INTELLIGENCE_API_KEY

  • src/server/index.ts:29 — intelligenceKey: process.env.INTELLIGENCE_API_KEY
  • src/server/platform-config.ts:32 — !config.intelligenceKey && 'INTELLIGENCE_API_KEY' in setupStatus() (this is the list the Settings & setup sidebar renders)
  • src/server/platform.ts:154 — { error: 'Setup required: INTELLIGENCE_API_KEY.' }

grep -rn "CPK_" src/ returns nothing, so the prefixed variable is invisible to the app. .env.example also seeds only the unprefixed name (INTELLIGENCE_API_KEY=).

The CLI prunes that line and writes a different name

[email protected], writeHostedApiKey() in the bundled index.js (around line 124155):

const standardizedContent = removeEnvAssignmentLine(
  existingContent,
  "INTELLIGENCE_API_KEY"
);
withFsErrorTag(
  () => fs21.writeFileSync(
    envPath,
    upsertEnvAssignments(standardizedContent, [
      ["CPK_INTELLIGENCE_API_KEY", apiKey]
    ])
  )
);

So the CLI removes the exact line .env.example provides and replaces it with a name OpenDots never reads. CPK_INTELLIGENCE_API_KEY is treated as canonical throughout the CLI (PROJECT_KEY_VARIABLE = "CPK_INTELLIGENCE_API_KEY", line 434080).

Why this is more than a docs gap

docs/SETUP.md:81 instructs users to run this in the Slack setup flow:

npx --yes copilotkit@latest project select
npx --yes copilotkit@latest channels add --name opendots --display-name "OpenDots" --adapter slack --json

Anyone who follows that documented command silently breaks an Intelligence credential that was already working. The failure mode is also misleading: the app reports the key as missing, so the natural conclusion is "the CLI didn't write my key" rather than "it wrote it under a different name and deleted the old line."

Repro

  1. npm ci && cp .env.example .env
  2. npx --yes copilotkit@latest login && npx --yes copilotkit@latest project select
  3. grep INTELLIGENCE .env → shows CPK_INTELLIGENCE_API_KEY=cpk-…; the INTELLIGENCE_API_KEY= line is gone
  4. npm run dev → "Connect your Dot" banner persists and Settings & setup lists INTELLIGENCE_API_KEY as missing
  5. Adding INTELLIGENCE_API_KEY=cpk-… (same value) clears the banner and enables chat

Suggested fix

Accept both names, preferring the one the CLI writes:

intelligenceKey:
  process.env.CPK_INTELLIGENCE_API_KEY ?? process.env.INTELLIGENCE_API_KEY,

and mention the precedence in docs/SETUP.md. A docs-only note would leave the documented Slack flow still self-defeating, so I'd lean toward the fallback in code.

One accuracy note: the CLI help describes COPILOTKIT_API_KEY as the deprecated name (line 442947), not INTELLIGENCE_API_KEY. So this isn't a case of OpenDots using an officially deprecated variable — it's an unprefixed/prefixed mismatch between a template and the CLI that edits that template's .env.

主要语言
TypeScript
星标
5.5k
派生
796
平均合并
2 天 5 小时
30 天内合并 PR
53

环境准备

  • 提供 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

CopilotKit/OpenDots 的其他 Issue

查看 CopilotKit/OpenDots 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。