zai-org / zai-org/feedback

[Bug] 闲时任务票据过期后静默回落到用户自费模型渠道继续运行并扣费(票据有效期约 3 小时,已 4 次复现)

Open
#489 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

priority: P2
Dominant language
No language data
Stars
22
Forks
1
PR merge metrics
No merged PRs in 30d

Description

问题描述 · Description

闲时任务(off-peak task)运行约 3 小时后闲时票据过期(off-peak-ticket-expired,错误码 3102/3001),客户端将其判定为终态失败且不重新排队;随后运行时的免费模型覆盖被移除(session.model.updated: offpeak-idle-plan/GLM-5.3 → 用户自定义付费供应商),会话静默回落到用户自费渠道继续自主运行——全程无任何提示或确认,持续消耗付费额度,直到余额耗尽才停止。

复现步骤 · Steps to reproduce

  1. 配置一个自定义付费模型供应商(自有 API key),并设为会话默认模型;
  2. 创建闲时任务,任务工作量超过约 3 小时;
  3. 票据生效后在免费通道(offpeak-idle-plan)正常运行约 3 小时;
  4. 票据过期:TerminalStreamChunkError: off-peak-ticket-expired: off-peak ticket is invalid or expired
  5. 运行标记 failed,免费覆盖被移除,会话回落自费渠道继续跑 → 持续计费直至余额不足。

期望表现 · Expected behavior

  1. 票据过期归类为 transient:暂停并重新排队等待下一窗口/票据(或至少停止任务,等待用户确认);
  2. 闲时任务运行硬性限定在闲时通道,付费供应商不进入其可选模型集;
  3. 任何回退到付费渠道的行为默认关闭,需逐任务显式授权;发生切换时界面醒目提示;
  4. 提供按渠道(免费/自费)的用量记录。

实际表现 · Actual behavior

本机日志共 4 次复现,票据有效期稳定在约 3 小时:

# 票据生效 过期回落 免费通道运行 回落目标 回落后自费消耗
1a 08-30 08:07:23 08-30 11:08:03 3h00m 用户自定义 4sapi/gpt-5.6-luna 继续运行(未量化)
1b 08-30 13:38:02 08-30 16:39:23 3h01m 同上 继续运行(未量化)
2 09-02 01:08:57 09-02 04:19:11 3h10m 同上 04:22–06:01 共 108 次请求
3 09-03 00:35:26 09-03 03:36:37 3h01m 用户自定义 GLM-5.3-Flash 03:40–05:00 共 277 次请求,key 余额耗尽("余额不足或无可用资源包,请充值。")

客户端行为依据(zcode.cjs 3.10.2 resolveOffPeakFailureDecision):错误码 3102/3001ticketExpiredretryable:false 终态,不重新排队;仅 3105/HTTP 429 判为 queued 进入重排队。失败后免费覆盖被移除,会话按创建时绑定的付费模型继续 turn loop。

第三次完整时间线(北京时间):

09-02 23:35:14  取票排队成功 position=275 (task=offpeak-67a0c255)
09-03 00:35:26  会话模型覆盖为免费 offpeak-idle-plan/GLM-5.3
00:35–03:36     免费通道运行 548 次请求
03:36:37.910    model.request.failed: off-peak-ticket-expired (attempt 1, maxAttempts 11, 终态)
03:36:38.041    session.model.updated: offpeak-idle-plan/GLM-5.3 -> [用户自定义付费供应商]/GLM-5.3-Flash
03:36:43.071    off-peak run finished task=offpeak-67a0c255 status=failed
03:37:02        off-peak settle acked(票据正常结算)
03:40:51        第一笔自费请求完成
03:40–05:00     自费渠道 277 次请求(含子任务),约 1h20m
05:00:47        请求报错"余额不足或无可用资源包,请充值。",会话停止

环境 · Environment

  • ZCode Desktop 3.10.2(win32-x64)
  • Windows 11 22H2(Build 22621,x64),时区 Asia/Shanghai

截图 / 日志 · Evidence

以上全部来自本机宿主日志与 CLI 请求日志(已脱敏:供应商 UUID、票据 ID 已替换,无会话正文)。关键摘录:

{"timestamp":"2026-09-02T19:36:37.910Z","event":"model.request.failed","cause":{"name":"AiSdkModelAdapterError","message":"off-peak-ticket-expired: off-peak ticket is invalid or expired","context":{"attempt":1,"maxAttempts":11,"modelId":"GLM-5.3","errorPhase":"stream"}}}
{"timestamp":"2026-09-02T19:36:38.041Z","event":"session.model.updated","context":{"model":"[CUSTOM-PROVIDER]/GLM-5.3-Flash","previousModel":"offpeak-idle-plan/GLM-5.3"}}

如需完整日志文件(宿主日志 / CLI 日志 / model-io 请求明细),我可以随时提供。

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in zcode.cjs 3.10.2 at resolveOffPeakFailureDecision and trace the ticketExpired path through the session.model.updated event. Reproduce the expiry timeline using the supplied logs; done means an expired off-peak ticket cannot silently switch to a paid provider and instead pauses, requeues, or requests explicit confirmation.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
ai, payments
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.