Skip to content

v0.2.20

Choose a tag to compare

@Phantivia Phantivia released this 30 Nov 23:22

The usage chart can be split by World, the console's cost-today figure no longer rescans the whole usage ledger on every model call, the run log keeps retries that failed with different errors apart, and Cormini no longer exits when a workspace subtree holds more than about 120,000 files.

Changes for extension authors

  • /api/usage: each bucket of series carries byWorld, keyed by World id, and unattributed, with the same attribution rules as the range-wide byWorld; the parts of a bucket add up to the bucket and one World's parts across the buckets add up to its byWorld row. byWorldModel[world][model] and unattributedByModel[model] cross them with the model. unattributed and unattributedByModel are omitted in a bucket that has no unattributed part. UsageSeriesPoint in cortico/core/cost.ts has the same four fields; code that builds one itself has to add byWorld and byWorldModel (thanks @kwk1001, #454).
  • usageRecordRange(opts) in cortico/core/cost.ts returns the two instants usageRecordFilter filters by, and UsageLog.readRange({ sinceMs, untilMs }) returns the records from sinceMs on, from memory after its first call (#465).
  • Run-log folding groups by the error text as well as by area and event or message: record.err.message, or a string err or error field in data, with digits replaced by # and cut to 80 characters. Warnings and errors that share a message and differ in the error are each written. Incident snapshots under incidents/ use the same key, so errors with different texts each get a snapshot (#464).

Core

  • A request for today's usage without dailyTokenDays, which is what the console's cost-today figure sends when the page opens and after every main-loop model call, is answered from memory. The first such request after a start scans usage.jsonl once and keeps the records from the start of today's range; later appends are added to them, the range moves forward at midnight, and requests that arrive together share that one scan. Before, every request read the whole ledger. On a 448 MiB ledger with three console pages open, a repeated request took about 5.4 s and delayed messages from child processes by about 3.2 s at the 95th percentile; it now takes 14 ms and delays them by at most 14 ms. The first request after a start still takes the time of one scan, 1.65 s on that ledger. The usage page sends dailyTokenDays and still reads the whole ledger on each request. Editing usage.jsonl from outside while the process runs is not reflected in the cost-today figure until a restart; clearing it from the storage page is (thanks @milan-fu for the reports and the reproduction script, #459 and #421, #465).
  • The run log no longer folds retries with different errors into one line. Provider attempt failed; retrying is logged with the same message for every failed attempt, so a round whose attempts failed with LLM API 550 and with fetch failed (ECONNRESET: read ECONNRESET) left only the first one in the log, and the summary line at the end of the 30-second window repeated the first one's error. Errors that differ only in digits, such as LLM API 550 and LLM API 502, still fold together (thanks @bikaqiumiao for the log in Pal-AI-Lab/Coopanion#857, #464).

WebUI

  • The usage chart has a World split beside type, purpose and model, with Unattributed as its last segment. It combines with type and model. World and purpose exclude each other: pressing one releases the other. With the calls metric the World split is disabled, as the type split is, because one request counts for every World that got a share of it (thanks @kwk1001, #454).
  • When a split has more keys than the chart palette has colors (8), the 7 largest by the current metric each keep a segment and the rest are merged into one N others segment. Hovering its legend entry lists the merged keys, and the tooltip lists each of them under the merged row. This applies to the purpose and model splits too, which used to reuse colors past the eighth key (thanks @kwk1001, #454).
  • A key's chart color is picked from a hash of its name instead of its position in the sorted keys, so adding or removing a key no longer recolors every key after it. The colors of existing charts change once with this version (thanks @kwk1001, #454).

Bots

  • Cormini: listing the workspace no longer throws RangeError: Maximum call stack size exceeded when one subtree holds more than about 120,000 files, such as a node_modules tree inside a project in the workspace. The error came while building the system prefix, the main loop exited, and it exited again at every later rebuild (#458).