fix: settle subtitle removal by actual duration - #29
Conversation
There was a problem hiding this comment.
💡 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".
| // maximum submit-time precharge to the provider-reported duration on completion. | ||
| var TaskPricePerSecondModels = []string{ | ||
| "depth-anything-v2-small-video", | ||
| "subtitle-remove", |
There was a problem hiding this comment.
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 👍 / 👎.
| assert.Contains(t, TaskPricePerSecondModels, "depth-anything-v2-small-video") | ||
| assert.Contains(t, TaskPricePerSecondModels, "subtitle-remove") | ||
| assert.NotContains(t, TaskPricePerSecondModels, "background-remove") |
There was a problem hiding this comment.
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 👍 / 👎.
Important
📝 变更描述 / Description
将
subtitle-remove纳入按秒结算模型,避免固定价格模型默认按次结算而保留 600 秒预扣。任务完成后会继续使用上游frames / fps计算实际秒数并退回差额。另补充任务计费快照与钱包/token 差额退款的行为级回归测试。🚀 变更类型 / Type of change
🔗 关联任务 / Related Issue
✅ 提交前检查项 / Checklist
Bug fix,我已提交或关联对应 Issue,且不会将设计取舍、预期不一致或理解偏差直接归类为 bug。📸 运行证明 / Proof of Work
go test ./...frames=90、fps=30;修复前错误保留 600 秒预扣 6,000,000 quota,行为测试验证修复后结算为 30,000 quota 并退款 5,970,000。