fix: preserve backend kind in edit mode#1263
Open
rajshah4 wants to merge 3 commits into
Open
Conversation
Editing a backend (rename, API-key rotation, etc.) was silently resetting kind from "cloud" to "local" for any host that doesn't contain all-hands.dev or openhands.dev, because BackendForm always re-derived kind from the host via inferKindFromHost() regardless of mode. This breaks cloud backends on custom domains (e.g. OHE/Replicated enterprise deployments) — the auth header switches from Authorization: Bearer to X-Session-API-Key and every API call gets back the frontend HTML instead of JSON, with no error surfaced. Fix: in edit mode keep the existing backend.kind; only infer from the host when adding a new backend. Co-authored-by: openhands <openhands@all-hands.dev>
Adds a test that seeds a cloud backend on a custom domain (app.company.com), renames it via the edit form, and asserts kind is still 'cloud' after saving. Would have caught the bug fixed in the previous commit. Co-authored-by: openhands <openhands@all-hands.dev>
|
@openhands-agent is attempting to deploy a commit to the openhands Team on Vercel. A member of the Team first needs to authorize it. |
Contributor
✅ Mock-LLM E2E Tests43/43 passed Commit:
Posted by the Mock-LLM E2E workflow · results are deterministic (scripted LLM responses) |
The check-pr-artifacts job was failing on fork PRs because it tried to post a comment without write permissions. This adds a fork PR check to skip the comment posting step for fork PRs, similar to the existing check in the cleanup-on-approval job.
Contributor
✅ Mock-LLM E2E Tests44/44 passed Commit:
Posted by the Mock-LLM E2E workflow · results are deterministic (scripted LLM responses) |
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Why
When editing an existing backend (rename, API key rotation, etc.), the form silently resets
kindfrom"cloud"to"local"for any host that does not containall-hands.devoropenhands.dev.BackendFormis shared between add and edit modes, but it always re-deriveskindfrom the host viainferKindFromHost(), ignoring the value already stored.The result: a cloud backend on a custom domain (e.g. an OHE/Replicated enterprise instance) gets its auth header switched from
Authorization: BearertoX-Session-API-Keyafter any edit, and every subsequent API call returns the frontend HTML instead of JSON. No error is surfaced.This is a blocker when trying to rename an OpenHands Enterprise instance that is a cloud connection, but the rename moves it into local.
Summary
BackendForm, preservebackend.kindin edit mode instead of re-inferring it from the hostinferKindFromHost()still runs when adding a new backendkind: "cloud"backend on a custom domain, renames it, and asserts the kind is unchanged after savingIssue Number
Related: Linear APP-2265
How to Test
kind: "cloud"JSON.parse(localStorage.getItem('openhands-backends'))and confirmkindis still"cloud"kindwould be"local"after step 3Video/Screenshots
N/A -- localStorage state change, not a visual difference.
Type
Notes
inferKindFromHost()only recognisesall-hands.dev/openhands.devas cloud hosts, so OHE deployments on custom domains are always inferred as"local"even when first added via the manual form. That is a related but separate issue; this PR fixes only the edit-mode clobber, which is the more serious of the two as it silently breaks a working connection.This PR was created by an AI agent (OpenHands) on behalf of the user.
@rajshah4 can click here to continue refining the PR