Skip to content

[obsolete — wrong base] feat(providers): bring-your-own-key — per-user provider API keys - #2910

Closed
hefanbo wants to merge 10 commits into
TencentCloud:mainfrom
hefanbo:feat/user-provider-keys
Closed

hefanbo wants to merge 10 commits into
TencentCloud:mainfrom
hefanbo:feat/user-provider-keys

Conversation

@hefanbo

@hefanbo hefanbo commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Note

This PR has been recreated as #2932

Summary

Per-user provider API keys (bring-your-own-key), stored in the secrets KV (user_provider_key:{user_id}:{provider_name}, Fernet-sealed, no schema change) and served at /api/me/provider-keys (Settings → Model Keys).

Implicit policy: a provider without a global key demands a personal key (PROVIDER_KEY_REQUIRED); a personal key otherwise overrides the global key for that user's turns (configurable.api_key_override into harness requests). User/provider deletion cleans up stored keys.

Note: depends on the harness per-call api_key_override seam (TencentCloud/octop-harness#242) and on the stream error envelope keeping error_code (#2908). After the harness PR releases, bump the octop-harness pin.

Fixes #2907

Target branch

  • Base is develop (feature / fix — default)
  • Base is main (release/* or hotfix/* only)

Type of change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation
  • Refactor / chore
  • Release / hotfix

Test plan

Verified locally on this branch:

  • make all passes locally (5471 passed / 27 skipped); tsc -b and vitest pass
  • Added/updated tests (tests/unit/agents/test_user_key_resolution.py, tests/unit/db/test_user_provider_keys.py, tests/integration/test_user_provider_keys.py, tests/unit/api/test_provider_patch_rehydrate.py)

Checklist

  • Updated CHANGELOG.md (if user-facing)
  • README / docs updated (if needed) — not needed for this change

概要

每用户供应商 API Key(bring-your-own-key),存于 secrets KV(user_provider_key:{user_id}:{provider_name},Fernet 密封,无 schema 变更),经 /api/me/provider-keys(设置 → 模型密钥)提供服务。

隐式策略:无全局 Key 的供应商必须配置个人 Key(缺失报 PROVIDER_KEY_REQUIRED);否则该用户的调用以个人 Key 覆盖全局 Key(configurable.api_key_override 传入 harness 请求)。删除用户/供应商时级联清理已存 Key。

说明:依赖 harness 的按调用 api_key_override 缝隙(TencentCloud/octop-harness#242)与错误帧保留 error_code(#2908);harness 发版后 bump octop-harness pin。

修复 #2907

目标分支

  • Base 是 develop(feature / fix — 默认)
  • Base 是 main(仅 release/* 或 hotfix/*)

变更类型

  • 修复(Bug fix)
  • 新功能
  • 破坏性变更
  • 文档
  • 重构 / 杂务
  • 发版 / 热修

测试计划

已在本分支本地验证:

  • 本地 make all 通过(5471 passed / 27 skipped);tsc -b 与 vitest 通过
  • 新增/更新了测试(tests/unit/agents/test_user_key_resolution.py、tests/unit/db/test_user_provider_keys.py、tests/integration/test_user_provider_keys.py、tests/unit/api/test_provider_patch_rehydrate.py)

检查清单

  • 已更新 CHANGELOG.md(如涉及用户可见变更)
  • README / 文档已更新(如需要)——本次无需改动

mmhh256 and others added 10 commits November 6, 2026 10:07
…elop-after-1.0.3b4

chore: sync main into develop after 1.0.3b4
…d#2865)

GitHub retired the macos-14 runner on 2026-11-02, so the v1.0.3b4 desktop job was cancelled before a runner was assigned.
…ab failures (TencentCloud#2874)

* fix(models,bridge): keep pool preference out of chat and explain collab failures

The starred model is only a harness auto-route preference, so the chat picker shows an expert default or an explicit choice. Permanent cloud-collab rejections now fail immediately with a readable error instead of a raw close frame.

* docs: record preferred-model and bridge error fixes

* fix(db): close SQLite only after in-flight queries finish

Windows aborted the process when server shutdown closed the shared connection while the idle reclaim sweep was still reading agents.

* test(agents): initialize the reclaim sweep handle on stub managers

* test(bridge): wait for both listen frames before cancelling
…TencentCloud#2878)

Keep pauses, themes, citations, backups, and chat chrome from colliding, and show the templates that shipped before the expert market as the default featured set.
* feat(chat): share conversations on a shared expert

Owners can mark a thread as shared so anyone who can open that expert can read it, follow up, and handle pending approvals. Composer settings stay with the owner, and the chat expert menu can open the existing edit drawer.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(chat): satisfy mypy on shared-thread author and HITL lookup

Author ids from message JSON are narrowed before the profile map lookup, and a shared thread may resolve a pending approval without a user filter.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(chat): keep private threads private when the share flag is absent

Visibility checks treat a missing contributed flag as not shared, and dashboard tests read the author-stamped HumanMessage instead of a plain dict.

Co-authored-by: Cursor <cursoragent@cursor.com>

* docs: describe projects alongside experts and teams

Record the agreed project shape: group visibility, owner-backed default context, and tasks that everyone who can open the project can see.

Co-authored-by: Cursor <cursoragent@cursor.com>

---------

Co-authored-by: jubaoliang <jubaoliang@tencent.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
…encentCloud#2880)

An empty default model was discarded, chat chips hid which vendor a model came from, and a waiting frontend never reached people without update permission. PostgreSQL backup now explains a missing client instead of failing as an internal error.
…entCloud#2852)

The browser host's CDP client uses websockets.connect(), which raises
"python-socks is required to use a SOCKS proxy" when a SOCKS proxy env
var is set and the package is absent. The portable runtime's
site-packages are built from this repo's lockfile, and python-socks
was not a dependency — dev machines masked the gap because the
package happened to be manually installed in the dev venv.

Fixes TencentCloud#2836

Verification: uv lock --check consistent; uv export --frozen --no-dev
now emits python-socks==3.2.1.
Per-user provider API keys (bring-your-own-key), stored in the secrets
KV (user_provider_key:{user_id}:{provider_name}, Fernet-sealed, no
schema change) and served at /api/me/provider-keys (Settings -> Model
Keys). Implicit policy: a provider without a global key demands a
personal key (PROVIDER_KEY_REQUIRED), a personal key otherwise overrides
the global key for that user's turns (configurable.api_key_override into
harness requests). User/provider deletion cleans up stored keys.

Also folds a regression test asserting PATCH {"api_key": null} really
clears the stored global key, and the required-key tag copy tweak.

Fixes TencentCloud#2907
@github-actions

Copy link
Copy Markdown
Contributor

请把这个变更重新提交到 develop。功能修改和问题修复都要指向 develop,不要直接指向 main。

Please open this change against develop instead of main.

@github-actions github-actions Bot closed this Nov 10, 2026
@hefanbo hefanbo changed the title feat(providers): bring-your-own-key — per-user provider API keys [obsolete — wrong base] feat(providers): bring-your-own-key — per-user provider API keys Nov 10, 2026
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.

[feature] Per-user provider API keys (bring-your-own-key)

5 participants