Public: anyone can read this; the crew can change it.

Pacing decides from the provider's measured percent left, and concurrency goes back to its ceiling #8983

Parked opened this
Closed without merging

The weekly pacer now decides from the percent of the week the provider says is used, set against the share of the week's time gone. I have not restored crew.concurrency, because the repository never lowered it and I can't reach the live setting.

Notes

stopped parked by the crew

opened this

The weekly pacer now decides from the percent of the week the provider says is used, set against the share of the week's time gone. I have not restored crew.concurrency, because the repository never lowered it and I can't reach the live setting. The week-pace tests, the new measure tests, bun scripts/gate.ts and tsc --noEmit pass. The forge's full check hasn't run yet, and I did not try it against a real Claude session.

What changed

  • Reading the measure: src/core/measure.ts reads the percent used, and when it resets, from Claude Code's rate_limit_event records. The runner stores the newest one per subscription and window in a new table, subscription_measure, added by an additive migration with its pin.
  • No dollar inference: src/crew/week_read.ts builds the week meter from those measures, with no inferred dollar cap. The usage tool's headroom percent takes the same measure first, so home and usage agree.
  • Holding: with no measure, or one whose week has already reset, the pacer says the pace is unknown and holds the crew at a modest level (2 of 4 slots in the tests). It is never off.
  • The sentence: it now also says how much of the week's time is gone, for example "80% of the week left with 50% of its time gone".
  • Burn: it is the fall in the measured percent between successive readings, so a meter that has not moved reads 0% an hour.

Tests

  • A week that fell 8 points over 3 hours cuts the picks below 4 slots and reads 2.7% an hour. The same measure, flat over those 3 hours, keeps all 4 slots and reads 0% an hour (test/week-wiring.test.ts).
  • test/measure.test.ts covers reading the event, rejecting malformed ones, replacement, expiry after reset, and ignoring unknown subscriptions.
  • I rewrote the existing week-wiring and week-pump tests to seed measures instead of dollar spend, because their old setup no longer feeds the pacer. These tests were wrong for the new behaviour, not the code.

The concurrency item is not done

  • Nothing in the repository lowers it. The chart sets crewConcurrency: 5, and the capacity.ts default is sized from the pod's memory. If it was lowered, that was a live capacity setting in the store.
  • An admin has to reset it to the default through capacity (empty value).
  • docs/CREW.md notes that pacing, not concurrency, is what slows the crew now.

Assumptions to check

  • I assumed the event's shape: rate_limit_info with rateLimitType (five_hour or seven_day), resetsAt in unix seconds, and utilization as a fraction from 0 to 1. This is documented in the comment on measureOf. If the real field names differ, no measure is stored, and the pacer reports "unknown" and holds.
  • I read "subscription_headroom" as the provider-reported figure, and not the subscription_headroom tool. That tool sets the share kept for people, which the pacer still reads as the reserve.

Try it Run bun test test/measure.test.ts test/week-wiring.test.ts test/week-pump.test.ts.

Closes #8960

3 earlier comments · 1 event
commented

The weekly pacer now decides from the percent of the week the provider says is used, set against the share of the week's time gone. I have not restored crew.concurrency, because the repository never lowered it and I can't reach the live setting. The week-pace tests, the new measure tests, bun scripts/gate.ts and tsc --noEmit pass. The forge's full check hasn't run yet, and I did not try it against a real Claude session.

What changed

  • Reading the measure: src/core/measure.ts reads the percent used, and when it resets, from Claude Code's rate_limit_event records. The runner stores the newest one per subscription and window in a new table, subscription_measure, added by an additive migration with its pin.
  • No dollar inference: src/crew/week_read.ts builds the week meter from those measures, with no inferred dollar cap. The usage tool's headroom percent takes the same measure first, so home and usage agree.
  • Holding: with no measure, or one whose week has already reset, the pacer says the pace is unknown and holds the crew at a modest level (2 of 4 slots in the tests). It is never off.
  • The sentence: it now also says how much of the week's time is gone, for example "80% of the week left with 50% of its time gone".
  • Burn: it is the fall in the measured percent between successive readings, so a meter that has not moved reads 0% an hour.

Tests

  • A week that fell 8 points over 3 hours cuts the picks below 4 slots and reads 2.7% an hour. The same measure, flat over those 3 hours, keeps all 4 slots and reads 0% an hour (test/week-wiring.test.ts).
  • test/measure.test.ts covers reading the event, rejecting malformed ones, replacement, expiry after reset, and ignoring unknown subscriptions.
  • I rewrote the existing week-wiring and week-pump tests to seed measures instead of dollar spend, because their old setup no longer feeds the pacer. These tests were wrong for the new behaviour, not the code.

The concurrency item is not done

  • Nothing in the repository lowers it. The chart sets crewConcurrency: 5, and the capacity.ts default is sized from the pod's memory. If it was lowered, that was a live capacity setting in the store.
  • An admin has to reset it to the default through capacity (empty value).
  • docs/CREW.md notes that pacing, not concurrency, is what slows the crew now.

Assumptions to check

  • I assumed the event's shape: rate_limit_info with rateLimitType (five_hour or seven_day), resetsAt in unix seconds, and utilization as a fraction from 0 to 1. This is documented in the comment on measureOf. If the real field names differ, no measure is stored, and the pacer reports "unknown" and holds.
  • I read "subscription_headroom" as the provider-reported figure, and not the subscription_headroom tool. That tool sets the share kept for people, which the pacer still reads as the reserve.

Try it Run bun test test/measure.test.ts test/week-wiring.test.ts test/week-pump.test.ts.

commented

The check failed because no commit message on the pull had a Try: line, and the gate requires one when src/actions/usage.ts changes. I added an empty commit whose message carries that line, so no code changed. I pushed it, and bun scripts/gate.ts passes locally. I haven't seen the forge's re-run yet.

The pull itself is unchanged except for that commit.

The weekly pacer now decides from the percent of the week the provider reports as used. It sets that against the share of the week's time gone, with no inferred dollar cap. With no measurement, the sentence says the pace is unknown and the crew holds at a modest level. Burn per hour comes from successive measurements, so a meter that hasn't moved reads 0%/h.

The new tests cover the issue's case. A week that fell 8 points over 3 hours cuts the picks below 4 slots, and a flat meter keeps all 4. They are in test/week-wiring.test.ts and test/measure.test.ts.

crew.concurrency is not restored. The repository never lowered it (the chart sets 5), so if it was lowered, the change is a live setting that an admin has to reset through capacity with an empty value.

I assumed the shape of Claude Code's rate_limit_event (rateLimitType, resetsAt in unix seconds, utilization as a fraction of the limit). I haven't confirmed it against a real session. If the field names differ, no measure is stored and the pacer reports "unknown" and holds.

Try it: open the preview's home page and read the week line. It names the percent left and the share of the week gone, or says the pace is unknown. Or call the usage tool and read the week headroom.

the crew's run was interrupted: restart, resumes on the next pass — cancelled
commented

This push fixes the nine tests the check failed. I haven't seen the forge's check run on it yet.

Cause: pacing now decides from the provider's measured share of the week. A fresh test forge has no week measured, so pacing held the crew at the unknown-week level and the slot-based tests couldn't start their runs.

Fix: a new test helper, test/helpers/week-quiet.ts, records a measured week whose reset is more than a week away. Pacing then has nothing to say and the crew keeps its slots. Six test files that are about something other than pacing now call it after creating the app. The product code is unchanged.

What I ran:

  • The six edited test files pass locally: 44 tests, 0 failures. That includes the nine that failed, which are in crew-small-share, finishing-room, crew-held, ledger, tui-crawlers and crew-governed-unit.
  • bun x tsc --noEmit printed nothing.
  • scripts/gate.ts printed nothing, but I didn't read its exit code, so I can't say it passed.
  • I didn't run the full suite.
commented

Parked by the crew: the check stayed red through 2 automatic tries

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs