Skip to content

feat(quota-planner): add phase-aware routing planner#737

Closed
Komzpa wants to merge 14 commits into
Soju06:mainfrom
Komzpa:feature/quota-phase-planner
Closed

feat(quota-planner): add phase-aware routing planner#737
Komzpa wants to merge 14 commits into
Soju06:mainfrom
Komzpa:feature/quota-phase-planner

Conversation

@Komzpa
Copy link
Copy Markdown
Collaborator

@Komzpa Komzpa commented May 20, 2026

Summary

  • add quota planner settings, decision log, window observations, request_kind accounting, scheduler, and dashboard APIs
  • enable safe shadow planning by default: dry-run, no synthetic traffic, soft routing costs only, and test lifespan disables the background scheduler explicitly
  • add deterministic demand forecast/simulation, phase-aware routing costs, reserve/warmup decisions, frontend settings/forecast/decision UI, and docs
  • add a gated warmup actuator with admin warm-now/cancel, normal request logging, optional API-key reservation/finalization, warmup effect observations, budgets, and best-effort effect refresh
  • extend warmup planning beyond “once per cycle”: candidate starts now target demand peaks, work-block offsets, demand/capacity crossings, and active-reset spacing; flat/low-demand cycles produce auditable no-op rows instead of starting cold accounts
  • expose target peak, scheduled time, expected gain/cost, no-op/skip reason, and warmup_cycle details through the API/UI decision timeline

Verification

  • make lint
  • make typecheck
  • uv run pytest tests/unit/test_quota_planner.py tests/integration/test_quota_planner_api.py tests/unit/test_request_logs_repository.py tests/test_request_logs_options_api.py (24 passed)
  • cd frontend && bun run lint
  • cd frontend && bun run typecheck
  • cd frontend && bun run test:coverage (73 files / 420 tests)
  • temp SQLite uv run codex-lb-db upgrade head && uv run codex-lb-db check
  • rg -n "peak|stagger|warmup_cycle|no_op|warmup_probe|request_kind.*warmup|QuotaWarmupService" app/modules/quota_planner tests docs frontend/src/features/quota-planner

Notes

  • Synthetic warmup traffic remains gated off by default and is not emitted unless auto/synthetic/dry-run/budget/effect checks all allow it. The default path is non-blocking and degrades to normal routing when planner inputs are missing or stale.
  • Warmup failures return auditable skipped/failed decisions; usage-effect refresh is best-effort so it cannot turn a handled probe result into a stuck planned decision.
  • feat(automations): scheduled cycles, grouped runs, and run details UI #438’s generic automation/job framework is not required for this feature: the scheduler/control loop owns quota phase decisions, while QuotaWarmupService remains the actuator and accounting path.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7d644996a7

ℹ️ 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".

Comment thread app/modules/proxy/repo_bundle.py Outdated
@Komzpa Komzpa force-pushed the feature/quota-phase-planner branch 3 times, most recently from 7302627 to d42aa27 Compare May 20, 2026 19:58
@Komzpa Komzpa force-pushed the feature/quota-phase-planner branch 2 times, most recently from 8a20570 to 42d238e Compare May 21, 2026 10:50
@Soju06
Copy link
Copy Markdown
Owner

Soju06 commented May 21, 2026

@codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 42d238eaa7

ℹ️ 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".

Comment thread app/modules/quota_planner/warmup.py
Comment thread app/modules/proxy/load_balancer.py Outdated
Comment thread openspec/specs/quota-phase-planner/context.md
@Soju06 Soju06 added the 🤖 codex: needs work [@codex review] raised an issue label May 21, 2026
@Komzpa Komzpa force-pushed the feature/quota-phase-planner branch from 42d238e to ad7fc13 Compare May 21, 2026 11:19
@Soju06
Copy link
Copy Markdown
Owner

Soju06 commented May 21, 2026

@codex review

@Komzpa Komzpa removed the 🤖 codex: needs work [@codex review] raised an issue label May 21, 2026
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ad7fc13370

ℹ️ 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".

Comment thread app/modules/quota_planner/scheduler.py Outdated
Comment thread app/modules/proxy/load_balancer.py Outdated
@Soju06 Soju06 added the 🤖 codex: needs work [@codex review] raised an issue label May 21, 2026
@Komzpa Komzpa force-pushed the feature/quota-phase-planner branch from ad7fc13 to ce54ff8 Compare May 21, 2026 12:15
@Soju06
Copy link
Copy Markdown
Owner

Soju06 commented May 21, 2026

@codex review

@Komzpa Komzpa removed the 🤖 codex: needs work [@codex review] raised an issue label May 21, 2026
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ce54ff8299

ℹ️ 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".

Comment thread app/modules/quota_planner/scheduler.py Outdated
Comment thread app/modules/quota_planner/logic.py Outdated
Comment thread app/modules/quota_planner/logic.py
@Soju06 Soju06 added the 🤖 codex: needs work [@codex review] raised an issue label May 21, 2026
@Komzpa Komzpa force-pushed the feature/quota-phase-planner branch from ce54ff8 to 5b01d3f Compare May 21, 2026 12:49
@Soju06
Copy link
Copy Markdown
Owner

Soju06 commented May 21, 2026

@codex review

@Komzpa Komzpa removed the 🤖 codex: needs work [@codex review] raised an issue label May 21, 2026
@Soju06 Soju06 added the 🤖 codex: needs work [@codex review] raised an issue label May 21, 2026
@Komzpa Komzpa removed the 🤖 codex: needs work [@codex review] raised an issue label May 21, 2026
@Soju06 Soju06 added the 🤖 codex: needs work [@codex review] raised an issue label May 21, 2026
@Komzpa Komzpa removed the 🤖 codex: needs work [@codex review] raised an issue label May 21, 2026
@Soju06 Soju06 added the 🤖 codex: needs work [@codex review] raised an issue label May 21, 2026
@Komzpa Komzpa removed the 🤖 codex: needs work [@codex review] raised an issue label May 21, 2026
@Soju06 Soju06 added the 🤖 codex: needs work [@codex review] raised an issue label Jun 1, 2026
@Soju06
Copy link
Copy Markdown
Owner

Soju06 commented Jun 1, 2026

@codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ead36b5b55

ℹ️ 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".

Comment thread app/modules/quota_planner/warmup.py Outdated
Comment thread app/modules/quota_planner/warmup.py
@Soju06
Copy link
Copy Markdown
Owner

Soju06 commented Jun 1, 2026

@codex review

@Komzpa Komzpa removed the 🤖 codex: needs work [@codex review] raised an issue label Jun 1, 2026
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b904927e5b

ℹ️ 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".

Comment thread app/modules/quota_planner/logic.py Outdated
Comment thread app/modules/quota_planner/warmup.py Outdated
@Soju06 Soju06 added 🤖 codex: needs work [@codex review] raised an issue and removed 🤖 codex: needs work [@codex review] raised an issue labels Jun 1, 2026
@Komzpa Komzpa force-pushed the feature/quota-phase-planner branch from edf291c to 88f6b2b Compare June 1, 2026 14:48
@Soju06
Copy link
Copy Markdown
Owner

Soju06 commented Jun 1, 2026

@codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 88f6b2bda9

ℹ️ 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".

Comment thread app/modules/quota_planner/logic.py Outdated
@Komzpa Komzpa added the 🤖 codex: needs work [@codex review] raised an issue label Jun 1, 2026
@Komzpa Komzpa force-pushed the feature/quota-phase-planner branch from 88f6b2b to 91f6a88 Compare June 1, 2026 15:15
@Soju06 Soju06 removed the 🤖 codex: needs work [@codex review] raised an issue label Jun 1, 2026
@Soju06
Copy link
Copy Markdown
Owner

Soju06 commented Jun 1, 2026

@codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 91f6a88c62

ℹ️ 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".

Comment thread app/core/balancer/logic.py
@Soju06 Soju06 added the 🤖 codex: needs work [@codex review] raised an issue label Jun 1, 2026
@Soju06 Soju06 removed the 🤖 codex: needs work [@codex review] raised an issue label Jun 1, 2026
@Soju06
Copy link
Copy Markdown
Owner

Soju06 commented Jun 1, 2026

@codex review

1 similar comment
@Komzpa
Copy link
Copy Markdown
Collaborator Author

Komzpa commented Jun 1, 2026

@codex review

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Can't wait for the next one!

ℹ️ 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".

@Soju06 Soju06 added the 🤖 codex: ok [@codex review] says no issues found. label Jun 1, 2026
@Komzpa
Copy link
Copy Markdown
Collaborator Author

Komzpa commented Jun 2, 2026

Folded into #716.

#716 is the surviving main-based routing/quota branch for this bucket. It includes the routing/quota changes from this PR, has current-head CI green, and has a clean current-head Codex review, so this separate PR can be closed to keep the queue reviewable.

@Komzpa Komzpa closed this Jun 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🤖 codex: ok [@codex review] says no issues found. db migration PR changes Alembic database migrations; maintainer must coordinate merge order

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants