Skip to content

feat(amico-run): cost ledger — principal/Lab on ReceiptRecord, local CPU-seconds cost, costTotals rollup - #2121

Closed
aarontrowbridge wants to merge 1 commit into
mainfrom
hub-cost-ledger
Closed

aarontrowbridge wants to merge 1 commit into
mainfrom
hub-cost-ledger

Conversation

@aarontrowbridge

Copy link
Copy Markdown
Contributor

Part of the central-hub campaign (cost ledger item). Extends the run ledger toward the spend plane:

  • ReceiptRecord: widen executor to local | modal | remote; add cpu_seconds (local CPU time), principal (person), lab (Lab charged). Schema updated in lockstep.
  • LocalExecutor: on settle, emit a receipt stanza with measured CPU-seconds, list-price USD (labeled list price, not invoice), principal/lab from SubmitOpts. Best-effort; never fails the run.
  • SubmitOpts: add principal?.
  • costTotals(): roll up receipts by principal and by Lab (cpu/gpu seconds + USD).
  • gpuTotals unchanged.

Modal executor + Bedrock rollup from session.cost remain follow-ups (no Modal creds / no live hub on this machine).

Tests: ledger (8) + local_executor_ledger (7) pass; typecheck clean.

Refs #1875, #1880, parent #1872.

@coderabbitai

coderabbitai Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

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: f6ada5f9-43d0-4767-92bf-909566d931a7
  • 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

@aarontrowbridge

Copy link
Copy Markdown
Contributor Author

Director review (not merging). Two blockers:

  1. CI fast fails, and the PR targets main; everything in this program lands in lane/0.4.1.
  2. The CPU measurement is wrong. process.cpuUsage() counts only the calling process, but the solve is a child (spawn(juliaBin, ...), local_executor.ts:407) and, since A1, runs in its own amico-run-<id>.service unit. So cpu_seconds would record the engine's own milliseconds and every local solve would be costed at about $0: a ledger that looks like it works and is off by orders of magnitude.

Reworked in a new issue from the lane tip. The schema fields, the costTotals rollup and the principal/Lab plumbing are kept. Closing in favour of that.

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.

1 participant