Repository navigation
fix(ui): preserve full AgentCore runtime ARN in agent edit form - #39382
Conversation
|
|
Greptile SummaryThe PR preserves complete AgentCore runtime ARNs when dynamic agent data is loaded into the edit form and adds client-side ARN validation.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains; both previously reported issues are resolved at the current head.
|
| Filename | Overview |
|---|---|
| ui/litellm-dashboard/src/app/(dashboard)/agents/_components/agent_type_utils.ts | The immutable split/map parser correctly preserves slash-containing values for all currently configured single-placeholder model templates. |
| ui/litellm-dashboard/src/app/(dashboard)/agents/_components/dynamic_agent_form_fields.tsx | Regex construction is now guarded, fully resolving the prior malformed-pattern render failure while retaining required-field validation. |
| litellm/proxy/public_endpoints/agent_create_fields.json | AgentCore metadata now supplies a valid runtime ARN pattern and actionable validation message. |
| ui/litellm-dashboard/src/app/(dashboard)/agents/_components/agent_info.integration.test.tsx | Integration tests cover full ARN preservation, truncated ARN rejection, and malformed validation-pattern handling. |
Reviews (2): Last reviewed commit: "fix(ui): preserve full AgentCore runtime..." | Re-trigger Greptile
parseDynamicAgentForForm recovered a credential field's value from a stored model string by splitting both the model_template and the model on "/" and matching by array index. That breaks for any placeholder value that itself contains "/", such as a Bedrock AgentCore runtime ARN resource path (runtime/<runtime-id>), silently dropping everything after the first slash when populating the edit form. Saving without touching the field then persisted the truncated ARN. Replace the index-matching split with a non-mutating template parse (split on the placeholder pattern, escape and rejoin the literal segments into a regex) so a placeholder captures everything it needs regardless of embedded slashes. Also add a lightweight ARN-shape validator for the AgentCore runtime ARN field, guarded against a malformed pattern string, so a truncated value is rejected client-side before it reaches the backend. Resolves LIT-6737
ee96243 to
443f8df
Compare
|
@greptileai please review the current head 443f8df. Addressed both round-1 findings: extractModelTemplateValues now splits on the placeholder pattern instead of mutable accumulators (agent_type_utils.ts), and the validation_pattern regex construction is wrapped in try/catch with a new regression test covering a malformed pattern string (dynamic_agent_form_fields.tsx). |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
TLDR
Problem this solves:
How it solves it:
User Flow
Before: opening an AgentCore agent's settings and saving without any changes corrupts its runtime ARN
arn:aws:bedrock-agentcore:eu-central-1:123456789012:runtime, missing everything afterruntime/After: the same flow shows and saves the complete ARN every time, and a bad value is caught before it can be saved
runtime/Relevant issues
Linear ticket
Resolves LIT-6737
Pre-Submission checklist
Please complete all items before asking a LiteLLM maintainer to review your PR
uv run pytest tests/test_litellm/<your_test_file>.py -v. Leave the suites (make test-unit-*,make test-unit) to CI: it finishes in ~15 minutes where a laptop takes an hour or more@greptileaito re-request a review after pushing changes)Delays in PR merge?
If you're seeing a delay in your PR being merged, ping the LiteLLM Team on Slack (#pr-review).
Screenshots / Proof of Fix
Setup shared across cases: local proxy + Postgres, and the dashboard dev server, both from this branch. An AgentCore agent was created through
POST /v1/agentswithlitellm_params.modelset tobedrock/agentcore/arn:aws:bedrock-agentcore:eu-central-1:123456789012:runtime/hosted_agent_4vm3i-BaTdfOELAs, then edited through the Admin UI (Agents -> agent -> Settings -> Edit Settings).Before (a677242)
Edit form displays and saves the runtime ARN
runtime/:GET /v1/agents/{agent_id}now returns the truncated value:Malformed ARN is rejected before saving
After (443f8df)
Edit form displays and saves the runtime ARN
GET /v1/agents/{agent_id}returns the byte-identical full ARN:Malformed ARN is rejected before saving
arn:aws:bedrock-agentcore:eu-central-1:123456789012:runtime, missing the resource id) and click "Save Changes". The field shows a validation error and the request never goes out:GET /v1/agents/{agent_id}confirms the stored value is unchanged (still the full ARN from the previous case)Type
🐛 Bug Fix
Caveats
Low
runtime/); it is not a full ARN grammar validator, matching the acceptance criteria's ask for a lightweight checkFinal Attestation