mirror of
https://github.com/makecindy/cindy.git
synced 2026-12-02 07:29:58 +08:00
* feat(usage-limit): 账号用量上限重置后自动继续,覆盖更多订阅套餐 - 普通任务撞上 5 小时 / 周用量上限时照常报错,同时等额度重置;到点仍无人处理 就自动继续(有产出发续跑指令、零产出重发原文)。横幅显示「将于 X 自动继续 · 取消」,手机端同步;替换原「恢复后继续」一次性自动化入口。仅本次运行有效。 - 重置时刻统一按会话所用账号求:错误自带 → 报错原文(Codex try again at、Pi ~N min、ChatGPT resets_at)→ 订阅用量快照(ChatGPT / Claude / SuperGrok 按 provider 的 auth.native)。目标模式共用同一套来源。 - 新增 maker:input:cancel-usage-limit-wait 与可选投影字段 usageLimitWait; 账号限额不再进入秒级中断重连。 Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com> * fix(usage-limit): scope waits to the session model and subscription, tighten lifecycle - Read only the Codex bucket / Claude scoped window that limits the session model - Never wait on non-subscription providers even when the error text has a retry time - Bind waits to the candidate recovery issued at the terminal error; drop in-flight resolutions on user action or close; withdraw the hint when eligibility lapses - Check the renderer sender on the cancel IPC; renderer no longer clears the hint optimistically Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com> * fix(usage-limit): only trust reliable reset times of the limited subscription window - Goal mode reads error-text reset times through the host, only for subscription sessions - An exhausted window without a reset time yields no reset time instead of borrowing another - Ignore windows already past their reset and stale SuperGrok snapshots Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com> * fix(usage-limit): restore the error when a reset continuation is dropped before dispatch - Keep a pre-dispatch rollback record for usage-limit continuations (no interrupted-turn token) - Restore the original error and manual retry from the existing discard / undispatched hooks - Document that scheduler-origin inputs, including hook channel messages, are not covered Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com> * fix(usage-limit): withdraw a fired wait when the continuation does not start Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com> * fix(usage-limit): recognise built-in subscription accounts, commit unconfirmed continuations - Map the built-in default providers (openai / anthropic / xai) to their subscription family - Treat a usage-limit continuation as current while its pre-dispatch rollback record exists, so an unconfirmed dispatch is committed instead of being restored as retryable - Do not pass the usage-limit sessionTotal (0) to interrupted-turn bookkeeping Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com> * fix(usage-limit): only use snapshot reset times when the snapshot confirms the limit - Return a snapshot reset time only when a window is exhausted; goal's reactive path checks limited too - Void the snapshot-level reached flag once any window has rolled over Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com> * fix(usage-limit): judge snapshots by exhausted windows only, withdraw waits on model switch - Drop snapshot-level reached flags (stale or credits depleted); only an exhausted live window counts - A user model / source switch withdraws the pending usage-limit wait - Document that goal mode keeps its persisted usageLimited resume across restarts Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com> * docs(usage-limit): scope the model-switch withdrawal rule to ordinary tasks Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com> * fix(usage-limit): match usage windows against the model the session actually runs Runtime overrides (set_session_runtime / automatic fallback) take precedence over the saved session model and provider for both ordinary tasks and goal mode. Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com> * fix(usage-limit): never auto-continue a shared-task guest turn The guest's access may be revoked while waiting; re-sending their instruction hours later is unsafe, so the error stays for the owner to handle. Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com> * test(usage-limit): pin that guest steers never leave a usage-limit wait Covers both orderings (steer ack before / after the terminal error); docs mention guest steers. Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com> * fix(usage-limit): goal mode skips local subscription snapshots for SSH sessions Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com> * fix(usage-limit): withdraw the wait before a user model switch starts Cancelling after handleSetModel could lose to a continuation that fired during the switch. Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com> * fix(usage-limit): never treat billing depletion as a periodic usage limit Share the billing-depletion check between the usage-limit classifier (goal and ordinary tasks) and the reset-time parser, so quota wording on a billing error no longer schedules a wait. Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com> * fix(usage-limit): ignore zone-less clock times from SSH session errors Remote Codex reports 'try again at 3:05 PM' in the remote host's local time; only relative, zoned or structured reset times are used for SSH sessions. Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com> * fix(usage-limit): never auto-wait on a usage limit while the task is shared Per Dash (2026-10-08): ordinary tasks and goal mode stay on the error / usageLimited for the owner to resume when the task is currently shared; a wait that becomes shared does not resume at the reset time. Goal overload retries are unaffected. Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com> --------- Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
3.9 KiB
3.9 KiB
任务运行时控制与自动降级
目标
Cindy 允许 Agent 通过统一会话控制面查询和临时调整当前任务或指定任务的模型、来源、 推理强度与 Fast。该能力服务于 Skill 的任务类型路由和故障恢复,不替代用户在界面中保存的 模型偏好。
状态模型
每个任务同时维护四类状态:
baseline:用户保存到任务记录的模型、来源、推理强度与 Fast。effective:当前实际生效的运行时组合;Agent 临时切换和自动降级只改这一层。pending:已接受但尚未生效的组合;临时调整等当前 turn 结束,显式 Harness 选择等下一条消息发送。generation:运行时控制面的单调版本。跨任务修改应先读后写并携带 generation,避免旧请求覆盖新选择。
用户在模型选择器中的完整选择会清除临时运行时组合;用户单独修改推理强度或 Fast 时, 该轴立即成为新基线,同时保留仍在使用的临时模型路由。应用重启后只恢复 baseline。
Agent 控制面
get_session_runtime:session_id可省略;省略时查询当前任务。返回活动状态、baseline、 effective、pending、generation 和自动降级开关。set_session_runtime:session_id可省略;原子提交来源、模型、推理强度与 Fast 的任意子集。- 当前或目标任务忙碌时不修改进行中的 turn,返回
deferred,在下一个 turn 边界生效。 - 省略
harness时,Agent 的修改不写回任务 baseline。语义失败是否提高推理强度或换更强模型,由 Agent 或 Skill 明确请求。 - 显式提供
harness(claude-code/codex/pi)时必须同时指定model,表示完整的任务执行选择; 即使选回当前 Harness,也复用模型选择器的完整选择语义。目标模型、来源、推理强度和 Fast 在登记前一起校验, 省略来源时按目标 Harness 的模型解析默认来源,不沿用旧 Harness 的来源。 - 完整选择返回
deferred/effective_boundary: next_send,清除此前临时调整;get_session_runtime.pending显示目标 Harness,effective仍表示当前运行组合。空闲和忙碌任务均在下一条消息发送时消费意图, 复用现有历史交接与原生绑定切换事务,更新该任务 baseline,但不修改全局默认设置。 切换失败时保留待切换选择并阻止该次发送,不继续使用旧引擎。 - SSH 远程、Orca、Review 和归档任务不支持此完整选择。存在待切换 Harness 时如需修改目标,
重新读取 generation 并再次提交完整
harness+model;普通临时调整不会覆盖待切换选择。
自动降级
设置中的“任务模型自动降级”默认关闭。开启后只复用宿主现有的安全自动续跑入口, 即已被白名单识别为连接、超时、过载或容量问题的失败;认证失败、权限拒绝、用户取消、 协议或参数错误不触发。
顺序固定为:
- 让 Harness 现有的有限重试先处理瞬时故障。
- 切换到同一模型的其他已连接、未停用来源。
- 若仍失败,只尝试目录通过
newSessionDefault为当前 Harness 明确声明的模型。
账号 5 小时 / 周用量上限不在此白名单内:那类失败等额度重置后自动继续,见 usage-limit-auto-continue.md。
自动降级不采用“可用列表第一个”之类的隐式兜底,不跨 Harness;每个任务最多换路两次,
记录已访问的 (来源, 模型),禁止 A → B → A 回环。用户修改运行时选择后立即清空本轮降级轨迹。
跨端边界
运行时控制由 Desktop host 独占,MCP、Renderer 与 Device Link 都复用同一原子切换路径。 手机和 SSH 控制端无需新增独立状态机;它们读取任务状态时看到同一 baseline/effective/pending 投影。远程控制的授权边界保持不变。