已关闭
[MVP-06] Implement the scheduler, leases and subscription quota ledger #9
urandon创建于  7月28日关闭于  7月30日
urandon
urandon成员
7月28日 创建

Parent and architecture

  • Implementation epic: #6
  • Architecture: #1
  • Depends on: #4, #5, #16

Outcome

Provide deterministic admission, fairness, leasing and quota accounting for user-owned AI subscriptions without API-billing fallback.

Estimate

  • 8 SP / 5 engineering days
  • Risk: high

Scope

  • Implement product limits for per-tenant queue depth, active runs, runtime, turns, input/context size and artifacts.
  • Enforce one active run per subscription connection in MVP.
  • Implement READY, PRESSURED, DRAINING, BLOCKED_UNTIL_RESET and REAUTH_REQUIRED states.
  • Implement atomic reservation, commit, release and expiry of internal quota.
  • Store provider-native rate-limit buckets/windows/reset times when exposed.
  • Store locally measured tokens/turns/wall time separately with confidence classification: provider_reported, locally_measured, unknown.
  • Implement conditional run claim, lease renewal, cancellation and abandoned-run recovery.
  • Implement reconciler operations for unsent outboxes, expired leases/reservations and DLQ/manual retry against the bounded ready/expiry topology established in #16.
  • Add admin-safe aggregate/read models without credential or prompt disclosure.

Policies

  • No cross-user credential pooling or quota balancing.
  • No silent API-key execution or paid-overage path.
  • Unknown remaining subscription quota remains unknown; observed throttles may set cooldown/reset state.
  • Retried worker attempts must not double-charge internal quota.

Acceptance criteria

  • State-transition and time-boundary tests use an injected clock.
  • Concurrent claims for one run/subscription produce one active lease.
  • Quota exhaustion queues/blocks predictably and exposes reset time when known.
  • Cancellation/expiry releases or expires reservations safely.
  • Scheduler decisions and usage events are auditable and tenant-scoped.
  • Reconciliation is idempotent under duplicate timer invocations.
  • Ready/expiry traversal uses bounded partition fan-out and never falls back to an unbounded tenant or table scan.
likedislike
urandonurandon成员
7月29日 修改了issue 的描述
urandonurandon成员
7月30日 关联了pull request:MVP-06: add subscription-aware scheduler admission and dispatch
urandon
urandon成员
7月30日 评论:

Implementation update — scheduler admission and durable dispatch

The first coherent MVP-06 slice is published in MR !11, branch ai/mvp-06-scheduler-quota, commit 25c5276.

It adds the one-subscription contention slot, tenant scheduler counters, atomic quota reservation/admission, deterministic payload-free dispatch publication, bounded 16-bucket quota expiry, and a real reconciler process. Public documentation and local/YDB integration coverage are included.

Local make ci, tagged compile gates, shell validation, Compose YAML parsing, and git diff --check pass. Real YDB Local, Compose, and queue behavior are intentionally left for the mirrored GitHub Actions jobs because Docker is unavailable on the development workstation.

This does not close #9. Remaining MVP-06 work: lease claim/recovery integration, cancellation, provider quota/entitlement observations and usage confidence, reservation commit/release at worker completion, and admin-safe aggregates.

likedislike
urandon
urandon成员
7月30日 评论:

Verification update — partition-contract CI fix

GitHub Actions run 30478731808 failed because the two new scheduler migrations requested a 16-partition floor while the architecture contract classifies those tables as tenant-first point tables with a one-partition floor.

Commit 68b7f53 aligns subscription_scheduler_slots and tenant_scheduler_counters with that contract. Load- and size-based YDB auto-partitioning remain enabled, so the tables can split as traffic grows without preallocating global-bucket capacity. A regression test now locks this distinction in place.

All local verification and both tagged integration compile gates pass. MVP-06 remains open until the mirrored GitHub workflow applies the corrected migrations and validates the resulting settings against a clean YDB Local instance.

likedislike
urandonurandon成员
7月30日 关闭了 issue
urandonurandon成员
22 天前 添加了label:mvpscheduler
urandonurandon成员
22 天前 关联了里程碑:MVP — Core platform (#6)