Commit Graph
3 Commits
Author SHA1 Message Date
GandClaude Opus 5 caa0e41c3b chore: add a formatter (#449)
* chore: add a formatter, matching the style this repo already writes

singleQuote=false was chosen by counting this repo's own
imports, not by fleet decree. The fleet is genuinely split and the two repos
that already had a .prettierrc disagreed with each other, so there was no
standard to restore. Quote style does not cross repo boundaries; having a
gate does.

Markdown is ignored for now — prettier rewraps prose, which would bury the
real diff.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* style: format with prettier (1062 files)

Mechanical. No behaviour change. This SHA is listed in
.git-blame-ignore-revs so `git blame` skips it.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* chore: teach git blame to skip the reformat

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* fix(lint): reattach two guards the reformat detached

Both effects were one-liners, so a trailing eslint-disable-line covered the
setState call:

  useEffect(() => { setSelected(new Set()); }, [q.length]); // eslint-disable-line ...

prettier expanded the block. The comment stayed on the closing line while the
call moved above it, so the guard protected nothing and the rule its author had
deliberately silenced failed the build.

This is the second shape of the same defect — hirnli had the eslint-disable-NEXT-line
variant. Both come from the same fact: an eslint directive binds to a line
number, so reformatting can silently unbind it, which makes 'mechanical, no
behaviour change' false for any bulk reformat.

* chore(desktop): bump the runner version the reformat requires

desktop-release-drift enforces that anything built into Fleet Runner which
differs from the last released tag must carry a version ahead of that tag —
main read 0.8.15 and fleet-runner-v0.8.15 already shipped.

A whole-repo reformat changes bytes under desktop/, so the gate fires. The
alternative was adding desktop/ to .prettierignore, which would buy a quiet PR
by carving a permanent hole in the formatter's coverage — the precise shape of
silent drift this test was written to catch. Bumping is what the rule asks for
and costs one patch release whose only content is whitespace.

* chore: merge main and re-format

A whole-repo reformat conflicts with any concurrent commit, and a conflicting PR
runs no checks at all while reporting nothing. Conflicts resolved to main,
which is correct because this branch changes formatting and nothing else.

* chore: leave desktop/ out of this reformat

desktop-release-drift is right to refuse this. Everything under desktop/ is
built into Fleet Runner, so changing it means shipping: bump the version AND add
a FLEET_RUNNER_RELEASES entry, whose stated audience is 'person who installed
Fleet Runner and wants to know what changed'. For a whitespace-only build the
honest answer is 'nothing', so that release should not exist — and I should not
write release notes claiming otherwise.

I had bumped to 0.8.16 to get the gate green. That was the wrong direction:
publishing a build to three OS runners to keep a formatting PR quiet. Reverted.

desktop/ is excluded in .prettierignore with the reasoning recorded there, to be
formatted alongside the next real runner change, where the bump and the notes are
true anyway.

---------

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-08-31 09:23:30 +00:00
404007eb3e fix(loki): a spent day is not a spent minute (#284)
Groq returns 429 for three unrelated conditions, and the classifier only knew
two. A tokens-per-day cap opens with the same "Rate limit reached" wording as an
ordinary per-minute burst, so it was classified as capacity - and every recovery
that is right for capacity is actively harmful for a spent day:

  - the step-down to llama-3.1-8b-instant draws on the SAME org-wide daily
    budget, so it is a guaranteed-identical failure one round trip later;
  - the bounded ~25s wait is measured against a reset Groq reports in tens of
    minutes ("try again in 56m26.88s").

Net cost to the operator: two dead round trips and ~25s of latency on every Loki
turn for the rest of the day, ending in "Groq rate-limited - try again shortly",
which invites exactly the retry that cannot succeed for another hour.

This is the same mistake as the size/capacity conflation one level deeper. The
distinction that matters is not which limit was hit but what, if anything, the
caller can do about it, so the type now names all three.

  - classifyGroqLimit gains "daily", tested BEFORE size/capacity because the
    daily body also matches the cheaper capacity pattern (RPD counts too).
  - llm.ts short-circuits a daily cap instead of stepping down and sleeping.
  - groqRetryAfterSeconds/humanizeWait pass on the figure Groq already stated;
    rateLimitMessage turns it into a clause the operator can act on, and lives
    beside the classifier so both Groq wrappers say the same thing.
  - the size case stops telling the operator to retry at all - waiting cannot
    fix an oversized request, and the real repair is ours, not theirs.

The suite previously asserted the daily body WAS capacity, with the reasoning
"the budget refills, so retry/degrade is right". It refills in an hour, not in
25 seconds, and not on the model we degrade to. That case is corrected and
pinned, and the tests grow 8 -> 17 assertions.

Co-authored-by: t <t@t.t>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-08-15 09:45:30 +00:00
52ede1bf1b fix(loki): a 429 that means "too big" is not a 429 that means "too busy" (#270)
* fix(loki): a 429 that means "too big" is not a 429 that means "too busy"

Groq returns 429 for two unrelated conditions and the handler treated them as
one. CAPACITY ("Rate limit reached ... Used 5959, Requested 400") means the
per-minute window is momentarily spent — waiting helps, and a smaller model has
its own budget so stepping down helps too. SIZE ("Request too large ... Limit
6000, Requested 15041, please reduce your message size") means ONE request is
larger than the entire allowance — waiting can never help, and stepping down
makes it strictly worse because the cheaper model has HALF the ceiling
(verified 2026-08-14: llama-3.3-70b-versatile = 12000 TPM,
llama-3.1-8b-instant = 6000).

So an oversized prompt stepped down to the model that could not possibly take
it, burned 25s in a wait for a window that never grows big enough, and then gave
up the turn. Loki's tool loop died on every question and every answer came from
the toolless fallback — which cannot read the tables the questions are about.

- classifyGroqLimit (pure) tells the two apart from the response body; status,
  type and code are identical in both, so only the wording distinguishes them.
- llm.ts throws size-429s immediately, worded so loop.ts's shed ladder
  recognises them and retries with fewer facts — the only thing that actually
  fixes an oversized prompt.
- The shed ladder now goes to 5 attempts instead of 2: it is the cure now, not
  a long shot, so let it shed far enough to fit.
- Unrecognisable bodies default to capacity: that path retries and degrades,
  where guessing "size" would shed context that was never the problem.

Tests use bodies captured verbatim from the live API, including the daily-cap
body (capacity — the budget refills) which shares the size body's phrasing about
tokens per minute.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* test(deploy-gate): a fixture builder must not be able to aim at a real repo

setup_repo commits and renames a branch to `main`. Pointed at a real checkout
that is a repo-destroying sequence, and this suite runs from `verify` on every
push, in parallel sessions — so "the paths are obviously fine" is not a property
worth assuming. It now refuses unless the fixture path is under $TMP, and
asserts the clone actually produced its own repo there (a failed clone would
leave the -C target missing, and with no `set -e` the suite marches on).

Also guards an empty $TMP, which would make fixture paths absolute-from-root
while still satisfying the "$TMP"/* containment pattern.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

---------

Co-authored-by: test <test@test>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Co-authored-by: t <t@t.t>
2026-08-14 11:00:56 +00:00