Skip to content

feat(dash/ui): redesign the dashboard, and revive a tab that was silently dead - #74

Merged
OsherElhadad merged 50 commits into
feat/hosted-tls-and-agent-compactionfrom
stack/6-dashboard-redesign
Aug 17, 2026
Merged

OsherElhadad merged 50 commits into
feat/hosted-tls-and-agent-compactionfrom
stack/6-dashboard-redesign

Conversation

@OsherElhadad

Copy link
Copy Markdown
Collaborator

Stacked on the PR below.

A feature was completely dead and nobody noticed. Two top-level async function loadSessions() declarations existed — the Sessions tab's, and the newer signed-in-machines loader. In JavaScript the later declaration simply wins, with no error: the Sessions tab rendered zero rows, its pager was blank, and "Could not list your sessions" was painted into a Settings card. Renamed; before/after screenshots show empty table → 25 rows.

button.primary failed WCAG AA in dark mode at 2.99:1, measured — on Sign in, Register, Verify and Save — because white ink was hardcoded against an accent that is a light blue in dark theme. Now 6.3:1 via an --on-accent token.

Copy. Note and hint words in index.html 719 → 288; Overview page height 4045 → 3674 px at 1440, 7728 → 6357 px at 360. Panels read like panels rather than documentation: stat tiles lost six redundant captions, and long explanations moved behind disclosures.

The four savings denominators stay distinguishable by construction rather than by prose: each bar now permanently shows its own divisor, and only the explanation folds — so "of what we tried to compact" and "unique, of the whole request" can never collapse into two identical-looking numbers. The server-side denominator labels are untouched, since they are /api/stats payload and quoted in two docs pages.

Also restyled what landed plain from parallel work, preserving the properties that were load-bearing: the Usage tab keeps its validated series palette, direct value labels on both bars and an always-present legend (blue-green is the tritan-weak pair); the verify screen's countdown still computes against the server's absolute expiry, with only the CSS class reading remaining seconds; the request drawer's 24 undifferentiated key/value pairs became four captioned bands, with breakpoints in four labelled slots and null temperature rendering as unset rather than 0.

Grafana is surfaced as copyable text, not a hyperlink — it is deliberately not exposed on the public path, and a dead link would be worse than none. No CSP loosening, no iframe.

Verified: contrast computed per element over the nearest painted ancestor, alpha-composited — 642 pairs, 0 failures, tightest 4.64:1 against 4.5 required (before: 4 failures at 2.99:1). Zero horizontal body scroll across 16 view × width combinations. 46 keyboard stops, every disclosure reachable with a visible ring.

Osher-Elhadad added 22 commits August 16, 2026 18:48
…st correlation

The proxy had slog calls but no logging: no handler was ever installed, so DEBUG
went nowhere, and the only per-component lines came from metrics.Slog at INFO with
neither tenant nor session on them — several lines per request, burying the request
itself.

Four things:

- internal/logging owns the level/format/sink decision (CG_LOG_LEVEL,
  CG_LOG_FORMAT, CG_LOG_FILE) and installs the default handler. Local use needs no
  configuration: text on stderr. CG_LOG_FILE adds a JSON sink for a log shipper and
  is the ONLY thing that makes logs leave the box. CG_LOG_PLAIN=1 opts out
  entirely, swapping in the stdlib's own text handler.

- Credentials are scrubbed on the way OUT, so a careless call site added later
  cannot leak one — which matters more now that the caller's own provider key
  flows through request handling. A ReplaceAttr covers attribute values (including
  the ones baked in by Logger.With) and a wrapper handler covers the message.
  The patterns are the ones dash already used: they moved to internal/redact and
  dash/redact.go delegates, because two copies of a credential denylist is one
  copy that goes stale.

- Every line of one request's lifecycle carries the tenant id — never its token —
  and, from the point apply resolves it, the session. The logger travels in the
  request context, which is why no component signature changed.

- The lines say what was DECIDED, not just what happened: one INFO per request,
  and at DEBUG the cached-prefix boundary, the bypass gate, the expand loop's
  resolved-against-unresolved counts, why a stream had to be buffered, and one
  line per component with its verdict, token delta and the gates that turned
  candidates away. Those gate names and counts are read off the same Report.Gates
  map /stats sums into components.<name>.gates, so a log line and the metric
  cannot disagree.

Signed-off-by: Osher-Elhadad <[email protected]>
The default hosted pipeline ([format, dedup, failed_run, cmdfilter, extract,
cachesplit], sync) spent most of its CPU re-doing work it had already done. A
CPU profile over 24 real captured Claude Code requests (median 600 KB, 71
messages) attributed the rewrite path as: normalize 44%, wireBreakpoints 22%
(and it runs twice per request), a full transcript deep-clone per component 10%.
None of that is component work.

Six changes, each measured on that capture, output verified byte-identical:

  - wireBreakpoints walked the body with seven `#.field` gjson queries, each a
    full re-scan that squashed every matched array. Now one pass over the
    top-level object, with a substring prefilter before any structural parse
    (neither spelling can be a field if "cache" is not even in the bytes), and
    the post-rewrite cap re-count only when something actually changed — an
    untouched body still carries exactly the inbound count.
  - The pipeline deep-cloned the whole transcript per component for its revert
    snapshot. It now keeps ONE snapshot and re-clones only the messages a
    component changed; a revert re-establishes an independent copy, because
    req.Input then aliases the one we were holding. Every snapshot entry is
    still exactly one clone of a live message, so fidelity is unchanged — two
    new tests fail without either half.
  - The lossless round-trip check (two unmarshals into `any` plus a DeepEqual)
    ran for all ~70 messages up front; it only matters for a message a component
    changed, so it is computed on demand.
  - Every normalized message was marshalled twice: once in normalize, once for
    the count-change rebuild path only summarize takes. The rebuild now reads
    slot.pre.
  - normalize called encoding/json.Unmarshal on a type that implements
    json.Unmarshaler, so encoding/json contributed nothing but a checkValid
    re-scan of bytes gjson had already parsed — 40% of the unmarshal cost. It
    calls UnmarshalJSON directly, and fetches each message's `content` once.
  - ContentKey is memoized (like internal/tokens.Count): every offloader asks
    skipReduce about every candidate, so one request normalized and sha256'd the
    same tool output three or four times. Keyed by (len, hash) — a wrong key
    here would mean a wrong stashed original, unlike a stale token count.

Measured, 24 real captured requests, same test code both sides:

  end-to-end        552.6 ms -> 253.3 ms   (-54%)
  one median req     15.6 ms ->   6.9 ms   (-56%), 9554 -> 3232 allocs (-66%)
  per-component duration_ms, pipeline total  1.75 ms -> 1.06 ms  (-39%)
  live /compact through the proxy, 73 requests, median 37.1 -> 19.2 ms
  live LLM calls through the gateway, cg_added_ms_avg 37.1 -> 25.8

Byte-identical output verified over 373 real captured requests (73
Terminal-Bench + 300 SWE-bench) via a golden hash of every rewritten body, with
the hashes recorded on the unmodified code. Fail-open, never-worse and
reversibility are untouched; the #32 replay test still puts breakpoints on the
wire for 72 of 73 requests.

What did NOT help and was reverted: prefiltering normalize's content walk on a
"tool_result" substring (no measurable change — real user messages nearly all
carry one).

Signed-off-by: Osher-Elhadad <[email protected]>
Grafana stores no logs, so something had to. Loki wins on the property that matters
more than any feature comparison: it is read through the Grafana already running on
this box, so a latency spike on the service dashboard is one click from the log
lines for the same tenant and the same minute — one thing to secure, back up and
explain. Its storage model is also the same shape as the Prometheus beside it: a
single binary indexing a handful of labels, chunks on the local filesystem, one more
container. Elasticsearch would search better and wants a JVM and gigabytes of RAM on
a box whose job is serving agent traffic; ClickHouse is a better analytical store
than reading logs is an analytical problem; files and grep — kept as the fallback —
cannot answer "every line for this tenant's session over three days" without a human
and an ssh session, which is the question this exists for.

- `install.sh grafana` now brings up all four containers, loopback only, and installs
  the logrotate snippet. `grafana-status` checks Loki's readiness (not just its port
  — it answers while the ingester still rejects pushes), that the log file exists,
  that lines actually arrived in the last ten minutes, and which tenants Loki has
  seen. That last set of checks exists because a healthy promtail in front of an
  empty log directory renders an empty dashboard with no error anywhere.

- The proxy never talks to Loki. It writes the journal always and CG_LOG_FILE as
  JSON when set; promtail owns delivery and remembers its position. A shipper inside
  the process being debugged loses exactly the logs you need when that process is
  what is going wrong.

- `tenant` and `level` are Loki labels; `session` and `component` deliberately are
  not — a session label would mint one stream per agent conversation and eventually
  take the index down. They are read out of the JSON at query time, which is what
  the dashboard's two text fields do.

- The logs dashboard filters by tenant, session, level and component, and its
  gate table answers "the component did nothing and I cannot tell why" off the same
  Report.Gates map /stats sums.

Single-tenant proxies log tenant="local" rather than an empty string, which promtail
would drop — leaving the selector empty for exactly the people running this locally.

Signed-off-by: Osher-Elhadad <[email protected]>
A request row recorded what happened to a request but nothing about what the
request ASKED for, so the levers that explain a cost were invisible: reasoning
effort, thinking budget, sampling parameters, and — the one this project exists
to reason about — where the prompt-cache breakpoints sat.

Capture, normalized across both dialects (Anthropic `output_config.effort` /
`thinking.{type,budget_tokens}` / object `tool_choice` / block `system`; OpenAI
`reasoning_effort` / `max_completion_tokens` / string `tool_choice`), plus the
provider's stop reason off the same response bytes the token tiers come from.

Real columns, not a JSON blob: every field is either GROUPED BY in an aggregate
or shown on the row, so a blob would put json_extract() in the middle of every
aggregate and give free text somewhere to hide from the redactor. The sampling
columns are NULLABLE because "unset" and "0" are different facts and 0 is a
legitimate value — a sentinel would make a deterministic request read as an
unspecified one.

Client-supplied metadata is attacker-influenced input, so each text field passes
through a credential-shape check and an identifier-shape bound BEFORE the insert,
never on read. Unrecognized-but-harmless values survive verbatim: a dashboard
that renders ordinary data as «redacted» lies about its own coverage.

Breakpoints ride on apply.Trace, split by location, from the count the pipeline
already makes to respect the provider's cap of four — so placement costs the
request path nothing. The remaining fields are one structural pass over the
top-level object, measured at 0.55 ms/MB against 2.7 ms/MB for a per-field query
loop, and it never parses `messages`.

/api/breakdown groups requests, tokens and spent-vs-saved by one allowlisted
dimension, so per-model cost, cost by reasoning effort and cost by breakpoint
count are one query rather than three that can drift. Per-day usage bars need no
new query at all: bucketing already happens in SQL, so a day is a parameter.

Schema version 6 — the intended migration for a derived view: the old file is
renamed aside and the non-derived tables carried across.

Signed-off-by: Osher-Elhadad <[email protected]>
Left behind by the switch from a per-field query loop to the single pass; a
package-level var nothing reads is not a compile error, so nothing caught it.

Signed-off-by: Osher-Elhadad <[email protected]>
…s tenant

logging.Debugging(ctx) is the single guard for "is anyone reading DEBUG", used by
apply's decision loop and extract_llm's candidate accounting instead of each one
reaching for Enabled(). And BodyOpts's panic recovery now logs through the request's
own logger — a panic is the line you most want attributed to a tenant, and it was
going out on the default logger with nothing on it.

Signed-off-by: Osher-Elhadad <[email protected]>
The UI reads all fifteen fields as top-level keys, which holds only while Meta is
embedded anonymously; a json tag on that field would nest them and blank the
request drawer with nothing else failing.

Signed-off-by: Osher-Elhadad <[email protected]>
The pipeline snapshots messages before each component so it can revert on
error/panic/never-worse. When the JSON round-trip clone fails, fallbackClone falls
back to bifrost's DeepCopyChatMessage — and per [email protected]/schemas/utils.go its
block copier (deepCopyChatContentBlock, l.803) copies only Type, Text, Refusal,
ImageURLStruct, InputAudio and File. ChatContentBlock also carries three
non-OpenAI fields (chatcompletions.go l.1122-1128): CacheControl, Citations and
CachePoint. All three were silently dropped.

So on that path a revert did not restore the message, it degraded it: a request
that arrived with cache_control on a block came back out without it. That is the
never-worse invariant broken on the least visible path — the one that only runs
after something else already went wrong — and it is not cosmetic here. A dropped
breakpoint is a full cache write instead of a cache read, ~12.5x the price, and
getting breakpoints onto the wire is the entire point of cachesplit/cacheinject.

The clone now restores the three fields after bifrost's copy, cloning the pointer
values (TTL/Scope/Enabled) rather than sharing them, so snapshot and live message
stay independent in both directions. The failure is reachable, not theoretical:
ChatMessageContent.MarshalJSON errors when a message carries both string and block
content, which a component can produce, and that is what the new test builds.

TestFallbackCloneKeepsCacheFields fails on the parent commit ("revert dropped
cache_control: a prompt-cache breakpoint is gone from the wire") and passes here.
Output equivalence unchanged: golden hashes still match over the same 373 real
captured requests (73 Terminal-Bench + 300 SWE-bench), the #32 replay still puts
breakpoints on the wire for 72 of 73, and the latency benchmarks are unmoved
(253 ms over 24 requests, 6.5 ms median request, 3222 allocs) since this path is
off the hot path.

Signed-off-by: Osher-Elhadad <[email protected]>
Signed-off-by: Osher-Elhadad <[email protected]>

# Conflicts:
#	proxy/proxy.go
…ssage

The writeback ran sjson.SetBytes over the WHOLE body per changed message. sjson
allocates and copies the entire request for every write, so the cost was O(k * body):
30 rewritten tool outputs on a 600 KB request copied ~18 MB to produce one 600 KB
result. Each write also re-scanned the body with gjson to find its target, and
applyMetaWrites did the same once per metadata key.

Now each changed message's own bytes are edited and all of them are spliced back in
one pass. The output is byte-identical, not merely equivalent JSON, because sjson's
splice is local: appendRawPaths ([email protected]) emits json[:res.Index], recurses into
that subtree's Raw, then appends json[res.Index+len(res.Raw):]. Editing a message and
putting it back at the message's span is therefore the same bytes as editing at
"messages.<i>.<rest>" on the whole body. Everything outside an edited span is copied
verbatim, which is what invariant I1 requires.

Two things make that safe rather than clever:

  - Spans come from the offsets gjson already produced for each message, plus the byte
    shift splitVolatileTail now reports (it rewrites the top-level `system` value, so
    everything after it moves). Re-parsing the messages array to find the spans instead
    was the obvious version and it was SLOWER than what it replaced: measured on the
    median captured request, one array parse is 1.21 ms against 0.44 ms for a whole-body
    sjson write, so it only paid above ~3 rewrites per request. That version was a 13%
    regression; this one has no extra parse, and drops one that rebuildCountChanged was
    already duplicating.
  - gjson documents Index as "zero means index unknown" and it is relative to whatever
    json the Result came from, so no span is trusted on its word: the body's own bytes
    at that span must equal the message's Raw or the splice declines and the original
    request is forwarded. A wrong offset therefore costs a rewrite, never a corrupt
    body.

The shift needs its own test, because captured traffic cannot cover it: Claude Code
orders the body `messages` before `system`, so the split shifts nothing on real
requests, and json.Marshal of a map sorts keys the same way. TestSpliceRewrites-
EveryMessageAtItsOwnSpan builds the body with `system` first and both splits and
rewrites in one request; it fails (fail-open, no rewrite forwarded) with the shift
hard-coded to 0 and with it off by one.

Measured, 24 real captured requests:

  end-to-end        253.6 ms -> 243.5 ms  (-4.0%)
  bytes allocated    167 MB  ->  144.5 MB (-13.4%), allocs unchanged
  one median request  6.61 ms ->   6.60 ms (flat)

Per-component duration_ms is untouched by construction — pipeline.runOne's timer wraps
the component call, and this is all after it, so the -39% stands.

Output verified byte-identical over 1868 real captured requests (73 Terminal-Bench +
1795 SWE-bench) against golden hashes recorded before the change, and the #32 replay
still puts breakpoints on the wire for 72 of 73.

applyMetaWrites now takes the message rather than the body, since metaWrite.path was
already message-relative; bodyIndexOf is gone, splitSlotPath does that job.

Signed-off-by: Osher-Elhadad <[email protected]>
Both sides rewrote the breakpoint counter for different reasons, and both
reasons stand. Reconciled to ONE implementation: the perf branch's single
structural walk (ParseBytes().ForEach + mayHold/elemMarks), accumulating into
the metadata branch's location-split Breakpoints instead of one int.

The split is what feeds the four dashboard columns; the single pass is what
takes the counter off ~22% of the rewrite path. Neither needed the other's
implementation — the walk already knows which top-level key it is under, so
the location comes out free, where the 7-path form had to derive it from the
query string. wireBreakpoints stays as the one-line Total() wrapper the cap
check calls.

Kept from fix/clone-and-writeback: the conditional re-count (an untouched
body carries exactly the inbound count, so n > inbound is false by
construction), the duplicate normPre marshal loop's removal (slot.pre already
holds it), and the spliceMessages writeback with its fail-open span check.

Kept from the observability work: every DEBUG line behind its `debug` guard,
dumpToolOutputs, and the cap-breach ERROR — now on the session-bearing
context logger, which is why it no longer repeats "session" as an attribute.

sort.Ints was the only caller of "sort"; slices was already imported for
formatGates, so spliceMessages uses slices.Sorted(maps.Keys(edits)).

Verified: gofmt/vet clean, go test -race green. Byte-identity goldens
reproduce on 373 captured requests (73 terminal-bench + a 300-request
swebench prefix). The merged counter returns the same per-location numbers as
the 7-path version on 3736 real bodies (every captured request, inbound and
post-pipeline). #32 replay: breakpoints reach the wire on 72 of 73. Per-
component duration_ms unchanged — components/pipeline.go is byte-identical to
the perf branch and Pipeline.Run holds the same cumulative CPU.

Signed-off-by: Osher-Elhadad <[email protected]>
A secret in a log attribute's KEY was emitted verbatim: scrubAttr tested the key
name and then replaced only the value. The key is as untrusted as the value —
ranging over parsed data puts data in the key slot — so a credential-shaped key
now takes the whole attr with it.

The auth-header rule matched to end of LINE. Fail-safe for a log record and
destructive for captured transcript content, which the dashboard shows users: a
minified JSON tool result with an "authorization" field lost every field after
it. The value now stops at a string/field terminator as well as the newline; a
bare 'Authorization: Bearer <token>' line still has nothing to stop at but the
newline, so the log case is unchanged.

dash.RedactHeaders had no production caller — nothing in the capture path records
request headers at all — so the allowlist implied a live protection that did not
exist. Deleted rather than wired up, with the docs corrected to say headers are
never captured; git history holds the allowlist if they ever are.

scrubToken read h.Get, the FIRST value of an auth slot, while copyHeaders
forwards ALL of them: two Authorization headers, provider key then our token,
sent the token upstream. It now checks every value, and decides on a prefix match
rather than the exact length LooksLikeToken requires — a token that lost one
character was not token-shaped, so it was forwarded as a caller credential.
Authentication stays strict; only the scrubbing decision is liberal.

Also names the two credential classes a pattern denylist knowingly misses
(base64-encoded, and prefix-less opaque keys outside a named field), so the next
reader does not add speculative patterns for them.

Signed-off-by: Osher-Elhadad <[email protected]>
Three findings from a security review of the tenant package, each with a test
that fails without the fix.

RegisterAccount treated "email_verified_at = 0" as "nobody owns this address",
but migration v3 added that column with DEFAULT 0, so every account created
before email auth migrates to unverified while being in daily use. An
unauthenticated POST to /api/register with a colleague's address therefore
installed the caller's password on a live account, locking the owner out of the
dashboard (token login refuses an account that has a password) and leaving only
the mailed code in the way of a full takeover. The claim is now gated on the
account never having been usable — no password and no token row at all — and
returns ErrEmailTaken otherwise. The v3 upgrade also stamps every account
holding a live token, in the same step that adds the column, so the existing
accounts are never in the claimable state; the same statement runs again as v4
for databases that already reached v3.

BindAgentKey upserted ON CONFLICT DO UPDATE SET tenant_id, which moved a digest
another tenant had bound to whoever asked for it, unaudited. With
capture_content defaulting on, that redirects the victim's request transcripts
to the thief's dashboard. Binding a digest owned by someone else is now
refused, a transfer has to be an unbind by the owner followed by a rebind, keys
shorter than 20 characters are rejected so low-entropy strings cannot be
claimed, and bind and unbind both write an audit row.

decodeHash accepted any non-zero argon2 parameters, so a poisoned row made
every sign-in attempt against that account a 1 GiB allocation. Parameters above
a small multiple of our own are now treated as a corrupt hash.

Also orders Audit by rowid within a timestamp: one Update writes every changed
field with the same millisecond, which left the order inside a change arbitrary.

Signed-off-by: Osher-Elhadad <[email protected]>
…unset key_env

The tenancy cache is where a tenant's frozen compaction decisions live, and it
evicted on recency alone. Registration is open to a whole /8, so max+1 throwaway
accounts sending one request each evicted every real tenant's state, and each
victim's next turn re-wrote its cached prefix at ~11.5x the read price. Entries
that have seen a second request are now last in line for eviction rather than
pinned — the bound still holds, and evicting one is logged as its own case,
because it means the cap itself is the binding constraint. The front entry is
never the victim, so a newcomer cannot be starved by a full cache of active
tenants.

setKey returned the same nil for 'no key_env, caller pays' and 'key_env named
but unset', so a half-finished config edit fell through to forwarding whatever
the caller sent. In gateway mode that is a PLACEHOLDER — non-empty, so the 'no
credential' check passed it — which published the placeholder to a third party
and returned its 401 for the operator to chase. The second case is now a
sentinel error and a 502 naming the upstream, with the variable name in the log
only. No key_env at all still means caller-pays, unchanged.

Signed-off-by: Osher-Elhadad <[email protected]>
MinAgentKeyLen refuses a provider key under 20 characters, so the 11-char
bob-own-key fixture no longer binds. The rename is a merge-time break between
the agent-key floor and the tests that predate it, not a behaviour change.

Recorded while doing it: a real credential measured on this box is 25
characters, so the floor of 20 clears legitimate keys by only five. If any
supported provider issues a shorter key, the floor is a functional refusal
rather than a security win.

Signed-off-by: Osher-Elhadad <[email protected]>
The panels read like documentation: a 40-word note under every heading, a
three-line paragraph under every bar, and a caption under every stat tile
restating the tile's own label. This moves the explanations behind native
<details> disclosures and keeps in the layout only what a reader cannot infer.

Copy:
  - Every panel note is one line. The long version folds into a <details
    class="why">, which is keyboard-operable and collapsed by default.
  - The four savings denominators keep their distinct server-side labels AND
    grow an always-visible `numerator ÷ denominator` line, so shortening the
    prose cannot make two different ratios read as the same measurement.
  - Tile sub-lines survive only where they carry a fact the label cannot: a
    formula, a p95, or the gross/unique distinguisher. Six were deleted.
  - Headings lose their trailing clauses ("Honest savings waterfall" →
    "Savings waterfall", "Latency: context-guru vs upstream" → "Latency").

Layout and accessibility:
  - Fix white-on-accent on the primary button in dark mode: 2.99:1, measured,
    on four screens. New --on-accent token, dark ink on the light-blue accent.
  - Fix horizontal body scroll at 360px (377px wide): the identity group in the
    top bar could neither shrink nor wrap. All four widths are now clean.
  - .clip applied to any element, not just td/code, so the 96-character user
    agent in "Signed-in machines" stops setting that card's width.
  - The bar label column is capped at 220px instead of 30%, so a bar no longer
    starts a third of the way across a wide panel.
  - The six request-metadata filters move behind one "More filters" disclosure,
    badged with how many are set. Thirteen controls wrapped to two rows and
    pushed the first number below the fold.
  - The filter bar is hidden on the five views that read no filter.

Restyled what landed plain:
  - Usage: capped label column, styled in-heading dimension picker, tighter
    rows. The direct value labels on both bars and the always-present legend
    are unchanged — blue-green is the tritan-weak pair.
  - Auth: full-width primary, tracked-out 6-digit code box, amber countdown
    under a minute, token fallback folded away, and the sign-in/register tabs
    hidden during phase two. The countdown still measures against the server's
    absolute expiry; only its styling reads the remaining seconds.
  - Request drawer: 24 flat key/value pairs become four captioned bands, the
    cache_control breakpoints become four labelled slots instead of one
    run-on string, and a null temperature/top_p renders as italic "unset"
    rather than an em dash that could be read as a dash-shaped zero.

Logs affordance: the Config tab and the request drawer carry copyable text for
the Loki-backed Grafana dashboard — the tunnel, the address, and a LogQL query
scoped to the request's own session. Deliberately not a hyperlink and not an
iframe: Grafana binds loopback, so a link would be dead until the tunnel is up,
and an iframe would mean loosening the CSP.

Fix a real regression on the way: two top-level `loadSessions` declarations, one
for the Sessions tab and one for the account's signed-in machines. The later
declaration wins, so the Sessions tab and both of its pager buttons called the
account loader — the tab rendered no rows at all and painted "Could not list
your sessions" into a Settings card. The account one is now loadMachines.

Verified in Chromium against a seeded database: 642 painted foreground/background
pairs measured for WCAG contrast across every tab in both themes, 0 failures
(tightest 4.64:1); no horizontal body scroll at 360/768/1024/1440; every new
disclosure reachable by Tab with a visible focus ring.

Signed-off-by: Osher-Elhadad <[email protected]>
…e median

The regression this guards - content redaction on the request goroutine, ~53ms
- is unconditional work, so it lands on every sample including the fastest.
Contention only ever makes a sample slower. The minimum is therefore the
statistic least polluted by the machine while staying fully sensitive to the
defect.

The median gate failed roughly one run in three on a loaded box, with the
package run alone. A gate that reports the machine rather than the code gets
ignored exactly when it is right.

Signed-off-by: Osher-Elhadad <[email protected]>
Osher-Elhadad added 6 commits August 17, 2026 06:50
Resolving the connect-ibm-service.md conflict took the credential branch's
version wholesale, because its facts were current and the prose branch's were
stale. That discarded the prose branch's anchor fix: use-with-claude-code.md's
'The one-liner' heading had become 'Steps', and hosted.md was repointed while
this file was not.

mkdocs build --strict catches it; the merged tree did not build until now. Both
docs branches passed on their own - taking one side of a conflict wholesale is
what lost it.

Signed-off-by: Osher-Elhadad <[email protected]>
(cherry picked from commit df749b5)
Resolving the connect-ibm-service.md conflict took the credential branch's
version wholesale, because its facts were current and the prose branch's were
stale. That discarded the prose branch's anchor fix: use-with-claude-code.md's
'The one-liner' heading had become 'Steps', and hosted.md was repointed while
this file was not.

mkdocs build --strict catches it; the merged tree did not build until now. Both
docs branches passed on their own - taking one side of a conflict wholesale is
what lost it.

Signed-off-by: Osher-Elhadad <[email protected]>
(cherry picked from commit df749b5)
Resolving the connect-ibm-service.md conflict took the credential branch's
version wholesale, because its facts were current and the prose branch's were
stale. That discarded the prose branch's anchor fix: use-with-claude-code.md's
'The one-liner' heading had become 'Steps', and hosted.md was repointed while
this file was not.

mkdocs build --strict catches it; the merged tree did not build until now. Both
docs branches passed on their own - taking one side of a conflict wholesale is
what lost it.

Signed-off-by: Osher-Elhadad <[email protected]>
(cherry picked from commit df749b5)
…e median

The regression this guards - content redaction on the request goroutine, ~53ms
- is unconditional work, so it lands on every sample including the fastest.
Contention only ever makes a sample slower. The minimum is therefore the
statistic least polluted by the machine while staying fully sensitive to the
defect.

The median gate failed roughly one run in three on a loaded box, with the
package run alone. A gate that reports the machine rather than the code gets
ignored exactly when it is right.

Signed-off-by: Osher-Elhadad <[email protected]>
(cherry picked from commit a2b665c)
…e median

The regression this guards - content redaction on the request goroutine, ~53ms
- is unconditional work, so it lands on every sample including the fastest.
Contention only ever makes a sample slower. The minimum is therefore the
statistic least polluted by the machine while staying fully sensitive to the
defect.

The median gate failed roughly one run in three on a loaded box, with the
package run alone. A gate that reports the machine rather than the code gets
ignored exactly when it is right.

Signed-off-by: Osher-Elhadad <[email protected]>
(cherry picked from commit a2b665c)
…e median

The regression this guards - content redaction on the request goroutine, ~53ms
- is unconditional work, so it lands on every sample including the fastest.
Contention only ever makes a sample slower. The minimum is therefore the
statistic least polluted by the machine while staying fully sensitive to the
defect.

The median gate failed roughly one run in three on a loaded box, with the
package run alone. A gate that reports the machine rather than the code gets
ignored exactly when it is right.

Signed-off-by: Osher-Elhadad <[email protected]>
(cherry picked from commit a2b665c)
Osher-Elhadad added 22 commits August 17, 2026 06:50
A fixed 5ms budget cannot mean the same thing at both ends of this machine's
range. Idle, a fake-upstream request settles near 1-2ms; with the suite
saturating 16 cores its own median was 331ms. The gate was reporting the
machine, failing about one run in three with nothing wrong.

Budget is now max(5ms, 10% of the measured baseline), which catches the ~53ms
regression at any baseline while contention that slows both handlers equally
cannot trip it. The median stays the statistic: the minimum was tried and is
worse, being one unaveraged sample - in one run the paired medians differed by
1.27ms where the paired minima differed by 8.13ms.

Signed-off-by: Osher-Elhadad <[email protected]>
(cherry picked from commit 3aad033)
A fixed 5ms budget cannot mean the same thing at both ends of this machine's
range. Idle, a fake-upstream request settles near 1-2ms; with the suite
saturating 16 cores its own median was 331ms. The gate was reporting the
machine, failing about one run in three with nothing wrong.

Budget is now max(5ms, 10% of the measured baseline), which catches the ~53ms
regression at any baseline while contention that slows both handlers equally
cannot trip it. The median stays the statistic: the minimum was tried and is
worse, being one unaveraged sample - in one run the paired medians differed by
1.27ms where the paired minima differed by 8.13ms.

Signed-off-by: Osher-Elhadad <[email protected]>
(cherry picked from commit 3aad033)
A fixed 5ms budget cannot mean the same thing at both ends of this machine's
range. Idle, a fake-upstream request settles near 1-2ms; with the suite
saturating 16 cores its own median was 331ms. The gate was reporting the
machine, failing about one run in three with nothing wrong.

Budget is now max(5ms, 10% of the measured baseline), which catches the ~53ms
regression at any baseline while contention that slows both handlers equally
cannot trip it. The median stays the statistic: the minimum was tried and is
worse, being one unaveraged sample - in one run the paired medians differed by
1.27ms where the paired minima differed by 8.13ms.

Signed-off-by: Osher-Elhadad <[email protected]>
(cherry picked from commit 3aad033)
Resolving the connect-ibm-service.md conflict took the credential branch's
version wholesale, because its facts were current and the prose branch's were
stale. That discarded the prose branch's anchor fix: use-with-claude-code.md's
'The one-liner' heading had become 'Steps', and hosted.md was repointed while
this file was not.

mkdocs build --strict catches it; the merged tree did not build until now. Both
docs branches passed on their own - taking one side of a conflict wholesale is
what lost it.

Signed-off-by: Osher-Elhadad <[email protected]>
(cherry picked from commit df749b5)
MinAgentKeyLen refuses a provider key under 20 characters, so the 11-char
bob-own-key fixture no longer binds. The rename is a merge-time break between
the agent-key floor and the tests that predate it, not a behaviour change.

Recorded while doing it: a real credential measured on this box is 25
characters, so the floor of 20 clears legitimate keys by only five. If any
supported provider issues a shorter key, the floor is a functional refusal
rather than a security win.

Signed-off-by: Osher-Elhadad <[email protected]>
(cherry picked from commit 68f351b)
The limiter is charged before the argon2 verify, deliberately, because 64 MiB
per attempt is itself an amplifier. So the attempts the loop is allowed each pay
a full KDF, and on a contended machine those can outlast the limiter's own
one-minute window - at which point the earliest attempts have aged out and the
bound correctly did not fire.

From inside the test, "not limited" and "the window expired underneath us" are
indistinguishable, and failing on the second is a test reporting the machine
rather than the code. It now skips with the elapsed time named when the loop
outran the window, and still fails outright when it did not.

Signed-off-by: Osher-Elhadad <[email protected]>
(cherry picked from commit 26e8e50)
The limiter is charged before the argon2 verify, deliberately, because 64 MiB
per attempt is itself an amplifier. So the attempts the loop is allowed each pay
a full KDF, and on a contended machine those can outlast the limiter's own
one-minute window - at which point the earliest attempts have aged out and the
bound correctly did not fire.

From inside the test, "not limited" and "the window expired underneath us" are
indistinguishable, and failing on the second is a test reporting the machine
rather than the code. It now skips with the elapsed time named when the loop
outran the window, and still fails outright when it did not.

Signed-off-by: Osher-Elhadad <[email protected]>
(cherry picked from commit 26e8e50)
The limiter is charged before the argon2 verify, deliberately, because 64 MiB
per attempt is itself an amplifier. So the attempts the loop is allowed each pay
a full KDF, and on a contended machine those can outlast the limiter's own
one-minute window - at which point the earliest attempts have aged out and the
bound correctly did not fire.

From inside the test, "not limited" and "the window expired underneath us" are
indistinguishable, and failing on the second is a test reporting the machine
rather than the code. It now skips with the elapsed time named when the loop
outran the window, and still fails outright when it did not.

Signed-off-by: Osher-Elhadad <[email protected]>
(cherry picked from commit 26e8e50)
The limiter is charged before the argon2 verify, deliberately, because 64 MiB
per attempt is itself an amplifier. So the attempts the loop is allowed each pay
a full KDF, and on a contended machine those can outlast the limiter's own
one-minute window - at which point the earliest attempts have aged out and the
bound correctly did not fire.

From inside the test, "not limited" and "the window expired underneath us" are
indistinguishable, and failing on the second is a test reporting the machine
rather than the code. It now skips with the elapsed time named when the loop
outran the window, and still fails outright when it did not.

Signed-off-by: Osher-Elhadad <[email protected]>
(cherry picked from commit 26e8e50)
… conclude

Same root cause as the sign-in limiter test: each registration the loop is
allowed hashes a password with argon2 at 64 MiB, so on a contended machine the
allowed attempts outlast the limiter's one-minute window and age themselves out.
The bound then correctly does not fire, which from inside the test looks exactly
like the bypass it is checking for.

It now skips with the elapsed time named when the loop outran the window, and
still fails when it did not.

Signed-off-by: Osher-Elhadad <[email protected]>
(cherry picked from commit 0531c36)
… conclude

Same root cause as the sign-in limiter test: each registration the loop is
allowed hashes a password with argon2 at 64 MiB, so on a contended machine the
allowed attempts outlast the limiter's one-minute window and age themselves out.
The bound then correctly does not fire, which from inside the test looks exactly
like the bypass it is checking for.

It now skips with the elapsed time named when the loop outran the window, and
still fails when it did not.

Signed-off-by: Osher-Elhadad <[email protected]>
(cherry picked from commit 0531c36)
…ter tests

The form's own minlength=12 was refusing registration before the server saw it.
Server, form and hint now all say 8; the mailed code, the 5-attempt cap, the
per-email and per-address rate limits and a 64 MiB argon2id hash are what bound
online guessing.

The limiter tests are timed because each attempt they are allowed pays a full
KDF, so on a loaded machine they outlast the one-minute window they exist to
exhaust - which reads as a bypass when it is not.

Signed-off-by: Osher-Elhadad <[email protected]>
…ter tests

The form's own minlength=12 was refusing registration before the server saw it.
Server, form and hint now all say 8; the mailed code, the 5-attempt cap, the
per-email and per-address rate limits and a 64 MiB argon2id hash are what bound
online guessing.

The limiter tests are timed because each attempt they are allowed pays a full
KDF, so on a loaded machine they outlast the one-minute window they exist to
exhaust - which reads as a bypass when it is not.

Signed-off-by: Osher-Elhadad <[email protected]>
… conclude

Same root cause as the sign-in limiter test: each registration the loop is
allowed hashes a password with argon2 at 64 MiB, so on a contended machine the
allowed attempts outlast the limiter's one-minute window and age themselves out.
The bound then correctly does not fire, which from inside the test looks exactly
like the bypass it is checking for.

It now skips with the elapsed time named when the loop outran the window, and
still fails when it did not.

Signed-off-by: Osher-Elhadad <[email protected]>
(cherry picked from commit 0531c36)
… conclude

Same root cause as the sign-in limiter test: each registration the loop is
allowed hashes a password with argon2 at 64 MiB, so on a contended machine the
allowed attempts outlast the limiter's one-minute window and age themselves out.
The bound then correctly does not fire, which from inside the test looks exactly
like the bypass it is checking for.

It now skips with the elapsed time named when the loop outran the window, and
still fails when it did not.

Signed-off-by: Osher-Elhadad <[email protected]>
(cherry picked from commit 0531c36)
…ter tests

The form's own minlength=12 was refusing registration before the server saw it.
Server, form and hint now all say 8; the mailed code, the 5-attempt cap, the
per-email and per-address rate limits and a 64 MiB argon2id hash are what bound
online guessing.

The limiter tests are timed because each attempt they are allowed pays a full
KDF, so on a loaded machine they outlast the one-minute window they exist to
exhaust - which reads as a bypass when it is not.

Signed-off-by: Osher-Elhadad <[email protected]>
…ter tests

The form's own minlength=12 was refusing registration before the server saw it.
Server, form and hint now all say 8; the mailed code, the 5-attempt cap, the
per-email and per-address rate limits and a 64 MiB argon2id hash are what bound
online guessing.

The limiter tests are timed because each attempt they are allowed pays a full
KDF, so on a loaded machine they outlast the one-minute window they exist to
exhaust - which reads as a bypass when it is not.

Signed-off-by: Osher-Elhadad <[email protected]>
A fixed 5ms budget cannot mean the same thing at both ends of this machine's
range. Idle, a fake-upstream request settles near 1-2ms; with the suite
saturating 16 cores its own median was 331ms. The gate was reporting the
machine, failing about one run in three with nothing wrong.

Budget is now max(5ms, 10% of the measured baseline), which catches the ~53ms
regression at any baseline while contention that slows both handlers equally
cannot trip it. The median stays the statistic: the minimum was tried and is
worse, being one unaveraged sample - in one run the paired medians differed by
1.27ms where the paired minima differed by 8.13ms.

Signed-off-by: Osher-Elhadad <[email protected]>
(cherry picked from commit 3aad033)
@OsherElhadad
OsherElhadad changed the base branch from stack/5-security-tenant-and-scrubbing to feat/hosted-tls-and-agent-compaction August 17, 2026 08:29
@OsherElhadad
OsherElhadad merged commit a5b8c16 into feat/hosted-tls-and-agent-compaction Aug 17, 2026
5 checks passed
@github-project-automation github-project-automation Bot moved this from New/ToDo to Done in Rossoctl Issue Prioritization Aug 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant