Skip to content

fix: settle subtitle removal by actual duration - #29

Merged
lingozhi merged 5 commits into
mainfrom
codex/subtitle-billing-fix
Jul 30, 2026
Merged

fix: settle subtitle removal by actual duration#29
lingozhi merged 5 commits into
mainfrom
codex/subtitle-billing-fix

Conversation

@lingozhi

Copy link
Copy Markdown
Owner

⚠️ 提交说明 / PR Notice

Important

  • 请提供人工撰写的简洁摘要,避免直接粘贴未经整理的 AI 输出。

📝 变更描述 / Description

subtitle-remove 纳入按秒结算模型,避免固定价格模型默认按次结算而保留 600 秒预扣。任务完成后会继续使用上游 frames / fps 计算实际秒数并退回差额。另补充任务计费快照与钱包/token 差额退款的行为级回归测试。

🚀 变更类型 / Type of change

  • 🐛 Bug 修复 (Bug fix) - 请关联对应 Issue,避免将设计取舍、理解偏差或预期不一致直接归类为 bug
  • ✨ 新功能 (New feature) - 重大特性建议先通过 Issue 沟通
  • ⚡ 性能优化 / 重构 (Refactor)
  • 📝 文档更新 (Documentation)

🔗 关联任务 / Related Issue

✅ 提交前检查项 / Checklist

  • 人工确认: 我已亲自整理并撰写此描述,没有直接粘贴未经处理的 AI 输出。
  • 非重复提交: 我已搜索现有的 Issues 与 PRs,确认不是重复提交。
  • Bug fix 说明: 若此 PR 标记为 Bug fix,我已提交或关联对应 Issue,且不会将设计取舍、预期不一致或理解偏差直接归类为 bug。
  • 变更理解: 我已理解这些更改的工作原理及可能影响。
  • 范围聚焦: 本 PR 未包含任何与当前任务无关的代码改动。
  • 本地验证: 已在本地运行并通过测试或手动验证,维护者可以据此复核结果。
  • 安全合规: 代码中无敏感凭据,且符合项目代码规范。

📸 运行证明 / Proof of Work

  • go test ./...
  • 生产复现确认:3 秒视频上游返回 frames=90fps=30;修复前错误保留 600 秒预扣 6,000,000 quota,行为测试验证修复后结算为 30,000 quota 并退款 5,970,000。

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d11a3204b3

ℹ️ 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".

Comment thread constant/env.go
// maximum submit-time precharge to the provider-reported duration on completion.
var TaskPricePerSecondModels = []string{
"depth-anything-v2-small-video",
"subtitle-remove",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Honor TASK_PRICE_PATCH before enabling duration settlement

When TASK_PRICE_PATCH contains subtitle-remove, relay/relay_task.go:198 deliberately skips applying the 600-second ratio, so submission precharges only one call; adding the model here nevertheless makes buildTaskBillingContext force PerCallBilling to false, and completion then charges frames / fps seconds. This makes the submit and settlement phases use conflicting pricing modes, causing an unexpected additional charge or settlement failure; either preserve the patch's per-call precedence or apply duration pricing consistently during precharge.

AGENTS.md reference: AGENTS.md:L110-L110

Useful? React with 👍 / 👎.

Comment thread constant/env_test.go Outdated
Comment on lines +10 to +12
assert.Contains(t, TaskPricePerSecondModels, "depth-anything-v2-small-video")
assert.Contains(t, TaskPricePerSecondModels, "subtitle-remove")
assert.NotContains(t, TaskPricePerSecondModels, "background-remove")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Remove the private-list membership test

This test locks in the exact contents of an internal slice rather than an observable billing contract, and its subtitle-remove assertion is already covered by TestBuildTaskBillingContextKeepsSubtitleRemovalDurationSettled. It will fail whenever the implementation moves away from this list even if duration settlement remains correct, so retain the behavioral controller/service coverage instead.

AGENTS.md reference: AGENTS.md:L120-L120

Useful? React with 👍 / 👎.

@lingozhi
lingozhi merged commit ee23304 into main Jul 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant