fix(quota): close refresh worker lifecycle gaps - #79
Conversation
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: eccd402047
ℹ️ 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".
| if s.refreshWorkersClose || s.refreshWorkerCtx.Err() != nil { | ||
| s.refreshWorkerMu.Unlock() | ||
| return | ||
| return nil, refreshUnavailableCode | ||
| } | ||
| task, created := s.refreshTasks.enqueue(authIndex) |
There was a problem hiding this comment.
当应用关闭与刷新请求并发时,Err() 可能先返回 nil,随后生命周期 context 被取消,而任务仍在第 215 行入队并作为 Accepted 返回;worker 接管后只能观察到已取消的 context 并将任务标记失败。这仍会返回一个不可能执行 provider probe 的任务,违反本次在 CONTEXT.md 中新增的关闭期拒绝保证;需要先在同一把锁下将生命周期标记为 closing,再取消 context 和等待 worker,而不是仅采样 ctx.Err()。
AGENTS.md reference: AGENTS.md:L36-L38
Useful? React with 👍 / 👎.
StopRefreshWorkers now marks closing and cancels the worker context under the same lock, closing the TOCTOU window where a refresh task could be accepted after ctx cancellation but before the close flag. App shutdown stops workers before cancelling the background context.
|
已处理 Codex review 反馈(P2: 生命周期关闭与任务接收临界区,internal/quota/refresh.go:211-215)。 修复(commit
验证: @codex review |
|
Codex Review: Didn't find any major issues. Breezy! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
Summary
Verification
Compatibility
Issue closeout
Auto-close: none