Commit Graph

3 Commits

Author SHA1 Message Date
Dash
48bfca40df feat(usage-limit): 账号用量上限重置后自动继续,覆盖更多订阅套餐 (#5540)
* 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>
2026-10-08 08:40:08 +08:00
Dash
34c2bffdf4 feat(session): 支持通过运行时工具切换 harness (#4345)
Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
2026-09-12 17:51:04 +08:00
Chris Zhang
cd659248c6 feat(session): 开放运行时模型控制与自动降级 (#3364)
* feat(session): expose runtime model control

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix: address runtime control review findings

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix: address runtime fallback review findings

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix: compose runtime patches on pending profile

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix: retain runtime state across session rebuilds

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix: recover atomic runtime selection failures

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(session): commit runtime axes after live apply

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(session): guard runtime fallback boundaries

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(session): rebuild fixed-effort runtime switches

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(session): recover runtime selection failures

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(session): preserve runtime state across races

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(session): make runtime axis persistence atomic

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(session): clear terminal runtime routing state

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(session): fence runtime axes at owner boundaries

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(session): validate runtime model selection inputs

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(session): reconcile pending runtime mutations

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(session): fence fallback across owner and remote routes

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(session): close owner and axis recovery races

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(session): validate user runtime axes

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(session): harden runtime fallback recovery

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(session): preserve pending runtime compatibility

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(session): fence retained runtime recovery

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(session): address runtime cleanup races

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(session): close remaining runtime cleanup gaps

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(session): normalize fixed-effort placeholders

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(session): scope fixed-effort placeholders to users

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(session): preserve runtime state on owner generation bumps

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(session): close runtime and Orca lifecycle gaps

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(session): defer runtime axis patches safely

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

* fix(session): scope runtime epoch to owner changes

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>

---------

Signed-off-by: Chris <4436110+zqchris@users.noreply.github.com>
Co-authored-by: Chris <4436110+zqchris@users.noreply.github.com>
2026-08-25 21:05:39 +08:00