Repository navigation
fix: 按输入框隔离外部 Harness 的 Codex 额度限制 - #377
Closed
BytePioneer-AI wants to merge 1 commit into
Closed
BytePioneer-AI wants to merge 1 commit into
BytePioneer-AI wants to merge 1 commit into
Conversation
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueComment |
Owner
Author
|
Superseded by #378, which landed a slimmer version of this fix plus audit coverage. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
修改摘要
解决官方 Codex 账号额度耗尽时,Desktop 原生 Composer 同时阻止独立外部 Harness(如 Pi、Claude Code)发送的问题。外部 Harness 的实际认证、额度和计费仍由其原生实现处理,不修改 Codex 账号或共享额度数据,也不另建发送链路。
此 PR 暂以草稿提交。当前实现验证了可行性,但依赖 Desktop 私有 React/store 契约,维护成本和是否需要进一步收敛应先评审,不建议未经真实行为验收直接合并。
生产实现
renderer-codex-usage-gate.ts,在已提交的 React 树中识别当前 Composer 的账号额度门和 reservehardBlocked布尔订阅,不依赖固定 hook 序号或压缩函数名。disabled。耦合与维护风险
useSyncExternalStore实例及订阅 effect 的私有布局。store.sub进行捕获;该方法在finally中恢复,不写 atom/账号/额度缓存,也不向共享 store 保留额外订阅。这仍是需要重点审查的侵入点。__reactProps$私有属性。关联问题
无关联 Issue;来自 Codex 额度耗尽时 Pi 输入框被错误禁用的实机复现。
验证计划与结果
本提交已单独移到最新
main,未携带原工作分支的其他提交。更新基线后按锁文件安装依赖(npm ci --ignore-scripts --no-audit --no-fund),以下检查均已重新执行。自动检查
npm run typecheck:通过。npm run lint:通过,包含包边界检查。npm run build:renderer:通过。git diff origin/main...HEAD --check:通过。覆盖共享 store 下的多 Composer 隔离、切回 Codex、额度更新、hook 链替换、解除绑定、识别失败、空输入、其他阻塞、模拟点击/Enter 提交守卫及 Adapter 失效。另将旧 Chat 隔离测试改为使用正常测试 origin,避免
about:blank的 localStorage 权限错误。浏览器测试使用离线模拟数据与提交回调,不连接真实 Harness,不等同于真实发送验收。
实机诊断与未验证范围
26.917.51856(build10492)。submitDisabled及按钮状态解除阻塞,共享额度值仍保持阻止;撤销后恢复禁用。