This repository was archived by the owner on Jul 27, 2026. It is now read-only.
Repository navigation
fix(backends): hide edit/remove row actions when locked to cloud - #1555
Merged
Merged
Conversation
The Manage Backends modal previously rendered pencil and trash icons on
every backend row even when the deployment was started with
--lock-to-cloud. In locked mode the user should not be able to mutate
the locked backend's host/key/name or remove it outright.
backend-row.tsx now consults getLockedCloudHost() and skips rendering
both action buttons when a locked cloud host is configured. The row
identity (name + host) still renders so the user can see which backend
is locked.
Adds three focused tests to describe("BackendRow", ...):
* renders edit and remove buttons when not locked to a cloud host
* hides edit and remove buttons when locked via VITE_LOCK_TO_CLOUD
* hides edit and remove buttons when locked via the
window.__AGENT_CANVAS_LOCK_TO_CLOUD__ runtime global
Also extends afterEach with vi.unstubAllEnvs + window-global cleanup
(consistent with backend-form-modal.test.tsx) and isolates three
pre-existing edit-form tests from a local .env that sets
VITE_LOCK_TO_CLOUD, so they keep exercising edit-form behavior rather
than lock behavior.
Co-authored-by: openhands <openhands@all-hands.dev>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
✅ Mock-LLM E2E Tests18/18 passed Commit: Details
Posted by the Mock-LLM E2E workflow · results are deterministic (scripted LLM responses) |
tofarr
marked this pull request as ready for review
June 30, 2026 15:55
Contributor
✅ Mock-LLM Docker E2E Test Results60/60 passed Commit: Details
Posted by the Mock-LLM E2E workflow · results are deterministic (scripted LLM responses) |
Contributor
|
🚀 Released in v1.2.0. |
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
HUMAN:
AGENT:
End-to-end verification performed by the agent that opened this PR:
npm run typecheck— passes, no TypeScript errors.npm run build— production build succeeds in ~2s; themanage-backends-modal-*.jschunk (which contains the changedBackendRow) is 16.62 kB / gzip 4.97 kB and built without warningsabout the modified files.
npx vitest run __tests__/components/backends/manage-backends-modal.test.tsx— 19/19 pass with
VITE_LOCK_TO_CLOUDunset (CI conditions).Three of those tests are new and exercise the row-button gating; the
three pre-existing edit-form tests that previously clicked the pencil
were isolated with
vi.stubEnv("VITE_LOCK_TO_CLOUD", "")so theycontinue to test edit-form behavior rather than regressing because
the user's local
.envsetsVITE_LOCK_TO_CLOUD.npx vitest run __tests__/components/backends— 69/69 pass withVITE_LOCK_TO_CLOUDunset.npx eslint __tests__/components/backends/manage-backends-modal.test.tsx— clean. Prettier reformatted the JSX in
backend-row.tsxduringthe pre-commit hook (no-op style change).
The agent did NOT perform a live browser smoke test of the modal. The
row-button gating is fully exercised by the new unit tests (which
mount
BackendRowdirectly, assert button presence/absence under bothlock paths, and click the handlers when present), but a reviewer
should still click through Manage Backends in both dev modes:
VITE_LOCK_TO_CLOUD=https://app.all-hands.dev npm run dev—open Manage Backends, the row should show the locked backend with
no pencil and no trash.
npm run dev— open Manage Backends, the row should showpencil + trash, click pencil opens the edit modal.
Why
The Manage Backends modal renders a row per registered backend with
pencil (edit) and trash (remove) icon buttons on each row. When a
deployment is started with
scripts/static-server.mjs --lock-to-cloud <url>(orVITE_LOCK_TO_CLOUDbaked in at build time),getLockedCloudHost()returns a non-null host so the rest of the UIalready restricts the user to that single cloud backend —
backend-form-modal.tsxshort-circuits to theCloudLoginColumn,onboarding-modal.tsxandcheck-backend-step.tsxguard against wronghosts,
root.tsxredirects, anddefault-backend.tsrefuses to seeda local backend.
The row actions were the one remaining hole: a user in locked mode
could still click the pencil to open the edit form, change the locked
host / name / api-key, and submit; or click the trash to remove the
locked backend outright. This change closes that hole by gating both
row actions on the same lock state, matching the rest of the
locked-mode plumbing.
Summary
src/components/features/backends/backend-row.tsx: importgetLockedCloudHostand skip rendering both the edit and removebuttons when a locked cloud host is configured. Row identity (name
locked.
__tests__/components/backends/manage-backends-modal.test.tsx:describe("BackendRow", ...)covering thehappy path, the
VITE_LOCK_TO_CLOUDbuild-time path, and thewindow.__AGENT_CANVAS_LOCK_TO_CLOUD__serve-time pathafterEachextended withvi.unstubAllEnvs()+ window-globalcleanup (consistent with
backend-form-modal.test.tsx).envthat sets
VITE_LOCK_TO_CLOUD, with a comment explaining whysrc/components/features/backends/backend-form-modal.tsx: minorvisual tweak (
pb-7on theCloudLoginColumnouter wrapper) thatwas already in the working tree.
Issue Number
N/A
How to Test
# Install + verify typecheck + production build + targeted tests + full backends suite npm ci npm run typecheck npm run build npx vitest run __tests__/components/backends/manage-backends-modal.test.tsx npx vitest run __tests__/components/backendsManual smoke (two modes):
Video/Screenshots
Not applicable — purely a UI affordance gating change with no visual
regression when unlocked, and the only visible difference when locked
is the absence of two icon buttons in an existing modal.
Type
Notes
manage-backends-modal.test.tsxtests and all 69 tests in__tests__/components/backendspass withVITE_LOCK_TO_CLOUDunset(CI conditions). The four pre-existing failures that show up in
local runs when the user's
.envsetsVITE_LOCK_TO_CLOUDare notintroduced by this PR — they were failing before because
makeDefaultLocalBackend()returnsnullin locked mode, leavingthe seeded-default-Local-backend tests with an empty list.
HUMAN:section of.github/pull_request_template.mdis intentionally leftuntouched.