GeezerVison is showing github.com — fix(core): #1014 follow-ups — stale balance holds on deleted/reclassified plans + balance-exhaustion classification breadth · Issue #1380 · developing-today-forks/opencode
fix(core): #1014 follow-ups — stale balance holds on deleted/reclassified plans + balance-exhaustion classification breadth #1380DescriptionFollow-up implementation issue for #1014 (routed by triage task 6187, 2026-11-02; the umbrella #1014 stays open — this issue owns only the two deferred CodeRabbit findings below, ported from #1014 comment 6561987451, not a re-file of the umbrella).
Items (deferred from PR #1190 review, recorded on #1014 comment 6561987451)
- Stale balance holds when a balance plan is deleted or reclassified (PR fix(core): gate balance-shaped quota pools by balance, not percent (#1014) #1190 thread,
packages/core/src/model-route.ts ~779 in that diff): refreshQuotaGate returns early when no relevant plan/eligible window remains, so quota:<provider> / quota-credential:<id> adjustments from a deleted or reclassified balance plan can persist indefinitely; a windowHours reclassification also makes releasesHold reject the snapshot. Fix: clear the stale balance hold when no balance grant remains, replacing it with the remaining window's normal timed gate when one exists, while preserving the hold for a still-applicable depleted balance plan.
- Balance-exhaustion classification breadth (PR fix(core): gate balance-shaped quota pools by balance, not percent (#1014) #1190 thread,
packages/core/src/session/runner/step.ts ~455 in that diff): generic exhaustion text (e.g. a plain HTTP 429 "You have reached your rate limit") can enter the balance-exhaustion branch when the prior snapshot has balance === true, installing an increase-only hold with no expiry. Fix: keep the broad match for entering the quota-failure path, but require an explicitly credit/balance-specific match (or QuotaExceeded) for the balance-exhaustion classification unless the provider contract establishes the text reports credits. (Note: issue fix(core): quota gate derivation includes expired/cancelled plans — a retained historical plan's smaller window can gate a provider whose current plan has capacity (PR #1028 Codex P2 unaddressed) #1340 covers a different quota-gate defect from PR fix(core): feed current quota reads into route candidacy gate (#984) #1028 — not this classification item.)
Acceptance
Activitydezren39 commented on Nov 2, 2026 🤖 Agent note · parked — sequencing gate on PR #1353
- Agent: queue worker (repo-worker-opencode), event-hook launch
- Session / ID: queue task 6192
- Found via: queue claim · repo-health-opencode-pilot
- Task: Implement fix(core): #1014 follow-ups — stale balance holds on deleted/reclassified plans + balance-exhaustion classification breadth #1380 items 1–2 (stale balance holds; balance-exhaustion classification breadth).
- Revalidation (fresh, 2026-11-02): fix(core): #1014 follow-ups — stale balance holds on deleted/reclassified plans + balance-exhaustion classification breadth #1380 OPEN, no held / user/owned / do-not-merge / do-not-auto-edit labels. BUT open PR fix(core): exclude expired and cancelled plans from quota gate derivation #1353 (issue fix(core): quota gate derivation includes expired/cancelled plans — a retained historical plan's smaller window can gate a provider whose current plan has capacity (PR #1028 Codex P2 unaddressed) #1340, branch queue/6006-1340-quota-plan-status, updated 2026-11-02T05:40Z) touches the same gate code: it adds
reconcileQuotaGate to packages/core/src/model-route.ts (adjacent to observeProviderQuota, ~994) and edits packages/core/test/model-route.test.ts. Its reconcile step already clears plan-derived quota state and removes a durable balance baseline when its grant's plan has ended — directly adjacent to, and partially overlapping, item 1's stale-hold clearing in refreshQuotaGate/releasesHold.
- Outcome: Parked 60 minutes, sequenced after PR fix(core): exclude expired and cancelled plans from quota gate derivation #1353 (fleet precedent: tasks 6121/6078 parked on PR fix(ci): scan packages/ai in the check:proto-reads gate #919 for the same-file gate). Stacking a second hold-clearing implementation now risks competing gate semantics and test-file conflicts; item 1's correct final shape depends on whether
reconcileQuotaGate lands as-is.
- Resume: Re-check PR fix(core): exclude expired and cancelled plans from quota gate derivation #1353 fresh. If merged: implement item 1 on top of
reconcileQuotaGate (cover the deleted/reclassified-plan and windowHours-reclassification cases the reconcile does not), plus item 2 (step.ts classification breadth, independent of fix(core): exclude expired and cancelled plans from quota gate derivation #1353) with dedicated tests. If fix(core): exclude expired and cancelled plans from quota gate derivation #1353 is still open: either park again naming it, or split item 2 into its own PR and leave item 1 gated. No code changes this claim; no worktree created.
dezren39 commented on Nov 2, 2026 dezren39 commented on Nov 2, 2026 🤖 Agent note · parked — PR #1393 open, awaiting Codex review + CI
- Agent: queue worker (repo-worker-opencode), lane A scheduled shift
- Session / ID: queue task 6192
- Found via: queue claim · repo-health-opencode-pilot
- Task: Implement fix(core): #1014 follow-ups — stale balance holds on deleted/reclassified plans + balance-exhaustion classification breadth #1380 items 1–2 (stale balance holds; balance-exhaustion classification breadth).
- Revalidation (fresh, 2026-11-02): fix(core): #1014 follow-ups — stale balance holds on deleted/reclassified plans + balance-exhaustion classification breadth #1380 OPEN, no held / user/owned / do-not-merge / do-not-auto-edit labels. Sequencing gate PR fix(core): exclude expired and cancelled plans from quota gate derivation #1353 MERGED 2026-11-02T13:02Z (5d3780e), so item 1 proceeded on top of its
reconcileQuotaGate.
- Outcome: PR fix(core): stale balance holds + balance-exhaustion classification (#1380) #1393 — item 2 (prior holder commit a17e682: credit/balance-specific match or QuotaExceeded required for balance-exhaustion classification in step.ts, with tests) plus item 1 (commit 0f80dbd: same-grant reclassified window replaces the stale balance hold with its normal timed gate; reconcile clears restored-only durable baselines whose grant plan ended, preserves them while the grant plan is live; dedicated tests for both).
- Tests: model-route 102 pass; model-route + session-step-failure + model-route-credential 149 pass; quota-snapshot + quota-burn-rate + session-runner + session-runner-model + model-resolver 377 pass; tsgo -b clean; pre-push passed.
- Resume: Check Codex marker + CodeRabbit on PR fix(core): stale balance holds + balance-exhaustion classification (#1380) #1393 head 0f80dbd, disposition every finding; if clean and MERGEABLE/CLEAN, merge (merge commit), confirm fix(core): #1014 follow-ups — stale balance holds on deleted/reclassified plans + balance-exhaustion classification breadth #1380 closed, clean queue labels, complete task 6192 as fixed_merged.
dezren39 commented on Nov 2, 2026 Fixed and merged via PR #1393 (merge commit 78c48b5, 2026-11-02). Codex review clean on head 0f80dbd (codex-review-state:v1, has_unresolved_findings=false); PR was MERGEABLE/CLEAN, 0 behind main. Queue labels cleaned.
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|