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

Settings shows each model account's last day: runs, failures by cause, seconds #17902

opened this

Merged 21h 25m ago, live in production

Each account row in Settings → Subscriptions now shows its last day, and an account that fails too often says so. The new tests, the Subscriptions page and timing tests, the terminal screen tests and tsc pass.

Notes

opened this

Each account row in Settings → Subscriptions now shows its last day, and an account that fails too often says so. The new tests, the Subscriptions page and timing tests, the terminal screen tests and tsc pass. I did not run the full suite, and the dead-code test showed no output in my last run, so I'm not counting it as passed.

What changed

  • src/crew/account_day.ts (new): accountDays reads every account's day in one statement. It joins usage (outcome, wall_ms) to run (the failure text) over usage_at. It returns:
    • runs in the last 24 hours;
    • failures by cause (rate limit, auth, timeout, other), read off the run's error_line, else its summary;
    • median seconds;
    • whether more than five of the account's last ten runs failed.
  • src/web/pages/subscriptions.ts: each row gets a line such as 6 runs in 24 h · 4 failed (1 rate limit, 1 auth, 1 timeout, 1 other) · median 20 s. "failed over half of its last ten runs" sits beside its place in the order. Nothing is reordered, and it adds no script and no new CSS.
  • src/tui/screens/subscriptions.ts: the terminal screen shows the same line and note.
  • docs/features/crew-accounts.md: a new section describes the row.
  • test/account-day.test.ts: seeded runs, the exact row text on the rendered page, the flag on exactly one account, and a Proxy-counted query count of 1 for all accounts.

Reused: median from src/efficiency/baseline.ts.

Choices

  • The model-call log lines from #17825 are log output, not stored, so the cause is read from the run records and the usage ledger instead.
  • "Failure" counts both failed and paused outcomes. A paused run is a provider turn-away, usually a rate limit.
  • "Last ten runs" looks back at most seven days, and the flag needs a full ten runs before it says anything.
  • I added a Try: line and a "No door" line (with a reason) to the empty commit. The terminal screen and the how-to both exist, but the gate's both-doors rule did not credit them.

Not done: the gate still notes that failureCause is 1.00 similar to failureClass in src/flow/retro.ts. I did not read failureClass, so I don't know whether it fits. If a reviewer wants one implementation, the two should be merged; I left both so that a differing word list doesn't change retro.ts's behaviour.

To try: as an admin, open /settings/subscriptions and read the line under each account. In the terminal, open the Subscriptions screen.

[
 {"go":"/settings/subscriptions","look":"Each account row, under its name and meta","expect":"A line '<n> runs in 24 h · <k> failed (causes) · median <s> s', or 'no runs in the last 24 h'"},
 {"go":"/settings/subscriptions","look":"An account whose last ten runs mostly failed","expect":"'failed over half of its last ten runs' beside its place in the forge's order; list order unchanged"}
]

🤖 Generated with Claude Code

Closes #17890

3 earlier comments
commented

Each account row in Settings → Subscriptions now shows its last day, and an account that fails too often says so. The new tests, the Subscriptions page and timing tests, the terminal screen tests and tsc pass. I did not run the full suite, and the dead-code test showed no output in my last run, so I'm not counting it as passed.

What changed

  • src/crew/account_day.ts (new): accountDays reads every account's day in one statement. It joins usage (outcome, wall_ms) to run (the failure text) over usage_at. It returns:
    • runs in the last 24 hours;
    • failures by cause (rate limit, auth, timeout, other), read off the run's error_line, else its summary;
    • median seconds;
    • whether more than five of the account's last ten runs failed.
  • src/web/pages/subscriptions.ts: each row gets a line such as 6 runs in 24 h · 4 failed (1 rate limit, 1 auth, 1 timeout, 1 other) · median 20 s. "failed over half of its last ten runs" sits beside its place in the order. Nothing is reordered, and it adds no script and no new CSS.
  • src/tui/screens/subscriptions.ts: the terminal screen shows the same line and note.
  • docs/features/crew-accounts.md: a new section describes the row.
  • test/account-day.test.ts: seeded runs, the exact row text on the rendered page, the flag on exactly one account, and a Proxy-counted query count of 1 for all accounts.

Reused: median from src/efficiency/baseline.ts.

Choices

  • The model-call log lines from #17825 are log output, not stored, so the cause is read from the run records and the usage ledger instead.
  • "Failure" counts both failed and paused outcomes. A paused run is a provider turn-away, usually a rate limit.
  • "Last ten runs" looks back at most seven days, and the flag needs a full ten runs before it says anything.
  • I added a Try: line and a "No door" line (with a reason) to the empty commit. The terminal screen and the how-to both exist, but the gate's both-doors rule did not credit them.

Not done: the gate still notes that failureCause is 1.00 similar to failureClass in src/flow/retro.ts. I did not read failureClass, so I don't know whether it fits. If a reviewer wants one implementation, the two should be merged; I left both so that a differing word list doesn't change retro.ts's behaviour.

To try: as an admin, open /settings/subscriptions and read the line under each account. In the terminal, open the Subscriptions screen.

[
 {"go":"/settings/subscriptions","look":"Each account row, under its name and meta","expect":"A line '<n> runs in 24 h · <k> failed (causes) · median <s> s', or 'no runs in the last 24 h'"},
 {"go":"/settings/subscriptions","look":"An account whose last ten runs mostly failed","expect":"'failed over half of its last ten runs' beside its place in the forge's order; list order unchanged"}
]

🤖 Generated with Claude Code

commented

<!-- look-pages 82539e7c8657 --> Look pages for 82539e7, from the gate:

  • look pages (none): this pull changes src/web/pages/subscriptions.ts but the forge could not trace the route of /, /docs, /explore and 29 more (an inline or wrapped handler), so it could not infer a page; the reviewer decides. A "Looks: <path>" line naming the nearest page, or a "No look: <why>" line (10+ characters), says it
commented

I pushed two commits that only change commit messages, so the code is unchanged since the last push, and the look-pages gate message is gone. I didn't re-run tsc or the tests this round.

  • Look pages: /settings/subscriptions is admin-only and not in forge.json's app.looks, so a Looks: /settings/subscriptions line was rejected. A No look: line explaining that is accepted instead, and the review block below covers the page by hand.
  • Both doors: the page row, the terminal Subscriptions screen (same sentence and the same flag) and the crew-accounts.md how-to were all in the first push. Because of the rule below, account_day.ts is covered by a "No door" commit line, not by the gate seeing those files.
  • Commit-message items: the commits carry Direction: … (#17890), and test/account-day.test.ts builds real rows, with no as never.
  • Dead-code test: the new exports (accountDays, dayWords, NO_DAY, FAILURE_CAUSES) are used from subscriptions.ts and the TUI screen. The test showed no result when I ran it earlier, so I can't confirm it passes; the forge check will say.
  • Disagree: the gate's rule that a new src/crew module needs its own docs/features/<name>.md or a new screen file doesn't fit a module that feeds two existing surfaces. That's why the "No door" line is there. I also left failureCause separate from retro.ts's failureClass because I haven't read it. Merging them is a reviewer's call.
[
 {"go":"/settings/subscriptions","look":"Each account row","expect":"'<n> runs in 24 h · <k> failed (causes) · median <s> s' under the name"},
 {"go":"/settings/subscriptions","look":"An account failing more than half of its last ten runs","expect":"'failed over half of its last ten runs' beside its place in the order; order unchanged"}
]

🤖 Generated with Claude Code

commented

I pushed d75e4e8d8 on the same branch. The new terminal test and the existing account-day tests pass, and tsc is clean. I did not re-run the Subscriptions page tests or the dead-code test after this change.

  1. Terminal door tested: test/tui-account-day.test.ts seeds an account with 7 failed and 3 ok runs and opens the Subscriptions screen. It asserts 10 runs in 24 h · 7 failed (7 rate limit) · median 20 s and the "failed over half of its last ten runs" note.
  2. Dead class dropped: the day line on the page is now a plain <br /><span> like the standing line after it, with no account-day class.
  3. failureCause and failureClass stay two, and I kept them separate on purpose. failureClass in src/flow/retro.ts produces a retrospective's classes: "its check failed", "its tests failed", "hit a merge conflict". It has no auth class, and it files any text containing rate, limit or quota as a usage limit. failureCause has four classes an account is blamed for: rate limit, auth, timeout, other. Their only shared test is the timeout regex, which is one line. A shared helper would couple a retro wording list to an account health signal. There is a comment on failureCause saying so.

I did not change the gate's similarity note on failureCause, since it flags the two on shape, not on lists. If you would rather one place own the timeout test, say so and I'll extract it.

Rate-limit regex tightened: a bare limit or window no longer counts as a rate limit. It now needs 429, rate limit, usage limit, limit reached or limit exceeded, hit its/a/the limit, window is full, too many requests, overloaded or resting. A test shows "output over the size limit in the window" falls under other.

🤖 Generated with Claude Code

Sign in to join this conversation.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs