Repository navigation
U6 選ぶ順の組と替えるかの判断(#3604 #3864) - #4039
Draft
takemi-ohama wants to merge 2 commits into
Draft
takemi-ohama wants to merge 2 commits into
takemi-ohama wants to merge 2 commits into
Conversation
受け入れ条件 3864:4(カットポイント)・3864:5(判断)・I12(判断)を縛るテストと、 observe.tool_pending・turn_done のテスト。Usage の窓ごとの形に合わせて既存のテストの期待値を直す。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KYHP7z4QjHh8vkcxvdbGUP
account_decide に Guards・group・order・guard・after_auth を足し、Usage を窓ごとの値の形へ、 before_limit・after_limit を候補と閾値 A・B・C を受ける形へ変える。accounts.usages は窓ごとの値を返す。 observe に tool_pending・turn_done を足す。ラッパーと CLI は呼び方をシグネチャに合わせるだけ。 limits.json に relay.five-hour-guard・relay.weekly-prefer・relay.weekly-guard を足し、relay.usage-guard を消す。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KYHP7z4QjHh8vkcxvdbGUP
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.
概要
実装の単位 U6「選ぶ順の組と替えるかの判断」(実装計画の Task 10)。
account_decide.py:Guards・group・order・guard・after_authを足し、Usage・before_limit・after_limitを変えるaccounts.usages:Usageを窓ごとの値(5 時間・7 日の使用率と 7 日のリセットの時刻)で返すobserve.py:tool_pending・turn_doneを足すwrapper.py・cli.py: 判断の関数の呼び方をシグネチャに合わせる(見回りの配線は U9)contracts/limits.json:relay.five-hour-guard・relay.weekly-prefer・relay.weekly-guardを足し、relay.usage-guardを消す満たす受け入れ条件: 3864:4(カットポイント)・3864:5(判断)・I12(判断)
実装の中で決めたこと
account_choice.candidates)は U8、従量の接続の候補(fallbacks)は U11a が渡す。それまでラッパーは、読めた使用率の行の名前をcandidatesに、空の一覧をfallbacksに渡す(_on_switch・_limit_pick)。閾値はSettings.usage_thresholdをSettings.guards(account_decide.Guards)に替え、cli.pyがlimits.jsonの 3 つから作るusage.json): ラッパーの今の呼び手のために残る読みの_usageも、新しい形の欄(five・seven・seven_resets_at。無ければ None)を読む。U9 で消えるfallbacksの「今の種類を除く」: 今の起動先と同じ名前を除くと読んだ(key:k1の失敗でkey:k2へ替える設計の例と合う)seven_day(過ぎていれば 0%)と、過ぎていないモデル別のスロットの最大の、大きいほう。どちらも無ければ None。seven_resets_atはseven_dayが過ぎていなければその時刻、それ以外は Noneorderの並びの欠けた値: 7 日のリセットの時刻・7 日の使用率が分からないものは、それぞれの比べで後に置くturn_doneの時刻: 記録のtimestamp(ISO)を Unix 秒にする。読めなければ(True, None)tool_pendingにassistantの記録が 1 つも無いとき: 「記録が無い」として None を返すUsageの形の変更に合わせて期待値を直した。3 つのアカウントで替えが回るテスト(test_i15_short_switches_to_first_time_accounts_are_not_counted)は、_bestの「最も空いたもの」の順を使っていたので、選ぶ順の組で同じ順(main → gmail → team)になる使用率に替えたtests/domains/relay/test_relay_observe.pyに分けた差分の行数: 16 files changed, 506 insertions(+), 102 deletions(-)(
uv.lock・env.mdを除く)テスト
テストは CI で走らせる(
.ndf/project.jsonのtest.ci.only)。先に push したテストだけのコミット: e12d36d。実装のコミット: 4a24d2a関連: #3604 #3864
🤖 Generated with Claude Code
https://claude.ai/code/session_01KYHP7z4QjHh8vkcxvdbGUP