Commit Graph

4928 Commits

Author SHA1 Message Date
Katia Bulatova 012ce0de53 test(webapp): drop an unsafe optional chain from the sweep boundary test 2026-08-06 09:39:17 +00:00
Katia Bulatova bd2559a7a8 fix(webapp): record only a real evaluation from a batch tick
An unreadable check is not an observation, so writing it moved the watch down the
rotation for a whole cadence and overwrote the facts a streak lives in.
2026-08-06 09:39:16 +00:00
Katia Bulatova e4852090aa perf(webapp): resolve the sweep's authorization and readers once per group
An incident expires a whole group at once, which is the worst time to repeat the
same authorization read per row. Bounded concurrency caps one tenant's share.
2026-08-06 09:39:15 +00:00
Katia Bulatova d2511bd264 fix(webapp): hand the sweep's final check the previous facts
A stateful condition is a transition across checks, so a boundary evaluation
without the last observation can never see a stall and records a reset.
2026-08-06 09:39:15 +00:00
Katia Bulatova d12e6a85ca style(webapp): merge duplicate imports on the user-actor auth path 2026-08-06 09:24:09 +00:00
Katia Bulatova f58a9dcc89 fix(webapp): only let the browser set the agent's page context
The chat turn's metadata is now a whitelist: the page the user is on is all the browser can set, and every identity, tenancy and token field is filled in by the server.
2026-08-06 09:24:09 +00:00
Katia Bulatova d51cb9a736 fix(webapp): stop the OSS fallback handing a delegated token blanket access
Without an RBAC plugin, a user-actor token got the same permissive ability a personal access token gets. It now gets only what its own scope cap allows, and reads only when it declares no cap. Personal access tokens are unchanged.
2026-08-06 09:24:08 +00:00
Katia Bulatova 9d45284112 fix(webapp): keep the agent token's environment claim on the actor through every route builder
The claim rode beside the authentication result, so a route builder that only forwarded the user id lost it. It now travels on the authenticated actor itself, and a route's resolved org/project/environment is checked against it — a mismatch fails closed.
2026-08-06 09:24:07 +00:00
Katia Bulatova f5a146b30c fix(webapp): cap the agent's body on any method and on a mixed-case path 2026-08-06 08:50:11 +00:00
Katia Bulatova 85b98ab8dc fix(webapp): mint the agent's token for the caller's own environment, or not at all 2026-08-06 08:20:52 +00:00
Katia Bulatova 62b598da27 docs(webapp): say which layer refuses an oversized agent body
The route-level check only sees a declared content-length; a body without one is
already ended mid-stream by the ingress cap.
2026-08-06 07:14:41 +00:00
Katia Bulatova 1cdf1f087d refactor(webapp): split the dashboard agent's maintenance cron along the watch seam
dashboardAgent.sweepWatches ran the watch sweep, the investigation sweep, the
batch re-arm and eval retention together. Watch is about to ship as its own
stacked PR, so the job is split where the cut will be: dashboardAgent.maintenance
keeps the investigation sweep and eval retention, dashboardAgent.watchMaintenance
takes watch expiry, delivery and the batch re-arm. Same cadence, and each backstop
keeps its own try/catch.
2026-08-06 07:14:41 +00:00
Katia Bulatova 50fd10bf1b fix(webapp): replay a watch submission's recorded outcome instead of re-running it
A retried card submit was only repairable while the first attempt's watch was
still active. Once it had fired, expired, or answered in one shot, the retry
re-evaluated the condition and created a second operation.

A watch_submissions ledger, keyed (chat_id, client_request_id), is now written
before the condition is read and carries the outcome once there is one. A retry
looks it up first: a recorded outcome is replayed, a different draft under the
same id conflicts, and only a pending row proceeds - converging on the watch id
reserved up front rather than creating another.
2026-08-06 07:14:40 +00:00
Katia Bulatova 4ff8859e1d fix(webapp): keep the agent's alert delete to channels the watch type is on 2026-08-06 01:54:46 +00:00
Katia Bulatova cbc2edc879 test(webapp): pin the watch submit's ordering, its retry repair and its refusal record 2026-08-06 01:54:45 +00:00
Katia Bulatova 49a953871a fix(webapp): record a watch request before the watch starts, and repair a retried submit 2026-08-06 01:54:44 +00:00
Katia Bulatova 28b1f3896c fix(webapp): cap the agent's request body while it streams, not after
The message-size checks ran after the body had been read, so a request without a
content-length was buffered and parsed in full before being refused. An ingress
cap on the agent's paths now counts the bytes as they arrive, and the chat proxy
reads its body with a ceiling instead of reading it whole first.
2026-08-06 01:53:17 +00:00
Katia Bulatova d719c9b2d3 fix(webapp): start the wake poll for a browser that has only an active watch
The page load reported unread wakes only, so a fresh browser whose watch was
created elsewhere and hasn't fired yet never started polling: the wake landed
without a toast or a dot until a reload. The loader now returns the active-watch
presence too, in one read per page load.
2026-08-06 01:53:16 +00:00
Katia Bulatova e599f1299c fix(dashboard-agent): rotate an over-cap watch group instead of starving it
The batch took the 500 soonest-expiring watches of a group every tick, so a group
larger than the cap could leave the rest unchecked until the first 500 expired.
The group is now ordered least-recently-checked first, with a generated
cadence_minutes column and an index so the due predicate no longer re-parses the
spec JSON per tick.
2026-08-06 01:53:15 +00:00
Katia Bulatova 42a76fb93d perf(dashboard-agent): say a settled watch outcome without a model, and narrate the rest with Haiku 2026-08-06 00:49:01 +00:00
Katia Bulatova f96361452a chore(webapp): restore the dashboard agent's flag gate 2026-08-06 00:38:40 +00:00
Katia Bulatova fc32fc61e2 refactor(webapp): split the suggested-prompt registry by responsibility
The chip factory and slot vocabulary, the evergreen docs chips, the per-page slot
table and the signal chips each get their own module; registry.ts is now the
public face that re-exports them. A pure move.
2026-08-06 00:13:25 +00:00
Katia Bulatova 4876e074ed refactor(webapp): give each watch condition family its own module
dashboardAgentWatchChecks.ts keeps the dispatcher, the failure envelope and the
previous-facts reader, and re-exports the run, queue, error and health families
plus the shared reader contract. A pure move; every import path is unchanged.
2026-08-06 00:13:25 +00:00
Katia Bulatova a4b4ef1b55 feat(webapp): let an organization turn off judging of its agent turns
A per-org feature flag the agent checks before every judged turn, and a turn is judged only
on an explicit yes.
2026-08-06 00:11:23 +00:00
Katia Bulatova 7f13add1a0 feat(webapp): retire judged-turn rows after 30 days
The table is append-only quality data with no reader, so the sweep now drops rows past
the period in one bounded statement per run.
2026-08-06 00:11:21 +00:00
Katia Bulatova 08dc7ba732 fix(webapp): keep the watch card in step with its draft, and frozen while it submits 2026-08-05 23:48:03 +00:00
Katia Bulatova c3ee6a4dbe perf(webapp): resolve the agent card's links in one request 2026-08-05 23:48:02 +00:00
Katia Bulatova ebad471b43 fix(webapp): cap the size of a message to the agent 2026-08-05 23:48:01 +00:00
Katia Bulatova a0d06e4eec fix(webapp): send the agent wake signal to a browser that has never opened the panel 2026-08-05 23:48:01 +00:00
Katia Bulatova d6debe8fb7 test(webapp): cover the user-actor token's environment scope on every route that accepts one 2026-08-05 23:34:45 +00:00
Katia Bulatova 5b5a25882f fix(webapp): scope a delegated user-actor token to the environment it was minted for 2026-08-05 23:34:44 +00:00
Katia Bulatova a88228c838 chore(webapp): move the agent storybook gallery out to a follow-up
The gallery pages, their fixtures and the screenshot script only exist to
look at the agent UI, so they ship separately. The fixtures two unit tests
read — the report view models and the page contexts — stay here.
2026-08-05 22:30:45 +00:00
Katia Bulatova 8b042bed30 perf(webapp): skip the admin read on the watch authorization path 2026-08-05 22:17:43 +00:00
Katia Bulatova 1dd85367b7 perf(webapp): answer the wake poll with one narrow read per database 2026-08-05 22:17:42 +00:00
Katia Bulatova d26a28b0e6 perf(webapp): only poll the wake feed for a browser that knows a watch exists 2026-08-05 22:17:41 +00:00
Katia Bulatova e109a243f5 fix(webapp): read the alert channel and the watch target on the primary 2026-08-05 22:17:41 +00:00
Katia Bulatova fc4381d50e fix(webapp): keep the agent wake poll to one chain per tab 2026-08-05 22:17:40 +00:00
Katia Bulatova 9b4e4734a1 perf(dashboard-agent): share one 1h-TTL prompt cache between head start and the agent
Head start passed `system` as a bare string, so Anthropic neither wrote nor read
the cache: the ~18.4k-token prefix was billed in full and the agent's step 2 then
paid for a fresh write. Both breakpoints now carry a 1-hour TTL.

The two prefixes were also not identical — `get_run` sat in a different position in
the agent's tool set than in the canonical schema-only one, so they could never have
shared a cache. Reordered, and a fingerprint over system text + tool definitions is
logged per model call alongside the provider's cache-write, cache-read and uncached
input token counts, so a future drift is visible instead of silent.
2026-08-05 22:16:30 +00:00
Katia Bulatova d4f0357ac1 chore(webapp): move the gallery's transcripts into the storybook fixtures and drop demo-chats 2026-08-05 22:12:44 +00:00
Katia Bulatova 0760f1b55d refactor(webapp): give the agent cards one card primitive 2026-08-05 22:12:42 +00:00
Katia Bulatova 3f85acc2a7 fix(webapp): give the diagnosis card links a focus ring via a TextLink variant 2026-08-05 22:12:41 +00:00
Katia Bulatova 5a80876b16 fix(webapp): ring the unread dot against the navbar surface 2026-08-05 22:12:40 +00:00
Katia Bulatova 9b32bfda66 fix(webapp): let agent chips follow the interface-contrast control 2026-08-05 22:12:39 +00:00
Katia Bulatova fd83288906 fix(webapp): drop the metric sparkline to its own line on a narrow panel 2026-08-05 22:12:38 +00:00
Katia Bulatova 3773f31d22 fix(webapp): route the report's stale-data badge through AgentBadge 2026-08-05 22:12:37 +00:00
Katia Bulatova 5800e8929d chore: drop the unrendered demo cards and fold the release notes back into one 2026-08-05 21:49:37 +00:00
Katia Bulatova 8d3676a874 chore: oxfmt the lines the removed comments let collapse 2026-08-05 21:38:32 +00:00
Katia Bulatova 9270caf715 chore(webapp): cut the watch service and route comments to their invariants 2026-08-05 21:38:24 +00:00
Katia Bulatova 5153cca045 chore: restore the comments an off-by-one over-trimmed 2026-08-05 21:38:13 +00:00
Katia Bulatova 9b7ca8c1de chore: bring the last three-line comments down to two 2026-08-05 21:37:46 +00:00