feat: Persist settings via agent-server REST API with server-side merge#60
feat: Persist settings via agent-server REST API with server-side merge#60malhotra5 wants to merge 7 commits into
Conversation
The agent-server binary may report version='unknown' when build metadata isn't injected at build time. This breaks the version compatibility check even though sdk_version is valid. Fall back to sdk_version when version is missing or 'unknown'. The SDK version is reliable (comes from the installed package) and represents the actual API compatibility level.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Use the fix/version-fallback-to-sdk-version branch which falls back to sdk_version when version is 'unknown'. This fixes the version compatibility error in the GUI. PR: OpenHands/agent-canvas#60 Once the PR is merged, update this to point to main or a specific commit SHA. Co-authored-by: openhands <openhands@all-hands.dev>
|
@OpenHands why do we have two different variables version and server_version in the first place? Is that a bug in the sdk? |
|
I'm on it! neubig can track my progress at all-hands.dev |
|
@neubig I think there’s a small naming mix-up here: the API payload has I checked
So I don’t think this is a bug in the TypeScript SDK. The real issue is that in some dev/containerized builds, the agent-server package metadata can come back as So the bug is really on the GUI side: we were assuming This comment was created by an AI agent (OpenHands) on behalf of the user. |
|
Final summary:
Conciseness check:
|
…age only - Update SettingsService to use typescript-client SettingsClient for CRUD - Settings are now fetched from and saved to agent-server /api/settings - localStorage acts as fallback/cache for offline scenarios - Update SecretsService to use SettingsClient for custom secrets - Update typescript-client dependency to include settings CRUD endpoints - Fix tests to properly mock async saveSettings - Update AGENTS.md with settings persistence architecture docs The agent-server persists settings to ~/.openhands/settings.json and secrets to ~/.openhands/secrets.json with API key encryption.
neubig
left a comment
There was a problem hiding this comment.
I think this seems reasonable.
- Update typescript-client to 7d20f119d68893903c3eab7070416e6317f72716 - Remove api_key from start conversation request payload - Agent-server now fills in LLM credentials from persisted settings - This avoids exposing secrets in the request payload The agent-server's _merge_request_with_persisted_settings() merges the start conversation request with persisted settings, filling in missing LLM configuration (api_key, model, base_url) from the server's settings.json file. Co-authored-by: openhands <openhands@all-hands.dev>
- Add X-Expose-Secrets: encrypted header when fetching settings - Add secrets_encrypted: true flag to start conversation requests - Use HTTP client directly for settings CRUD (bypasses typescript-client) - Update secrets service to use HTTP client for secrets API The frontend receives cipher-encrypted secret values from the server and passes them back when starting conversations. The server decrypts them before use. Co-authored-by: openhands <openhands@all-hands.dev>
|
Closing this in favor of #98 |
Summary
This PR integrates agent-server-gui with the new agent-server settings persistence API. Settings and secrets are now persisted to disk on the agent-server, with the GUI acting as a client that reads/writes via REST endpoints.
Key Changes
Settings Persistence (from agent-server PR #3026)
The agent-server now provides file-based settings and secrets persistence:
GET/PATCH /api/settings- Read/update agent and conversation settingsGET/PUT/DELETE /api/settings/secrets/{name}- CRUD for custom secretsworkspace/.openhands/settings.jsonworkspace/.openhands/secrets.json(encrypted viaOH_SECRET_KEY)GUI Integration
SettingsService (
src/api/settings-service/settings-service.api.ts)SettingsClientfrom typescript-client to call agent-server endpointsSecretsService (
src/api/secrets-service.ts)/api/settings/secretsendpointsServer-side Settings Merge (
src/api/agent-server-adapter.ts)llm.api_key_merge_request_with_persisted_settings()Version Compatibility (
src/api/agent-server-compatibility.ts)sdk_versionwhenversionis"unknown"(common in dev/container builds)Security
OH_SECRET_KEYis set0o700, files0o600Dependencies
@openhands/typescript-clientto7d20f119d68893903c3eab7070416e6317f72716Testing
npm testThis PR was created by an AI agent (OpenHands) on behalf of the user.