Commit graph

39010 commits

Author SHA1 Message Date
Ishaan Jaffer
d75651912e
feat(ui/agents): add _dayjs helper with relativeTime plugin
Centralizes dayjs.extend(relativeTime) so fromNow() is typed and
loaded across the agents components. relativeOrAbsolute() falls back
to '—' for null/invalid timestamps so callers don't have to
re-implement the guard.
2026-05-06 15:12:06 -07:00
Ishaan Jaffer
be5ac1885a
test(e2e/agents): add tenant-isolation spec for Validation #8
Exercises the auth gate plumbing — present a fake token, navigate, then
swap to a fresh token and reload. Real backend partitioning is gated
on Epic A; the spec is structured so its assertions can be tightened
once the real /v2/ endpoints land.
2026-05-06 15:09:35 -07:00
Ishaan Jaffer
f6b2dda923
test(e2e/agents): add terminal-tab spec for Validation #7
Switch to the Terminal tab; mock streamer emits a terminal_chunk with
ANSI red. Assert the rendered span has computed color rgb(255, 0, 0).
2026-05-06 15:09:32 -07:00
Ishaan Jaffer
fac72a5362
test(e2e/agents): add composer spec for Validation #6
Type a message, send; assert the user_message bubble count strictly
grows. Mock provider acks the user_message synchronously — that's
enough to verify the composer plumbing without Epic A.
2026-05-06 15:09:27 -07:00
Ishaan Jaffer
36ac39d3af
test(e2e/agents): add sse-reconnect spec for Validation #5
Mid-stream, page.context().setOffline(true)/(false); event count never
regresses and continues climbing after reconnect. Exercises the seq
dedup branch of useSessionEventStream.
2026-05-06 15:09:24 -07:00
Ishaan Jaffer
50b2ad9482
test(e2e/agents): add live-stream spec for Validation #4
Inside a session, poll until ≥3 events have rendered in the conversation
pane (combination of message bubbles and tool-call cards). Mock provider
ticks every 400ms so this lands well under the 10s budget.
2026-05-06 15:09:22 -07:00
Ishaan Jaffer
bf6017a5b7
test(e2e/agents): add create-session spec for Validation #3
From /agents/{aid}, click + New Session, fill repo URL; assert the URL
redirects into the three-pane view and the status pill shows
'provisioning'.
2026-05-06 15:09:16 -07:00
Ishaan Jaffer
f4e29c1c74
test(e2e/agents): add create-agent spec for Validation #2
Open New Agent dialog, fill name + model, submit; assert the new row
shows up in the table within 5s. Definition only — no VM.
2026-05-06 15:09:14 -07:00
Ishaan Jaffer
9b3b656671
test(e2e/agents): add list-agents spec for Validation #1
Routes load — /agents, /agents/{aid}, /agents/{aid}/sessions/{sid}
each render their primary container. Captures console errors and
asserts none on the list view.
2026-05-06 15:09:11 -07:00
Ishaan Jaffer
cc96c81e4b
test(e2e/agents): add shared _helpers (fake JWT + auth cookie)
useAuthorized requires an unexpired JWT in the `token` cookie before it
renders. We mint an unsigned 1-hour token here — jwt-decode never
verifies the signature, so any structurally valid base64 payload works.
Helper plus an AGENTS_DEV_URL constant (overridable via env).
2026-05-06 15:09:05 -07:00
Ishaan Jaffer
ffd37b7ed8
test(e2e/agents): add e2e:agents npm script
Wraps the agents-suite Playwright config so it can run alongside the
existing e2e suite without colliding on globalSetup.
2026-05-06 15:09:02 -07:00
Ishaan Jaffer
59e1293c10
test(e2e/agents): add Playwright config for cloud-agents suite
Targets http://localhost:3000 (Next.js dev server) directly. The agents
UI lives in App Router routes which only render under `next dev`, not
the proxy's static export — separate config skips the proxy globalSetup
that the rest of the suite needs.
2026-05-06 15:09:00 -07:00
Ishaan Jaffer
aae137ad00
feat(ui/agents): add /agents/[agent_id]/sessions/[session_id] route page
Three-pane session view. Resolves auth via useAuthorized and passes
the agent_id + session_id params to ThreePane.
2026-05-06 15:05:42 -07:00
Ishaan Jaffer
f990d6a1b7
feat(ui/agents): add /agents/[agent_id] route page
Per-agent landing page. Resolves auth via useAuthorized and passes the
agent_id param to AgentDetail.
2026-05-06 15:05:40 -07:00
Ishaan Jaffer
fbe22ea796
feat(ui/agents): add AgentDetail for /agents/{aid}
Renders the agent identity, system prompt, and SessionList for this
agent. Settings hand-off link points at /settings/cloud-agents/ (Epic
G's territory) per coordination note in E1.md.
2026-05-06 15:05:38 -07:00
Ishaan Jaffer
4610bee1cc
feat(ui/agents): add ThreePane orchestrator
Owns the SessionList sidebar, conversation snapshot fetch, run snapshot
fetch, and SSE subscription. Distributes events to Conversation and
RightPanel as props — the children are presentational.
2026-05-06 15:05:31 -07:00
Ishaan Jaffer
6727e5a862
feat(ui/agents): add RightPanel with Git/Terminal tabs
Wraps GitTab and TerminalTab in an antd Tabs component. Defaults to
Git per the LIT-2881 layout.
2026-05-06 15:05:29 -07:00
Ishaan Jaffer
cf7c3decba
feat(ui/agents): add TerminalTab with ANSI rendering
Read-only ANSI tail of terminal_chunk events. Tiny SGR parser handles
foreground colors and bold; resets on \x1b[0m. Anything else (cursor
moves, 256-color, truecolor) is dropped. data-testid='ansi-#ff0000'
exposes the red span for Validation #7.
2026-05-06 15:05:27 -07:00
Ishaan Jaffer
d8636c2b57
feat(ui/agents): add GitTab for right panel
Combines the active Run's git.branches with live git_commit / pr_opened
events. Shows branches, PR link (live event wins over snapshot), and
commits sorted newest-first.
2026-05-06 15:03:43 -07:00
Ishaan Jaffer
289f9498a2
feat(ui/agents): add Conversation pane
Middle pane unioning the initial conversation snapshot with live SSE
events. user_message and assistant_message render as MessageBubble;
tool_call as ToolCallCard; file_diff folds into FilesChangedAccordion.
2026-05-06 15:03:40 -07:00
Ishaan Jaffer
707537ed52
feat(ui/agents): add Composer
Textarea + Send at the bottom of the conversation pane. POSTs to
/v2/sessions/{sid}/followup; the resulting user_message lands via the
SSE stream.
2026-05-06 15:03:38 -07:00
Ishaan Jaffer
51bcb5635c
feat(ui/agents): add FilesChangedAccordion
Aggregates file_diff events into a 'N Files Changed' collapsible at
the bottom of the conversation pane. Cumulative across the run per
LIT-2881 spec — latest patch wins, additions/deletions sum per path.
2026-05-06 15:03:33 -07:00
Ishaan Jaffer
3836af5681
feat(ui/agents): add ToolCallCard
Collapsible card for assistant tool invocations from tool_call events.
Cursor Cloud Agents-style: collapsed shows tool + preview; expanded
shows full input (and result, when present).
2026-05-06 15:03:31 -07:00
Ishaan Jaffer
c7d820a83e
feat(ui/agents): add MessageBubble for conversation pane
Renders user/assistant/tool/system messages with role-tagged styling.
Tool calls render via ToolCallCard, not this bubble.
2026-05-06 15:03:28 -07:00
Ishaan Jaffer
02b7527883
feat(ui/agents): add NewSessionDialog
Modal collecting a repo URL, posts to createCloudSession, then surfaces
the new session to the parent for redirect into the three-pane view.
2026-05-06 15:03:22 -07:00
Ishaan Jaffer
3e2a4dacc5
feat(ui/agents): add SessionList sidebar
Vertical list of SessionRow under the active agent with a + New action
pinned to the header. Shared by /agents/{aid} and the three-pane view.
2026-05-06 15:03:20 -07:00
Ishaan Jaffer
799f02b585
feat(ui/agents): add SessionRow component
Single sidebar entry showing session title, status pill (antd Tag, gold for
provisioning), branch and last-updated timestamp. Links to the three-pane
view at /agents/{aid}/sessions/{sid}.
2026-05-06 15:03:15 -07:00
Ishaan Jaffer
8d410d3552
style(ui/agents): apply prettier to NewAgentDialog 2026-05-06 15:02:50 -07:00
Ishaan Jaffer
1414cfdb71
style(ui/agents): apply prettier to AgentList 2026-05-06 15:02:49 -07:00
Ishaan Jaffer
e5f372091a
style(ui/agents): apply prettier to cloud-agents types 2026-05-06 15:02:48 -07:00
Ishaan Jaffer
51eb3c7314
fix(ui/agents): note /v2/ namespace in mock-agents docstring 2026-05-06 15:02:16 -07:00
Ishaan Jaffer
214ff1a2a4
fix(ui/agents): rewrite cloud-agents API client to /v2/ namespace
The existing /v1/agents endpoint is reserved for the A2A registry. The new
VM-agent API used by this dashboard moves under /v2/.
2026-05-06 15:02:12 -07:00
Ishaan Jaffer
d2601ee875
feat(ui/agents): add /agents list page
Renders the AgentList with a 'New Agent' affordance. Uses useAuthorized
for the access token and the cloud-agents-client for the fetch. In mock
mode this works without a backend so the UI can be developed alongside
Epic A.
2026-05-06 14:54:40 -07:00
Ishaan Jaffer
25cbe4c210
feat(ui/agents): add NewAgentDialog
antd Modal + Form that posts a new cloud-agent definition. Definition-
only — no VM is provisioned at creation time.
2026-05-06 14:54:37 -07:00
Ishaan Jaffer
a9419c514f
feat(ui/agents): add AgentList component
antd Table that renders cloud-agent definitions and links each row to
/agents/{agent_id}. Uses Tag for the model and dayjs.fromNow for the
last-activity column. Empty state is the antd Empty placeholder.
2026-05-06 14:54:31 -07:00
Ishaan Jaffer
1f5c3fd9f2
feat(ui/agents): add useSessionEventStream SSE hook
EventSource hook with auto-reconnect, seq-cursor resume, and dedup.
On error closes the stream and re-opens after 1s backoff, passing
since_seq=<lastSeq> so the server replays missed events. In mock mode
replays MOCK_RUN_EVENTS at 400ms cadence so the UI looks live, and
listens for window offline/online so Playwright can exercise the
reconnect path.
2026-05-06 14:54:29 -07:00
Ishaan Jaffer
2fb39467a7
feat(ui/agents): add cloud-agents API client
Proxy-routed fetches for agents, sessions, runs, conversation, and
followup. Mock-aware: short-circuits to mock-agents.ts when
NEXT_PUBLIC_USE_MOCK_AGENTS=true. Centralizes the SSE URL shape via
buildRunEventStreamUrl so the hook just opens the EventSource.
2026-05-06 14:54:21 -07:00
Ishaan Jaffer
1015bc17db
feat(ui/agents): add mock data provider
Wired via NEXT_PUBLIC_USE_MOCK_AGENTS=true. Temporary shim until Epic A
(LIT-2877) lands the real /v1/agents, /v1/sessions, conversation, and
event-stream endpoints. Shapes mirror the API spec for a one-line swap.
Includes a canned MOCK_RUN_EVENTS sequence used by the SSE hook.
2026-05-06 14:54:18 -07:00
Ishaan Jaffer
ae607acb22
feat(ui/agents): add CloudAgent type definitions
Mirrors the API spec from LIT-2877 (Epic A). Single source of truth for
the dashboard so components don't redefine shapes inline. Namespaced
`Cloud*` to avoid colliding with the legacy proxy-side Agent type.
2026-05-06 14:54:02 -07:00
ishaan-berri
487479eff7
perf: cap Prometheus end-user metric cardinality with TTL + LRU eviction (#27272)
Co-authored-by: Yassin Kortam <yassinkortam@g.ucla.edu>
2026-05-06 13:35:13 -07:00
oss-agent-shin
c8e47dcb43
Fix early proxy request size enforcement (#27311)
* Add early proxy request size guard

Co-authored-by: ishaan-berri <ishaan-berri@users.noreply.github.com>

* Address request size review feedback

Co-authored-by: ishaan-berri <ishaan-berri@users.noreply.github.com>

---------

Co-authored-by: oss-agent-shin <279349115+oss-agent-shin@users.noreply.github.com>
Co-authored-by: ishaan-berri <ishaan-berri@users.noreply.github.com>
2026-05-06 12:29:11 -07:00
Dibyo Mukherjee
169c436684
Fix/member access group team (#27317)
* fix(auth): pass team_id in member-level model access check

_check_team_member_model_access calls _can_object_call_model without
team_id, so access groups defined via model_info.access_groups cannot
resolve for team-scoped DB models (their internal router name is
model_name_<team>_<uuid>, not the public name). The team-level check
already passes team_id; this mirrors that.

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

* test(auth): add tests for member-level access group resolution with team_id

Eight tests covering _can_object_call_model and
_check_team_member_model_access with team-scoped DB models:

- access group resolves when team_id is passed
- access group fails without team_id (pre-fix behavior)
- literal model name still works with team_id (no regression)
- denied model still denied with team_id
- second model in group also reachable
- end-to-end member access via access group (mocked membership)
- end-to-end member denied for model not in allowed list
- no-override member inherits team-level check

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

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-06 12:05:22 -07:00
oss-agent-shin
d90cf56245
Fix SCIM user lookup filters (#27308)
* Fix SCIM Okta userName lookup

Co-authored-by: ishaan-berri <ishaan-berri@users.noreply.github.com>

* fix scim user filter typing

Co-authored-by: ishaan-berri <ishaan-berri@users.noreply.github.com>

---------

Co-authored-by: oss-agent-shin <279349115+oss-agent-shin@users.noreply.github.com>
Co-authored-by: ishaan-berri <ishaan-berri@users.noreply.github.com>
2026-05-06 11:58:47 -07:00
ishaan-berri
c92a08a307
Fix team member budget enforcement without user row (#27273)
* Fix team member budget enforcement without user row

Co-authored-by: ishaan-berri <ishaan-berri@users.noreply.github.com>

* Clarify regenerated key budget repro

Co-authored-by: ishaan-berri <ishaan-berri@users.noreply.github.com>

---------

Co-authored-by: oss-agent-shin <279349115+oss-agent-shin@users.noreply.github.com>
Co-authored-by: ishaan-berri <ishaan-berri@users.noreply.github.com>
2026-05-06 11:42:29 -07:00
Yassin Kortam
b1f577199a
fix(proxy): keep spend log cleanup running after batch failures and surface DB errors (#27303)
Co-authored-by: Yassin Kortam <yassinkortam@g.ucla.edu>
2026-05-06 18:39:15 +00:00
Mateo Wang
b83d11351f
proxy: hot-reload config YAML when --reload is set (#27274)
* proxy: hot-reload config YAML when --reload is set

Uvicorn's --reload only watches *.py by default, so editing the
--config YAML did not restart the proxy. _get_reload_options() now
extends reload_dirs/reload_includes with the config file's directory
and basename when --config is provided.

* proxy: qualify reload_includes with absolute config path

Address Greptile review on PR #27274. When the --config file lives
outside cwd, reload_includes previously stored only the basename, which
meant uvicorn/watchfiles would also reload on edits to any same-named
file inside cwd. Use the absolute config path as the include pattern in
that case so only the actual proxy config triggers a restart.

Co-authored-by: Mateo Wang <mateo-berri@users.noreply.github.com>

* fix(proxy): use basename for reload_includes config pattern

Uvicorn's resolve_reload_patterns() calls pathlib.Path.glob(), which
raises NotImplementedError on absolute patterns (uvicorn discussion
2156). Passing config_abs (an absolute path) when the config file lived
outside cwd crashed startup under --reload. The config_dir is already
added to reload_dirs, so using just the basename as the include pattern
is sufficient to match the specific config file.

* fix: make it reload app when yaml changes

* style: remove unneeded comments

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Mateo Wang <mateo-berri@users.noreply.github.com>
2026-05-06 16:06:58 +00:00
Yassin Kortam
bd1ea0252a
perf(proxy): run daily activity aggregation off the event loop (#27264)
Some checks are pending
Unit Tests: Proxy DB Operations / custom-logging (push) Blocked by required conditions
Unit Tests: Proxy DB Operations / logging-misc (push) Blocked by required conditions
Unit Tests: Proxy DB Operations / assert-shard-coverage (push) Waiting to run
Unit Tests: Proxy DB Operations / auth-checks (push) Blocked by required conditions
Unit Tests: Proxy DB Operations / budgets (push) Blocked by required conditions
Unit Tests: Proxy DB Operations / db-and-spend (push) Blocked by required conditions
Unit Tests: Proxy DB Operations / endpoints-and-responses (push) Blocked by required conditions
Unit Tests: Proxy DB Operations / guardrails-hooks (push) Blocked by required conditions
Unit Tests: Proxy DB Operations / jwt-and-keys (push) Blocked by required conditions
Unit Tests: Proxy DB Operations / key-generation (push) Blocked by required conditions
Unit Tests: Proxy DB Operations / proxy-runtime (push) Blocked by required conditions
Unit Tests: Proxy DB Operations / proxy-server-core (push) Blocked by required conditions
Unit Tests: Proxy DB Operations / schema-migration (push) Blocked by required conditions
Unit Tests: Proxy DB Operations / proxy-utils (push) Blocked by required conditions
Unit Tests: Security / security (push) Waiting to run
Unit Tests: Caching (Redis) / caching-redis (push) Waiting to run
Co-authored-by: Yassin Kortam <yassinkortam@g.ucla.edu>
2026-05-05 20:19:28 -07:00
ishaan-berri
c32ad90823
Fix Prometheus custom metadata label counts (#27268) (#27271)
* Fix Prometheus custom metadata label counts (#27268)

Co-authored-by: oss-agent-shin <279349115+oss-agent-shin@users.noreply.github.com>
Co-authored-by: ishaan-berri <ishaan-berri@users.noreply.github.com>

* fix enterprise test: update positional label assertions to keyword args

prometheus_label_factory now calls .labels() with keyword arguments.
Update test_async_log_failure_event assertion to match.

---------

Co-authored-by: oss-agent-shin <ext-agent-shin@berri.ai>
Co-authored-by: oss-agent-shin <279349115+oss-agent-shin@users.noreply.github.com>
Co-authored-by: ishaan-berri <ishaan-berri@users.noreply.github.com>
2026-05-05 20:04:56 -07:00
ishaan-berri
e9fb29061a
Include model name + configured TPM/RPM in priority rate-limit 429 er… (#27216)
* Include model name + configured TPM/RPM in priority rate-limit 429 errors (#27215)

* Include model name + configured TPM/RPM in priority rate-limit 429 errors

The current 429 message ('Priority-based rate limit exceeded. Priority: prod,
Rate limit type: tokens, Remaining: -664145, Model saturation: 86.3%') doesn't
tell the operator which model was hit or what the configured limit is, so they
can't tell whether the priority allocation needs tuning or the model TPM is
just too small.

Add Model, Model TPM, and Model RPM to both the priority-based 429 and the
sibling Model-capacity 429 in dynamic_rate_limiter_v3._check_rate_limits.
Pure error-message change — no behavior or schema impact.

* test: assert priority 429 includes model name + configured TPM/RPM

Adds a regression test for the new fields in the priority-based 429 detail
('Model:', 'Model TPM:', 'Model RPM:'). Verified locally that the test
fails against the unpatched dynamic_rate_limiter_v3.py and passes after
the patch.

---------

Co-authored-by: shin-watcher <ext-agent-shin@berri.ai>

* Update litellm/proxy/hooks/dynamic_rate_limiter_v3.py

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>

* Update litellm/proxy/hooks/dynamic_rate_limiter_v3.py

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>

---------

Co-authored-by: shin-watcher <ext-agent-shin@berri.ai>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
2026-05-05 19:05:22 -07:00
Dennis Henry
73de892654
fix: replace user api key auth with authorization or cookie for mcp server creation (#27190)
* fix: replace user api key auth with authorization or cookie for mcp server creation

* updated tests
2026-05-05 18:36:22 -07:00