Skip to content

fix(auth): 按实际策略展示授权范围 - #1751

Merged
deepcoldy merged 2 commits into
deepcoldy:masterfrom
47seek:fix/auth-scope-prompts-20261009
Oct 9, 2026
Merged

deepcoldy merged 2 commits into
deepcoldy:masterfrom
47seek:fix/auth-scope-prompts-20261009

Conversation

@47seek

@47seek 47seek commented Oct 9, 2026

Copy link
Copy Markdown
Collaborator

当 Bot 仅为 lark-cli 启用发起人身份注入时,原会话提示仍宣称 bytedcli 和 git 使用发起人的授权;ByteCloud 登录完成回执也会给出同样的承诺。用户因此会将后续身份问题理解为授权未完成。

现在会话提示读取完整 triggerUserAuth 策略,按 tools 展示已启用的工具,并在 bytedcli 与 gitHost 同时配置时展示 git 鉴权范围。/login done 和 /login bytedcli done 共用成功回复,分别说明授权已保存、当前 Bot 是否已启用身份注入,以及配置生效方式。现有 stderr 授权链接引导继续使用。

影响范围覆盖 worker 启动参数、共用 CLI 提示构造、inline 提示与登录完成回执。回归覆盖未配置、关闭、lark-cli、bytedcli 及 gitHost 组合,以及 Claude、Genius、Grok 的参数传递。

验证:

  • node node_modules/vitest/vitest.mjs run --project unit test/credential-boundary-prompt.test.ts test/command-handler.test.ts test/turn-cli-identity.test.ts test/trigger-user-auth.test.ts test/cli-adapters.test.ts test/prompt-builder.test.ts --reporter=dot:1075 passed,1 skipped。
  • bun run build:通过。
  • git diff --check:通过。

相关进程身份修复见 #1746。本 PR 的授权提示尚待运行时发布验收。

- 补 bytedcli-only 配置下飞书专属失败指引缺席的双向断言:区分短语用
  「遇到飞书鉴权失败」/「On a Feishu auth failure」;on_auth_link 对所有
  工具无条件输出且同样出现 botmux auth request,不能用作区分
- acting_identity 升为 placeholder 并声明 {tools},定制覆盖删掉占位符
  时由 validateFragmentOverride 拒绝,避免工具列表被静默丢弃
- 登记 git_identity({host}) 与 on_bytedcli_auth_failure 到
  PROMPT_FRAGMENTS,使两条新文案在定制中心可见且受目录完整性校验
- 三处改动均经变异验证(失败行无条件化 / 两条目降回 editable 均变红)

Co-Authored-By: Claude Code <noreply@anthropic.com>

@deepcoldy deepcoldy left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

审查通过:授权提示与 /login 回执按 triggerUserAuth.tools / gitHost 精确展示,未启用或 tools 为空时整块不注入(fail-closed)。已独立验证构建、相关单测、变异测试及 CI;另补了 bytedcli-only 反向断言与定制目录占位符登记。按维护者确认合并。

@deepcoldy
deepcoldy merged commit 72ed9a6 into deepcoldy:master Oct 9, 2026
10 checks passed
@github-actions

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown

🚀 Released in v3.38.0

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