Skip to content
This repository was archived by the owner on Jul 27, 2026. It is now read-only.

fix(backends): hide edit/remove row actions when locked to cloud - #1555

Merged
tofarr merged 1 commit into
mainfrom
fix/manage-backends-row-actions-locked-mode
Jun 30, 2026
Merged

tofarr merged 1 commit into
mainfrom
fix/manage-backends-row-actions-locked-mode

Conversation

@tofarr

@tofarr tofarr commented Jun 30, 2026 •

Copy link
Copy Markdown
Contributor

HUMAN:

  • A human has tested these changes.

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; the
    manage-backends-modal-*.js chunk (which contains the changed
    BackendRow) is 16.62 kB / gzip 4.97 kB and built without warnings
    about the modified files.
  • npx vitest run __tests__/components/backends/manage-backends-modal.test.tsx
    — 19/19 pass with VITE_LOCK_TO_CLOUD unset (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 they
    continue to test edit-form behavior rather than regressing because
    the user's local .env sets VITE_LOCK_TO_CLOUD.
  • npx vitest run __tests__/components/backends — 69/69 pass with
    VITE_LOCK_TO_CLOUD unset.
  • npx eslint __tests__/components/backends/manage-backends-modal.test.tsx
    — clean. Prettier reformatted the JSX in backend-row.tsx during
    the 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 BackendRow directly, assert button presence/absence under both
lock paths, and click the handlers when present), but a reviewer
should still click through Manage Backends in both dev modes:

  • Locked: 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.
  • Unlocked: npm run dev — open Manage Backends, the row should show
    pencil + 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> (or VITE_LOCK_TO_CLOUD baked in at build time),
getLockedCloudHost() returns a non-null host so the rest of the UI
already restricts the user to that single cloud backend —
backend-form-modal.tsx short-circuits to the CloudLoginColumn,
onboarding-modal.tsx and check-backend-step.tsx guard against wrong
hosts, root.tsx redirects, and default-backend.ts refuses to seed
a 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: import
    getLockedCloudHost and skip rendering both the edit and remove
    buttons when a locked cloud host is configured. Row identity (name
    • host) is unchanged so the user can still see which backend is
      locked.
  • __tests__/components/backends/manage-backends-modal.test.tsx:
    • three new tests in describe("BackendRow", ...) covering the
      happy path, the VITE_LOCK_TO_CLOUD build-time path, and the
      window.__AGENT_CANVAS_LOCK_TO_CLOUD__ serve-time path
    • afterEach extended with vi.unstubAllEnvs() + window-global
      cleanup (consistent with backend-form-modal.test.tsx)
    • three pre-existing edit-form tests isolated from a local .env
      that sets VITE_LOCK_TO_CLOUD, with a comment explaining why
  • src/components/features/backends/backend-form-modal.tsx: minor
    visual tweak (pb-7 on the CloudLoginColumn outer wrapper) that
    was 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/backends

Manual smoke (two modes):

# Locked mode (UI hides edit + trash)
VITE_LOCK_TO_CLOUD=https://app.all-hands.dev npm run dev
# open Manage Backends → row shows the locked backend with no pencil/trash

# Unlocked mode (default)
npm run dev
# open Manage Backends → row shows pencil + trash, click pencil opens edit modal

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

  • Bug fix
  • Feature
  • Refactor
  • Breaking change
  • Docs / chore

Notes

  • All 19 manage-backends-modal.test.tsx tests and all 69 tests in
    __tests__/components/backends pass with VITE_LOCK_TO_CLOUD unset
    (CI conditions). The four pre-existing failures that show up in
    local runs when the user's .env sets VITE_LOCK_TO_CLOUD are not
    introduced by this PR — they were failing before because
    makeDefaultLocalBackend() returns null in locked mode, leaving
    the seeded-default-Local-backend tests with an empty list.
  • Per AGENTS.md, the HUMAN: section of
    .github/pull_request_template.md is intentionally left
    untouched.

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>
@vercel

vercel Bot commented Jun 30, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
agent-canvas Ready Ready Preview, Comment Jun 30, 2026 3:41pm

Request Review

@github-actions

Copy link
Copy Markdown
Contributor

✅ Mock-LLM E2E Tests

18/18 passed

Commit: 9f310a18 · Workflow run · Test artifacts

Details
Status Test Duration
✅ backends/mock-llm-auth-modes.spec.ts › auth mode: fresh install with runtime-injected key › reaches the onboarding modal without pre-seeded localStorage 1.7s
✅ backends/mock-llm-auth-modes.spec.ts › auth mode: non-public key rotation › recovers when localStorage has a stale session API key 5.3s
✅ backends/mock-llm-auth-modes.spec.ts › auth mode: public gate › shows first-run onboarding before the auth screen when no key is configured 1.4s
✅ backends/mock-llm-auth-modes.spec.ts › auth mode: public gate › rejects an incorrect key with an inline error 1.6s
✅ backends/mock-llm-auth-modes.spec.ts › auth mode: public gate › allows access after pasting the correct key 1.6s
✅ backends/mock-llm-auth-modes.spec.ts › auth mode: public gate › skips auth screen for returning user with valid stored key 730ms
✅ backends/mock-llm-auth-modes.spec.ts › auth mode: public gate › re-prompts when the server rotates its key (stale localStorage) 1.5s
✅ backends/mock-llm-cross-connect.spec.ts › cross-connect: frontend-only → backend-only › frontend-only connects to a separate backend-only instance 17.0s
✅ backends/mock-llm-cross-connect.spec.ts › cross-connect: frontend-only → multiple backends › connects to two separate backends and switches between them 21.5s
✅ backends/mock-llm-partial-stack.spec.ts › partial stack: --frontend-only › serves the frontend but returns 503 for backend routes 7.4s
✅ backends/mock-llm-partial-stack.spec.ts › partial stack: --backend-only › serves backend APIs but returns 503 for the frontend root 14.1s
✅ backends/mock-llm-partial-stack.spec.ts › partial stack: port conflict › fails with a clear error when the ingress port is occupied 104ms
✅ backends/mock-llm-partial-stack.spec.ts › partial stack: port conflict › starts successfully on a free port after a conflict 6.0s
✅ regressions/mock-llm-ui-regressions.spec.ts › UI regressions › scopes standalone styles to the agent-server-ui shell 1.4s
✅ regressions/mock-llm-ui-regressions.spec.ts › UI regressions › renders critic results on agent messages and finish actions 1.6s
✅ regressions/mock-llm-ui-regressions.spec.ts › UI regressions › loads older events when scrolling up 1.6s
✅ regressions/mock-llm-ui-regressions.spec.ts › UI regressions › selected workspace persists after navigating away and returning 2.2s
✅ regressions/mock-llm-ui-regressions.spec.ts › UI regressions › cleared sessionStorage yields empty workspace selection 1.1s

Posted by the Mock-LLM E2E workflow · results are deterministic (scripted LLM responses)

@tofarr
tofarr marked this pull request as ready for review June 30, 2026 15:55
@github-actions

Copy link
Copy Markdown
Contributor

✅ Mock-LLM Docker E2E Test Results

60/60 passed

Commit: 9f310a18 · Workflow run · Test artifacts

Details
Status Test Duration
✅ automations/mock-llm-automation.spec.ts › mock-LLM automation lifecycle › step 1: setup LLM profile and register automation trajectory 7.3s
✅ automations/mock-llm-automation.spec.ts › mock-LLM automation lifecycle › step 2: create automation and dispatch run via the UI 33.5s
✅ automations/mock-llm-automation.spec.ts › mock-LLM automation lifecycle › step 3: verify automation and run on the automations page 6.2s
✅ automations/mock-llm-preset-automation.spec.ts › preset automation → slash command conversation › automation card sends the correct slash command to a conversation 16.5s
✅ automations/mock-llm-preset-automation.spec.ts › preset automation → slash command conversation › direct slash command from home page triggers skill activation 13.3s
✅ backends/mock-llm-auth-modes.spec.ts › auth mode: fresh install with runtime-injected key › reaches the onboarding modal without pre-seeded localStorage 1.4s
✅ backends/mock-llm-auth-modes.spec.ts › auth mode: non-public key rotation › recovers when localStorage has a stale session API key 5.3s
✅ backends/mock-llm-auth-modes.spec.ts › auth mode: public gate › shows first-run onboarding before the auth screen when no key is configured 1.4s
✅ backends/mock-llm-auth-modes.spec.ts › auth mode: public gate › rejects an incorrect key with an inline error 1.6s
✅ backends/mock-llm-auth-modes.spec.ts › auth mode: public gate › allows access after pasting the correct key 1.6s
✅ backends/mock-llm-auth-modes.spec.ts › auth mode: public gate › skips auth screen for returning user with valid stored key 896ms
✅ backends/mock-llm-auth-modes.spec.ts › auth mode: public gate › re-prompts when the server rotates its key (stale localStorage) 1.5s
✅ backends/mock-llm-cross-connect.spec.ts › cross-connect: frontend-only → backend-only › frontend-only connects to a separate backend-only instance 23.2s
✅ backends/mock-llm-cross-connect.spec.ts › cross-connect: frontend-only → multiple backends › connects to two separate backends and switches between them 21.8s
✅ backends/mock-llm-partial-stack.spec.ts › partial stack: --frontend-only › serves the frontend but returns 503 for backend routes 7.4s
✅ backends/mock-llm-partial-stack.spec.ts › partial stack: --backend-only › serves backend APIs but returns 503 for the frontend root 14.1s
✅ backends/mock-llm-partial-stack.spec.ts › partial stack: port conflict › fails with a clear error when the ingress port is occupied 104ms
✅ backends/mock-llm-partial-stack.spec.ts › partial stack: port conflict › starts successfully on a free port after a conflict 6.0s
✅ conversations/mock-llm-conversation.spec.ts › mock-LLM agent-server conversation › step 1: create an LLM profile pointing at the mock LLM server 6.3s
✅ conversations/mock-llm-conversation.spec.ts › mock-LLM agent-server conversation › step 2: activate the mock-llm profile and verify settings API 6.3s
✅ conversations/mock-llm-conversation.spec.ts › mock-LLM agent-server conversation › step 3: run a conversation with the mock LLM 6.6s
✅ conversations/mock-llm-conversation.spec.ts › mock-LLM agent-server conversation › step 4: resume conversation from sidebar after navigating away 5.7s
✅ conversations/mock-llm-image-upload.spec.ts › mock-LLM image upload › attaching an image embeds it as base64 in the LLM completion call 13.3s
✅ files/mock-llm-files-and-git.spec.ts › files tab, git control bar, and browser tab › step 1: ensure mock LLM profile is configured 7.3s
✅ files/mock-llm-files-and-git.spec.ts › files tab, git control bar, and browser tab › step 2: start conversation and attach workspace metadata 12.3s
✅ files/mock-llm-files-and-git.spec.ts › files tab, git control bar, and browser tab › step 3: git control bar shows workspace pill and git actions 12.2s
✅ files/mock-llm-files-and-git.spec.ts › files tab, git control bar, and browser tab › step 4: files tab defaults to diff view for attached workspace 5.9s
✅ files/mock-llm-files-and-git.spec.ts › files tab, git control bar, and browser tab › step 5: browser tab shows empty state 6.4s
✅ files/mock-llm-files-and-git.spec.ts › files tab, git control bar, and browser tab › step 6: files tab defaults to file-tree view without attached workspace 7.6s
✅ home/mock-llm-folder-workspace.spec.ts › mock-LLM folder browser → workspace → conversation › step 1: browse to a folder, add it as a workspace, and launch a conversation with the correct working_dir 7.4s
✅ mcp/mock-llm-mcp-github.spec.ts › MCP GitHub server install flow › step 1: GitHub card is visible on the MCP marketplace page 5.5s
✅ mcp/mock-llm-mcp-github.spec.ts › MCP GitHub server install flow › step 2: clicking GitHub card opens the install modal with correct fields 5.7s
✅ mcp/mock-llm-mcp-github.spec.ts › MCP GitHub server install flow › step 3: full install flow — fill PAT, submit, verify installed 12.8s
✅ mcp/mock-llm-mcp-github.spec.ts › MCP GitHub server install flow › step 4: installed GitHub server can be deleted 5.8s
✅ mcp/mock-llm-mcp-slack-credentials.spec.ts › MCP Test Connection credential verification (Slack) › install: invalid Slack credentials are blocked with a credential-check error 6.2s
✅ mcp/mock-llm-mcp-slack-credentials.spec.ts › MCP Test Connection credential verification (Slack) › install: a valid token missing only a scope still installs (missing_scope is not a credential failure) 5.9s
✅ mcp/mock-llm-mcp-slack-credentials.spec.ts › MCP Test Connection credential verification (Slack) › install: an older agent server that omits tool_result still installs (compat) 5.9s
✅ mcp/mock-llm-mcp-slack-credentials.spec.ts › MCP Test Connection credential verification (Slack) › edit: Test Connection verifies the stored credentials and surfaces a credential failure 5.8s
✅ mcp/mock-llm-mcp-slack-credentials.spec.ts › MCP Test Connection credential verification (Slack) › edit: Test Connection reports success for valid stored credentials 5.8s
✅ mcp/mock-llm-mcp-slack-credentials.spec.ts › MCP Test Connection credential verification (Slack) › custom (non-catalog) server: Test Connection attaches no verification probe 5.8s
✅ onboarding/mock-llm-onboarding-happy-path.spec.ts › onboarding happy path › completes the full onboarding flow and launches a conversation 3.5s
✅ onboarding/mock-llm-onboarding-regressions.spec.ts › onboarding recent regressions › keeps the modal open on backdrop click and Escape 1.5s
✅ onboarding/mock-llm-onboarding-regressions.spec.ts › onboarding recent regressions › defaults the LLM setup step to OpenAI GPT-5.5 1.6s
✅ regressions/mock-llm-ui-regressions.spec.ts › UI regressions › scopes standalone styles to the agent-server-ui shell 1.0s
✅ regressions/mock-llm-ui-regressions.spec.ts › UI regressions › renders critic results on agent messages and finish actions 1.4s
✅ regressions/mock-llm-ui-regressions.spec.ts › UI regressions › loads older events when scrolling up 1.7s
✅ regressions/mock-llm-ui-regressions.spec.ts › UI regressions › selected workspace persists after navigating away and returning 2.5s
✅ regressions/mock-llm-ui-regressions.spec.ts › UI regressions › cleared sessionStorage yields empty workspace selection 1.4s
✅ settings/mock-llm-acp-agent.spec.ts › mock-LLM ACP agent conversation › step 1: configure ACP agent via Settings → Agent UI 13.9s
✅ settings/mock-llm-acp-agent.spec.ts › mock-LLM ACP agent conversation › step 2: reload and verify ACP settings are persisted in UI 5.6s
✅ settings/mock-llm-acp-agent.spec.ts › mock-LLM ACP agent conversation › step 3: start ACP conversation and verify agent reply 6.7s
✅ settings/mock-llm-acp-agent.spec.ts › mock-LLM ACP agent conversation › step 4: resume ACP conversation from sidebar after navigating away 5.7s
✅ settings/mock-llm-model-switch.spec.ts › mock-LLM /model slash command › step 1: configure LLM, create switch-target profile, register trajectory 13.2s
✅ settings/mock-llm-model-switch.spec.ts › mock-LLM /model slash command › step 2: start conversation, switch profile via /model, verify switch 6.8s
✅ settings/mock-llm-profile-management.spec.ts › active profile deletion + reconciliation › active profile is deletable and reconciliation activates another profile 8.7s
✅ settings/mock-llm-profile-management.spec.ts › same-model profile identity › chat header shows the correct profile when two profiles share the same model 15.0s
✅ settings/mock-llm-profile-management.spec.ts › OpenHands provider hidden base_url preservation › re-saving an OpenHands profile from Basic view preserves hidden base_url 7.6s
✅ skills/mock-llm-skills.spec.ts › skill loading: project, user, and deletion › project skill in workspace/.agents/skills/ triggers on matching keyword 13.6s
✅ skills/mock-llm-skills.spec.ts › skill loading: project, user, and deletion › user skill in ~/.openhands/skills/ triggers on matching keyword 13.4s
✅ skills/mock-llm-skills.spec.ts › skill loading: project, user, and deletion › deleting a user skill removes it from subsequent conversations 13.4s

Posted by the Mock-LLM E2E workflow · results are deterministic (scripted LLM responses)

@hieptl hieptl left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! 🙏

@tofarr
tofarr merged commit 58c7c27 into main Jun 30, 2026
21 of 22 checks passed
@tofarr
tofarr deleted the fix/manage-backends-row-actions-locked-mode branch June 30, 2026 15:57
@openhands-release-bot openhands-release-bot Bot added the released: v1.2.0 Shipped in v1.2.0 label Jul 9, 2026
@openhands-release-bot

Copy link
Copy Markdown
Contributor

🚀 Released in v1.2.0.

This branch was successfully deployed

1 active deployment
Preview — 9f310a18 Deployed Jun 30, 2026 by vercel[bot]
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

released: v1.2.0 Shipped in v1.2.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants