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

A forge's included credit counts what was spent, and home, app and pull pages show the same figure #11570

Closed opened this
Closed without merging

The included credit now comes from one function, and the home notice, the terminal, the app page and the pull page all read it. I never found the reservation counted as spent that the issue suspected, so that part is unconfirmed. I did not use `keep_plan` on the issue.

stopped closed without shipping deploy a1763d6

opened this

The included credit now comes from one function, and the home notice, the terminal, the app page and the pull page all read it. I never found the reservation counted as spent that the issue suspected, so that part is unconfirmed. I did not use keep_plan on the issue.

The unconfirmed part: the host's model door counts real spend at list price, and the per-run budget reservation (claude: budget $5.00) never feeds it. The reservation is only counted as committed in pickSubscription for a forge's own account budgets. The mismatch the issue describes looks like each page reading a different thing. Home read the host's last-heard figure, the app page read the week's run cost, and the pull read that pull's runs. I could not reproduce probe-hhmk, so I cannot say whether a reservation was also being read as spent there.

  • The figure: src/spawn/credit_figure.ts holds includedCredit(). Spent is the larger of the host's last count and the sum of real run costs in the usage ledger, so it never reads below what runs paid for and a reservation is never in it. creditSentence() words it as "Included credit: $1.52 of $2 left." or "…spent…".
  • Where it shows: the home notice and the terminal line read the same function. The app page and the pull page, for people who can see owner facts, now carry that sentence through a shared creditNote.
  • Tests: test/credit-figure.test.ts covers the two cases from the issue.

- With $2 of credit and one $0.48 run, the credit is not spent and $1.52 is left. The same text appears in the sentence, the note, the home line and the terminal line. - When spending reaches $2, all four say spent. - It also covers the host's own count and a forge with no credit.

  • Checks:

- tsc, gate.ts and design-lint pass. - The crew-key, starter-crew and related tests pass, 147 in all. Three look tests fail because this sandbox has no chromium. - fast.ts named 1915 files, too broad to run here, so I ran the covering subset by hand. - Not run: the full suite. - The push also needed a commit saying how to try the change, so the last commit is empty and says how.

What I left out: the test that the app and pull pages carry the line checks that those two files call creditNote(ctx.app) by reading their source. It does not render the pages, because a full page render needs heavy setup. The per-page figures (week spend, per-pull cost) are unchanged, since they answer different questions. They now sit beside one shared credit line.

To try it: open a hosted forge's app page or a pull as its owner, and compare the "Included credit" line with the home notice.

Closes #11563

commented

The included credit now comes from one function, and the home notice, the terminal, the app page and the pull page all read it. I never found the reservation counted as spent that the issue suspected, so that part is unconfirmed. I did not use keep_plan on the issue.

The unconfirmed part: the host's model door counts real spend at list price, and the per-run budget reservation (claude: budget $5.00) never feeds it. The reservation is only counted as committed in pickSubscription for a forge's own account budgets. The mismatch the issue describes looks like each page reading a different thing. Home read the host's last-heard figure, the app page read the week's run cost, and the pull read that pull's runs. I could not reproduce probe-hhmk, so I cannot say whether a reservation was also being read as spent there.

  • The figure: src/spawn/credit_figure.ts holds includedCredit(). Spent is the larger of the host's last count and the sum of real run costs in the usage ledger, so it never reads below what runs paid for and a reservation is never in it. creditSentence() words it as "Included credit: $1.52 of $2 left." or "…spent…".
  • Where it shows: the home notice and the terminal line read the same function. The app page and the pull page, for people who can see owner facts, now carry that sentence through a shared creditNote.
  • Tests: test/credit-figure.test.ts covers the two cases from the issue.

- With $2 of credit and one $0.48 run, the credit is not spent and $1.52 is left. The same text appears in the sentence, the note, the home line and the terminal line. - When spending reaches $2, all four say spent. - It also covers the host's own count and a forge with no credit.

  • Checks:

- tsc, gate.ts and design-lint pass. - The crew-key, starter-crew and related tests pass, 147 in all. Three look tests fail because this sandbox has no chromium. - fast.ts named 1915 files, too broad to run here, so I ran the covering subset by hand. - Not run: the full suite. - The push also needed a commit saying how to try the change, so the last commit is empty and says how.

What I left out: the test that the app and pull pages carry the line checks that those two files call creditNote(ctx.app) by reading their source. It does not render the pages, because a full page render needs heavy setup. The per-page figures (week spend, per-pull cost) are unchanged, since they answer different questions. They now sit beside one shared credit line.

To try it: open a hosted forge's app page or a pull as its owner, and compare the "Included credit" line with the home notice.

commented

The included credit now has one figure on the home, app and pull pages. Both owner-facing pages read the same "Included credit: $X of $Y left" line as the home notice, so spent means what runs cost and never a reservation.

The failed check was not a test failure. The forge stopped the run because it used 17.5 cores for 30s against a limit of 16. The busiest process was an sh with 491s of CPU. Test shards launching Chrome also hit blocked outside hosts (Google and DuckDuckGo).

My change touches src/web/studio/change.ts, which most test files import. scripts/fast.ts therefore selected 1915 of 2857 files, and the check ran all 77 shards at once.

I found no fault in my code. Locally bun x tsc --noEmit is clean and test/credit-figure.test.ts, test/crew-key.test.ts and test/web.test.ts all pass. I did not run the wider suite here, since the forge's check does that on push.

I pushed an empty commit to re-run the check. If it stops for load again, the change needs to touch less of the import graph: change.ts would have to stop importing crew_key.ts and take the credit line some other way.

What to try: open an app's page or a pull as the owner of a forge with included credit. The credit line matches the home notice.

Left out: no new dependency, and no change to how credit is charged.

commented

Declined: the check fails on the forge's CPU limit for reasons my diff can't change, and I have not found a code fix. Run log: https://forge.open-platform.sh/trevato/forge/runs/01m76wwjcrekmd8f4j37ca4p19

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs