Repository navigation
feat(collector): add quota-warmup task script for Antigravity and Codex - #74
Merged
Merged
Conversation
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.
背景与问题
Antigravity(各实例的 Gemini 池与 Claude/GPT 第三方池)以及 Codex 的 7 天周窗口与 5 小时窗口,均在上一周期到期后的第一笔实际请求时才起算新周期。如果窗口在睡眠或闲置期间到期,直到手动发起对话才开窗,新周期的重置时间就会向后顺延。
变更内容
scripts/quota-warmup.ts采集器额外任务脚本:antigravity-cli与同级antigravity-cli-<name>额外实例)对应的~/.cache/agy-statusline/quota-<label>.tsv,以及~/.codex/sessions中最新openai通道的codex额度快照。平时仅做本地只读检查,不发起任何探测请求。gemini_weekly、3p_weekly、seven-day)预热;传入--include-5h(或METERLEAF_WARMUP_5H=1)时一并支持 5 小时窗口(gemini_5h、3p_5h、five-hour)。ok、hi、hey、ping、hello、yo、ack、ready)中随机选取一条,并使用该池最廉价的模型发起单轮最小请求:gemini-3.8-flash-low,随后调用agy -p /usage --output-format json立即将新周期resetsAt写回状态栏缓存。gpt-oss-120b-medium(失败时回退claude-sonnet-5-5-low),随后调用agy -p /usage刷新缓存。codex exec(固定model_provider="openai"、model="gpt-6-luna"、model_reasoning_effort="low"、mcp_servers={}),生成的会话文件由下一轮采集器sync自动读取新周期额度。$METERLEAF_TASK_STATE_DIR/state.json记录已预热的(target, resetEpoch)保证每个到期周期只触发一次;遇到网络断开或命令失败时按 15 分钟冷却退避;机器睡眠唤醒后随下一次sync自动补做预热。tests/quota-warmup.test.ts覆盖双 Antigravity 账户 + Codex 周重置预热、可选 5h 预热与模型回退、睡眠唤醒补跑与失败退避;在docs/collector.md补充配置说明。验证证据
bun test(全量 624 项测试通过)与bun run typecheck通过。~/.local/bin/meterleaf-quota-warmup并登记到meterleaf-collector tasks(每 5 分钟运行一次),实测--dry-run与tasks run quota-warmup正常识别phronara、tidewren与Codex。