Backtestslitellmrun-20261111-220245#48363

Issue #48363 Merged fix PR #48431 Run 11 Nov 2026 · run-20261111-220245 BerriAI/litellm

[Bug]: Admin UI Router Settings renders no input for String-typed general_settings fields (spend-log retention, cleanup run budget/timeout)

Better

Our patch was judged better than the merged fix.

In this judgment, Patch A = our agent, Patch B = the merged fix.

The independent tests give no signal: every run on base, A and B failed with the same FileNotFoundError for the node binary, so the verdict rests on the diffs. Both patches fix the root cause the same way, by adding a `String` branch to SettingValueEditor that renders an Input with aria-label, shows the stored value, and feeds onChange so Update submits the typed value; both add integration tests that would fail before and pass after. The difference is at the edges. Patch A mirrors the existing List handling: it trims input, maps an emptied field to null, and extends the update handler so an emptied String field triggers handleResetField (delete) rather than an update, and its key on stored_in_db makes the uncontrolled input reset after a delete, matching the List branch's visible convention. Patch B passes the raw string through, so clearing the box and clicking Update sends an empty string to updateConfigFieldSetting and stores "" in the DB for duration-style settings like retention periods, which is an untested and likely harmful state the existing code deliberately avoids for Select/List. B's controlled input is fine but offers no equivalent safeguard. B's test does usefully exercise the trash-icon reset path, and A's tests cover display, update with trimming, and clear-on-empty; test quality is comparable. On correctness at the issue's edges and consistency with surrounding conventions, A is the better fix.

Four judges ruled on this ticket in parallel, and the verdict comes from counting their votes. Each saw the issue and the two patches, labelled A and B in random order (two of them saw ours as A), with issue links and version numbers removed. Where tests could check the fix, they also saw the results of tests a separate agent wrote for the issue, run on both patches. None was told which patch was ours. The reasoning above is one judge's, shown verbatim.

Solve

3m 42s

Wall-clock time in the container

Full test suite

Not run

The harness did not reach the test stage

Contamination audit

Clean

No sign the agent saw the real fix

Patch size

76vs 45 merged

Changed lines, ours vs merged

Description

On the Admin UI page /ui/router-settings/ (General Settings card), every general_settings field whose field_type is "String" renders an empty value cell — no input control at all. The row shows only the description, the status badge ("Not Set" / "In DB") and the Update/reset buttons. Clicking "Update" submits nothing (field_value is undefined), so these settings cannot be viewed or edited from the UI.

Integer-typed fields on the same page (maximum_spend_logs_cleanup_batch_size, maximum_spend_logs_cleanup_max_batches) render a normal number input — only String fields are affected.

Affected fields (all declared "String" by the backend):

field_namefield_type
maximum_spend_logs_retention_periodString
maximum_health_check_retention_periodString
maximum_daily_tag_spend_retention_periodString
maximum_spend_logs_cleanup_run_budgetString
maximum_spend_logs_cleanup_batch_timeoutString

Once a value is set via the API, it is not displayed either (the cell stays empty), so operators can't see the current value in the UI — the row's trash/reset button still works.

<!-- Failed to upload "image.png" -->

Config

run litellm in docker compose with default config

LiteLLM Version

v1.106.0

Steps to Repro

  1. Start litellm proxy with store_model_in_db: true and the bundled Admin UI.
  2. Log in as admin, open /ui/router-settings/, scroll to the General Settings table.
  3. Compare rows: maximum_spend_logs_cleanup_batch_size (Integer) shows an input box; maximum_spend_logs_retention_period (String) shows an empty cell with only "Not Set" + "Update".

Which part of LiteLLM is this about?

Admin UI

How are you deploying?

Docker

The two patches

Our patch+75 −1
ui/litellm-dashboard/src/app/(dashboard)/router-settings/_components/general_settings.integration.test.tsxindex 35434830d9..d08bb7e550 100644@@ -209,6 +209,64 @@ it("clears a stored List setting when Update is clicked on an emptied input", as   expect(screen.getByRole("textbox", { name: "transcribe_media_buckets" })).toHaveValue(""); }); +it.each([+  "maximum_spend_logs_retention_period",+  "maximum_health_check_retention_period",+  "maximum_daily_tag_spend_retention_period",+  "maximum_spend_logs_cleanup_run_budget",+  "maximum_spend_logs_cleanup_batch_timeout",+  "mcp_client_id_header",+])("shows and persists the String setting %s through a text input", async (fieldName) => {+  vi.mocked(getGeneralSettingsCall).mockResolvedValue([+    {+      field_name: fieldName,+      field_type: "String",+      field_value: null,+      field_description: "string setting",+      stored_in_db: null,+    },+  ]);+  vi.mocked(updateConfigFieldSetting).mockClear();+  const user = userEvent.setup();+  renderWithProviders(<GeneralSettings accessToken="token" userRole="Admin" userID="user" />);+  await user.click(screen.getByRole("tab", { name: "General" }));+  const input = await screen.findByRole("textbox", { name: fieldName });+  expect(input).toHaveValue("");+  fireEvent.change(input, { target: { value: " 30d " } });+  const row = screen.getByRole("row", { name: new RegExp(fieldName) });+  await user.click(within(row).getByRole("button", { name: "Update" }));+  expect(vi.mocked(updateConfigFieldSetting).mock.calls).toEqual([["token", fieldName, "30d"]]);+  expect(await within(row).findByText("In DB")).toBeInTheDocument();+});++it("displays a stored String setting and clears it when Update is clicked on an emptied input", async () => {+  vi.mocked(getGeneralSettingsCall).mockResolvedValue([+    {+      field_name: "maximum_spend_logs_retention_period",+      field_type: "String",+      field_value: "7d",+      field_description: "retention",+      stored_in_db: true,+    },+  ]);+  vi.mocked(updateConfigFieldSetting).mockClear();+  vi.mocked(deleteConfigFieldSetting).mockClear();+  const user = userEvent.setup();+  renderWithProviders(<GeneralSettings accessToken="token" userRole="Admin" userID="user" />);+  await user.click(screen.getByRole("tab", { name: "General" }));+  const input = await screen.findByRole("textbox", { name: "maximum_spend_logs_retention_period" });+  expect(input).toHaveValue("7d");+  fireEvent.change(input, { target: { value: "  " } });+  await user.click(+    within(screen.getByRole("row", { name: /maximum_spend_logs_retention_period/ })).getByRole("button", {+      name: "Update",+    }),+  );+  expect(vi.mocked(deleteConfigFieldSetting).mock.calls).toEqual([["token", "maximum_spend_logs_retention_period"]]);+  expect(updateConfigFieldSetting).not.toHaveBeenCalled();+  expect(screen.getByRole("textbox", { name: "maximum_spend_logs_retention_period" })).toHaveValue("");+});+ it("should delete only the Default setting and retain explicit false and zero", async () => {   vi.mocked(getGeneralSettingsCall).mockResolvedValue([     {ui/litellm-dashboard/src/app/(dashboard)/router-settings/_components/general_settings.tsxindex 5d28adb7ef..07dc4bf416 100644@@ -55,6 +55,11 @@ const toListValue = (raw: string): string[] | null => {  const fromListValue = (value: unknown): string => (Array.isArray(value) ? value.join(", ") : ""); +const toStringValue = (raw: string): string | null => {+  const trimmed = raw.trim();+  return trimmed === "" ? null : trimmed;+};+ const SettingValueEditor: React.FC<{   setting: generalSettingsItem;   onChange: (fieldName: string, newValue: any) => void;@@ -125,6 +130,16 @@ const SettingValueEditor: React.FC<{       />     );   }+  if (setting.field_type === "String") {+    return (+      <Input+        key={String(setting.stored_in_db)}+        aria-label={setting.field_name}+        defaultValue={setting.field_value == null ? "" : String(setting.field_value)}+        onChange={(event) => onChange(setting.field_name, toStringValue(event.target.value))}+      />+    );+  }   if (setting.field_type === "Select") {     return (       <Select value={setting.field_value ?? null} onValueChange={(newValue) => onChange(setting.field_name, newValue)}>@@ -260,7 +275,8 @@ const GeneralSettings: React.FC<GeneralSettingsPageProps> = ({ accessToken, user     const fieldValue = setting?.field_value;      if (fieldValue == null) {-      if (setting?.field_type === "Select" || setting?.field_type === "List") handleResetField(fieldName);+      if (setting?.field_type === "Select" || setting?.field_type === "List" || setting?.field_type === "String")+        handleResetField(fieldName);       return;     }     try { 
Merged fix · PR #48431+45 −0
ui/litellm-dashboard/src/app/(dashboard)/router-settings/_components/general_settings.integration.test.tsxindex 35434830d98..d7dfb8151fc 100644@@ -80,6 +80,42 @@ describe("GeneralSettings General tab", () => {     vi.mocked(deleteConfigFieldSetting).mockClear();   }); +  it.each([+    ["maximum_spend_logs_retention_period", null, "7d"],+    ["maximum_health_check_retention_period", "30d", "14d"],+    ["maximum_daily_tag_spend_retention_period", undefined, "90d"],+    ["maximum_spend_logs_cleanup_run_budget", "5m", "10m"],+    ["maximum_spend_logs_cleanup_batch_timeout", "", "45s"],+    ["mcp_client_id_header", "x-client-id", "X-MCP-Client.ID"],+  ])("displays, updates and resets the String setting %s", async (fieldName, initialValue, updatedValue) => {+    vi.mocked(getGeneralSettingsCall).mockResolvedValue([+      ...SETTINGS_FIXTURE,+      {+        field_name: fieldName,+        field_type: "String",+        field_value: initialValue,+        field_description: "string setting",+        stored_in_db: initialValue != null,+        field_default_value: null,+      },+    ]);+    const user = userEvent.setup();+    renderWithProviders(<GeneralSettings accessToken="token" userRole="Admin" userID="user" />);+    await user.click(screen.getByRole("tab", { name: "General" }));+    const input = await screen.findByRole("textbox", { name: fieldName });+    expect(input).toHaveValue(initialValue ?? "");+    fireEvent.change(input, { target: { value: updatedValue } });+    const row = screen.getByRole("row", { name: new RegExp(fieldName) });+    await user.click(within(row).getByRole("button", { name: "Update" }));+    expect(vi.mocked(updateConfigFieldSetting).mock.calls).toEqual([["token", fieldName, updatedValue]]);+    expect(within(row).getByText("In DB")).toBeInTheDocument();+    const resetIcon = row.querySelectorAll("td")[3].querySelector("svg");+    expect(resetIcon).not.toBeNull();+    await user.click(resetIcon as unknown as Element);+    expect(vi.mocked(deleteConfigFieldSetting).mock.calls).toEqual([["token", fieldName]]);+    expect(input).toHaveValue("");+  });+   it("updates max_ui_session_budget with its own value, not the value at its filtered index", async () => {     const user = userEvent.setup();     renderWithProviders(<GeneralSettings accessToken="token" userRole="Admin" userID="user" />);ui/litellm-dashboard/src/app/(dashboard)/router-settings/_components/general_settings.tsxindex 5d28adb7ef3..67712d78a13 100644@@ -68,6 +68,15 @@ const SettingValueEditor: React.FC<{       />     );   }+  if (setting.field_type === "String") {+    return (+      <Input+        aria-label={setting.field_name}+        value={setting.field_value ?? ""}+        onChange={(event) => onChange(setting.field_name, event.target.value)}+      />+    );+  }   if (setting.field_type === "Integer") {     return (       <Input