Skip to content

design(id): two-level metering — burst bucket + hard per-tick ceiling, per function (#6001) - #8104

Merged
dezren39 merged 1 commit into
mainfrom
queue/14433-6001-two-level-metering
Nov 10, 2026
Merged

dezren39 merged 1 commit into
mainfrom
queue/14433-6001-two-level-metering

Conversation

@dezren39

@dezren39 dezren39 commented Nov 10, 2026 •

Copy link
Copy Markdown
Member

Closes #6001.

The two-level metering design the mapping design (#5967) can implement against:

  • Screeps mapped term-by-term (§2): CPU limit → per-binding refill, bucket → capped per-binding fuel balance, burst draw → bucket draw bounded separately by a hard tick_ceiling, Game.cpu.getUsed() → the self-observation reads, per-account → per-function with the world ceiling composing above both levels.
  • Accounting shape (§3): credit/debit algorithm in mapping order — credit on tick boundaries only, world admission before bucket admission, store fuel set to min(tick_ceiling, bucket_balance, world_remaining), actual consumption (incl. host charges, one currency) debited, full state reproducible from the tick log.
  • Self-observation API (§4): getUsed() / getBucket() / getCeiling() with honest-read semantics (exact at charge points, constant published charge, never outcome-changing) — the primitive id: design: cooperative timeout contract — deadline passing, checkpoint convention, hard-kill semantics #6002's cooperative contract and userland schedulers build on.
  • Configuration (§5): all three parameters are world-author config under server caps stated as relations; numeric defaults are TBD pending id: research: per-function gas metering, timeouts, and the multithreading question for user functions #5966 §6 calibration — no policy numbers invented.
  • One new outcome row (§7): bucket-exhausted as a throttle (skip, no strike), distinct from the fuel-exhausted hard termination.
  • Holes hunted (§8: function splitting, churn/idle farming, ceiling laundering, replay divergence) and invariants with named oracles (§9), per the C4 pillar doctrine on id: research: per-function gas metering, timeouts, and the multithreading question for user functions #5966.

Docs only; no code. Indexed in doc/README.md and planning/architecture/README.md, following the #5962 record's pattern (PR #7977).

Task 14433, lane code-p (direct execution-lane assignment).


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

@dezren39
dezren39 requested a review from a team as a code owner November 10, 2026 03:06
@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-10T03:06:11.063209Z
We couldn’t complete this review. Comment @codex review to try again.
00c322a PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai

coderabbitai Bot commented Nov 10, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 38 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: ef084b23-d231-4fdc-ad33-a3fcaa33b18e
Commits

Reviewing files that changed from the base of the PR and between 321ae7e and 00c322a.

Files selected for processing: 3

  • doc/2026-11-10T03-10-00Z_design_id_two_level_metering/2026-11-10T03-10-00Z_design_id_two_level_metering.md
  • doc/README.md
  • planning/architecture/README.md
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@dezren39

Copy link
Copy Markdown
Member Author

🤖 Agent note · merge disposition (task 14433, lane code-p)

Codex findings gate: the Codex review on this PR failed to run — the connector reports Codex usage limits reached for code reviews (comment on this PR, 2026-11-10T03:06Z); it produced no findings. CodeRabbit likewise reports its free review limit reached. There are no undispositioned review findings: neither reviewer emitted any. Docs-only change (design record + two index lines), diff verified against issue #6001's deliverable; merging under the standing criteria.

@dezren39
dezren39 merged commit 069f37b into main Nov 10, 2026
2 of 5 checks passed
@dezren39
dezren39 deleted the queue/14433-6001-two-level-metering branch November 10, 2026 03:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

id: design: two-level metering — burst bucket + hard per-tick ceiling, adapted to per-function accounting

1 participant