Repository navigation
Conversation
…le window goal_quota_with_spend_ledger subtracts timedelta(hours=window_hours) from the current time. configure-goal accepts any finite positive --quota-window-hours, and a registry can carry any number, so a value of 1e8 hours or more makes the subtraction raise OverflowError (and 1e12 overflows the timedelta itself). collect_history evaluates every registered Goal in one pass, so one Goal with such a window made `status` and every quota read fail for the whole registry, including Goals with a normal 24 hour window. An unrepresentably long window covers every representable event, so the window start is now the earliest datetime in the current time's zone. The Goal keeps its configured window_hours and still counts all of its spends. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: duang777 <duangjl007@gmail.com>
Duang777
requested review from
huangruiteng,
loopx-agent and
songoow
as code owners
November 13, 2026 09:45
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Goal And Delivered Outcome
goal_quota_with_spend_ledgerinloopx/quota.pycomputedcurrent_time - timedelta(hours=int(window_hours))with no overflow handling.configure-goal --quota-window-hoursaccepts any finite positive number and a registry can hold any number.collect_historyevaluates every registered goal in one pass.window_hoursof 1e8 or more raisedOverflowError(date value out of range, or fromtimedeltaitself at 1e12), andcollect_historyfailed for the whole registry including goals with a 24-hour window. After: such a window covers all history, the goal keeps its configured window and counts all of its spends, and the other goals are unaffected. Rows:regression_parity,unit.mainat7bb1b01.Author Declaration
Implemented against
goal_quota_with_spend_ledgerinloopx/quota.pytests/control_plane/test_quota_rolling_window_projection.py::test_unrepresentable_window_covers_all_history_without_crashingScope And Continuation
--quota-window-hours.Validation
b0d57936c2eb202f0697777fa04e07ac3200ab15for the diff; local runs used a working tree whose touched files were blob-identical tomain7bb1b01before the change.regression_paritypassed10**8,10**12and1e12, fails 3 of 6 cases on the unfixed code and passes with the fix.unitpassedtest_quota_ledger_integrity.py,test_quota_paused_precedence.pyandtest_quota_plan_policy.py: 62 passed;ruff checkclean.configure_goalcould not be driven end to end on the local tree, so the repro went throughcollect_historyand a hand-written registry.Frontend / Visual Evidence
Type of Change
LoopX Area
Technical Direction
Shared-authority RFC fixture impact
N/A
Boundary Checklist
.loopx/,.codex/goals/, and liveACTIVE_GOAL_STATE.md).none.Signed-off-bytrailer (git commit -s).🤖 Generated with Claude Code