fix(desktop): hide custom provider SDK costs by default - #2878
Conversation
|
| Filename | Overview |
|---|---|
| apps/desktop/src/shared/customProviderBilling.ts | 定义可信实际费用、独立估值和自定义 Provider SDK 估值的共享分类规则。 |
| apps/desktop/src/main/localDb/ipc/messages.ts | 在主进程中投影消息与会话费用,并提供批量会话估值读取。 |
| apps/desktop/src/main/scheduler-host/runCostLedger.ts | 将 Scheduler 运行费用拆分为实际支出、完整估值和 SDK 估值子账本。 |
| apps/desktop/src/renderer/lib/customProviderCostPresentation.ts | 根据用户偏好对 Desktop 历史消息和轮次费用执行只读展示投影。 |
| apps/mobile/src/session/sessionBillingProjection.ts | 在 Mobile 端应用与 Desktop 一致的远程会话费用投影语义。 |
| packages/device-link/src/allowlist.ts | 将新增只读费用查询纳入 Device Link 的显式远程调用边界。 |
| apps/desktop/drizzle/scripts/0096_scheduler_sdk_estimated_value.ts | 通过幂等列存在性守卫为 Scheduler 运行记录追加 SDK 估值字段。 |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart LR
A[Provider usage metadata] --> B[Desktop classification]
B --> C[Actual cost ledger]
B --> D[Independent estimate]
B --> E[SDK estimate sub-ledger]
C --> F[Desktop and Scheduler projection]
D --> F
E --> G{Show SDK estimates?}
G -- No --> H[Token or trusted value display]
G -- Yes --> F
F --> I[Device Link read-only projection]
I --> J[Mobile display]
Reviews (31): Last reviewed commit: "fix(desktop): fail closed session billin..." | Re-trigger Greptile
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f4470f0ca1
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
这个 PR 触及产品默认行为变化(自定义 Provider 的 SDK 费用由默认展示改为默认隐藏,并新增设置开关),自动流程已暂停合并,需要维护者确认。 维护者确认方式:直接在 PR 上 Approve;需要修改就 Request Changes,作者改完后再 Approve 即放行。在维护者确认前,这个 PR 会保持在待确认队列中,不会自动合并。 讨论 issue:#2884 |
|
@A1aZ 👋 这个 PR 还有 2 条 review conversation 没 resolve(apps/desktop/src/main/maker-ipc/register.ts / apps/desktop/src/renderer/components/settings/CustomProviderBillingSection.tsx),auto-review 因此暂时跳过、没法继续审查 / 合并。 如果你已经按评论改完或回应了,请到对应 thread 上点 Resolve conversation;全部 resolve 后,下一轮 auto-review 会自动重新审查这个 PR。 |
|
命中 UI 路径(apps/desktop/src/renderer/components/settings/CustomProviderBillingSection.tsx / apps/desktop/src/renderer/components/settings/ProvidersSection.tsx / apps/desktop/src/renderer/hooks/useCustomProviderBillingSettings.ts 等)但 description 未附界面效果证据——建议补充改动后效果:截图/录屏,或改动后界面的 HTML 页面(```html 代码块、.html 附件或在线预览链接),便于确认界面符合 DESIGN.md 设计规范 |
f4470f0 to
cb1c617
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: cb1c6176b6
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a7d280209f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
a7d2802 to
7af9436
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7af9436d96
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@A1aZ 👋 这个 PR 还有 2 条 review conversation 没 resolve(apps/desktop/src/main/scheduler-host/storage.ts / apps/desktop/src/renderer/features/cc-agent/sidebar/SessionInfoMeta.tsx),auto-review 因此暂时跳过、没法继续审查 / 合并。 如果你已经按评论改完或回应了,请到对应 thread 上点 Resolve conversation;全部 resolve 后,下一轮 auto-review 会自动重新审查这个 PR。 |
|
@A1aZ 👋 这个 PR 目前与 请在本地 merge 最新的 |
Signed-off-by: Alan Z <3347202+A1aZ@users.noreply.github.com>
Signed-off-by: Alan Z <3347202+A1aZ@users.noreply.github.com>
Signed-off-by: Alan Z <3347202+A1aZ@users.noreply.github.com>
…ates Use the session/schedule provider as a fail-closed fallback when older custom-provider rows omit turnCostIsCustomProvider, so Scheduler run history no longer treats those SDK amounts as actual spend. Sidebar cost rows now share one main-process batch query and listener pair instead of scanning every session independently. Signed-off-by: Alan Z <3347202+A1aZ@users.noreply.github.com>
7af9436 to
b5676ee
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b5676ee2f8
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Require a trusted renderer sender for estimated-session-value IPC while keeping device-link on its existing async-context path. Desktop remote sessions now read the controlled host billing preference, sidebar cost refreshes that arrive mid-query are kept, and the Pi subscription source contract matches the rebased hot path. Signed-off-by: Alan Z <3347202+A1aZ@users.noreply.github.com>
Attach Light/Dark default-off and opt-in screenshots so the PR body can reference checked-in evidence without GitHub comment image upload. Signed-off-by: Alan Z <3347202+A1aZ@users.noreply.github.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f7900a46ff
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Signed-off-by: Alan Z <3347202+A1aZ@users.noreply.github.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 844d50f7b3
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@A1aZ 👋 这个 PR 目前与 请在本地 merge 最新的 |
Signed-off-by: Alan Z <3347202+A1aZ@users.noreply.github.com>
Signed-off-by: Alan Z <3347202+A1aZ@users.noreply.github.com>
Signed-off-by: Alan Z <3347202+A1aZ@users.noreply.github.com>
Signed-off-by: Alan Z <3347202+A1aZ@users.noreply.github.com>
Signed-off-by: Alan Z <3347202+A1aZ@users.noreply.github.com>
Signed-off-by: Alan Z <3347202+A1aZ@users.noreply.github.com>
Signed-off-by: Alan Z <3347202+A1aZ@users.noreply.github.com>
Signed-off-by: Alan Z <3347202+A1aZ@users.noreply.github.com>
…-provider-billing Signed-off-by: Alan Z <3347202+A1aZ@users.noreply.github.com>
Signed-off-by: Alan Z <3347202+A1aZ@users.noreply.github.com>
186e349 to
be2633f
Compare
|
@A1aZ 👋 这个 PR 目前与 请在本地 merge 最新的 |
Signed-off-by: Alan Z <3347202+A1aZ@users.noreply.github.com>
Signed-off-by: Alan Z <3347202+A1aZ@users.noreply.github.com>
Signed-off-by: Alan Z <3347202+A1aZ@users.noreply.github.com>
|
@A1aZ 👋 这个 PR 目前与 请在本地 merge 最新的 |
Signed-off-by: Alan Z <3347202+A1aZ@users.noreply.github.com>
…-provider-billing
…-provider-billing
…-provider-billing
…-provider-billing
…-provider-billing
…-provider-billing
…-provider-billing
…-provider-billing
…-provider-billing
Signed-off-by: Alan Z <3347202+A1aZ@users.noreply.github.com>
…-provider-billing
Signed-off-by: Alan Z <3347202+A1aZ@users.noreply.github.com>
这次改了什么
摘要
自定义 Provider 的 SDK
costUSD来源与计价口径无法由 Cindy 验证,不能默认当作可对账的真实支出。本 PR 将它改为:value-estimate展示,仍不进入消息 / 会话 / 今日支出的actual-cost账本;「设置 → Providers」中的开关默认关闭,并明确提示该数字不是供应商账单、可能与最终扣费不一致。设置采用默认值 + override;用户修改后可看到「已自定义」并恢复默认,恢复时删除 override。
变更类型
feat新功能fix缺陷修复refactor/perf重构或性能优化docs/test/chore文档、测试或工程维护范围
0095_ancient_gorilla_manmigration;0093 / 0094 历史 snapshot 保持不变。Desktop 和 Mobile 的英文、简中、繁中、日文、韩文。UI 变化
「设置 → Providers」新增「显示 SDK 估算」开关、风险说明、「已自定义」状态和「恢复默认」入口。
默认关闭时,消息、侧栏、状态栏、Mobile 与 Scheduler 均优先展示 Token 或保留的其他可信 / 独立估价。
已完成 Light / Dark × 默认关闭 / 手动开启四种脱敏运行时截图并做视觉复核



Light · 默认关闭
Dark · 默认关闭
Light · 手动开启
Dark · 手动开启
引用的设计规范:
docs/design-rules/DESIGN.md§2 Layer System、§3 Typography、§4 Cards & Forms、§10 Light/Dark dual-mode and theme tokens、§11 Voice & Content。控件复用现有设置卡片、Switch 和语义化主题 token;提示文案直接说明来源、不可控性和开启后果。怎么验证的
自动验证
最终提交已重新通过根目录
pnpm test:unit:related、Desktop / Mobile typecheck、git diff --check与 DCO;此前 migration validate 与 i18n 对齐检查也已通过。定向覆盖包括:旧 Host 逐轮兼容投影 3 文件 / 34 项、Desktop partial-page mixed cumulative 8/8、无版本 projection 权威性 7/7,以及 Mobile 同口径累计费用 12/12。手工验证
未执行的验证
风险
风险分类
影响与回滚
schedule_runs.sdk_estimated_value_amount,migration 带列存在性守卫,不修改历史 migration。本地 GET / SET / RESET 继续先校验 trusted app renderer。Device link 仅提供门禁后的只读 GET 投影,以及只读estimatedSessionValueBatch;不能远程修改偏好。SSH / remote workspace 不读取或修改远端 workdir 文件;费用偏好仍属于被控 Desktop 本地。Mobile / device-link 新增字段与读取路径均为可选 / 向后兼容;旧端费用汇总继续使用非权威 token-only 或逐会话查询,新版控制端会对旧 Host 返回的原始消息做只读逐轮兼容投影。原生层 / fingerprint / OTA 无改动。存量插件影响:无。提交前检查
git commit -s,见 DCO)