I was wondering if we could name "SecretManager" i...
# proj-sdk
c
I was wondering if we could name "SecretManager" in the SDK differently. For one, "manager" is an overused term. In addition, the SDK is not an application. The SecretManager will not, for example, have an entry from the user like an UI, values will actually come from applications built on the SDK, which will handle secrets... and that part will be called SecretManager.🤔 I asked the agent for alternative names, here is GPT-5 on it: • SecretSourceRegistry • SecretResolver / SecretSourceResolver • SecretEnvInjector WDYT?
w
Agreed! SecretRegistry seems simplest
👍 2
I think we can reuse it in other contexts other than Env
e.g. if we create a create_pr tool, it can use it
c
@nutritious-balloon-65098 Let's rename SecretManager to SecretRegistry.
n
I'm on it! can track my progress here.
Summary of work: Rename SecretsManager to SecretRegistry What I changed • Implemented the class rename with backward compatibility, kept scope focused to conversation-related modules and tests. • Left the file name secrets_manager.py unchanged to avoid breaking imports; only the class and internal references changed. Files modified 1. openhands-sdk/openhands/sdk/conversation/secrets_manager.py • Renamed class SecretsManager -> SecretRegistry • Added a backward-compatibility alias at the end of the module: SecretsManager = SecretRegistry • Updated class docstring wording to say “secret registry” • No behavior changes 2. openhands-sdk/openhands/sdk/conversation/*init*.py • Now imports both SecretRegistry and SecretsManager from secrets_manager • Added "SecretRegistry" to all (kept "SecretsManager" to preserve API) 3. openhands-sdk/openhands/sdk/conversation/state.py • Switched type and default from SecretsManager to SecretRegistry 4. tests/sdk/conversation/test_secrets_manager.py • Updated imports and instantiations to use SecretRegistry (kept filename unchanged) Validation performed • Ran pre-commit on changed files (ruff format/lint, pycodestyle, pyright): passed • Ran targeted tests related to secrets paths: ◦ 18 tests across secrets-related modules passed • Full test suite shows unrelated pre-existing failures; our change didn’t introduce new failures in the affected areas Checklist against your request • Rename “SecretManager” to “SecretRegistry” across the SDK: done • Maintain backward compatibility for external users: done via alias SecretsManager = SecretRegistry • Keep changes minimal and focused: done (only relevant files updated; file name unchanged to prevent import breakage) • Follow dev setup and pre-commit: done • Do not push to main directly: done (new branch + draft PR) Git changes (concise) • Commit: SDK: rename SecretsManager to SecretRegistry; keep backward-compatible alias and update internal imports/exports • Branch: rename-secretmanager-to-secretregistry • Draft PR: https://github.com/OpenHands/software-agent-sdk/pull/965 Next steps • Would you like me to: a. Mark the PR ready for review and keep this as the final name going forward? b. Update the docs repository to reflect the new SecretRegistry naming (per the documentation workflow), in a matching branch? c. Keep the changes local and not proceed with the PR yet? Notes • If you prefer, we can also add a deprecation warning on construction when SecretsManager is used, but I kept it as a plain alias to avoid any runtime noise for now. <sub>View full conversation</sub>
Summary of changes just completed Scope: Apply updated requirement to fully rename SecretManager → SecretRegistry without any alias, rename the module file, and fix all imports/exports accordingly. Re-run pre-commit and tests, and update the existing branch/PR. What changed since the last summary • File rename ◦ openhands-sdk/openhands/sdk/conversation/secrets_manager.py → openhands-sdk/openhands/sdk/conversation/secret_registry.py • Alias removal ◦ Removed SecretsManager = SecretRegistry • Import updates ◦ Updated all imports to use openhands.sdk.conversation.secret_registry for SecretRegistry and SecretValue: ▪︎ SDK: base.py, conversation.py, impl/local_conversation.py, impl/remote_conversation.py, state.py ▪︎ Agent server: event_service.py, conversation_router.py ▪︎ Tests: tests/sdk/conversation/remote/test_remote_conversation.py, tests/sdk/conversation/test_secrets_manager.py • Public exports ◦ openhands-sdk/openhands/sdk/conversation/*init*.py now exports only SecretRegistry (removed SecretsManager from all) • Tests ◦ Updated tests to import from secret_registry and pass with the new naming Checks performed • Pre-commit on modified files: passed (ruff format/lint, pycodestyle, pyright) • Targeted tests: ◦ tests/sdk/conversation/test_secrets_manager.py and tests/tools/execute_bash/test_secrets_masking.py: 9 passed ◦ tests/sdk/conversation/remote/test_remote_conversation.py: 17 passed ◦ Additional secrets-related tests with -k secrets: 33 passed • Verified there are no remaining references to openhands.sdk.conversation.secrets_manager Conciseness • Only the files affected by the rename, alias removal, import updates, and all export changes were touched. No extraneous changes were made. Git • Branch: rename-secretmanager-to-secretregistry • Commit: refactor: rename SecretManager to SecretRegistry and module to secret_registry; remove alias; update imports/exports and tests • Pushed and updated the branch after rebasing with upstream Open question • The open PR (#965) is currently a draft and previously referenced an alias for backward compatibility. Do you want me to: ◦ Update the PR title and description to reflect the final requirements (no alias, module file renamed), and keep it as draft or mark ready for review? ◦ Also update the docs repo (OpenHands/docs) under sdk/ to reflect the new import path (secret_registry) and class name (SecretRegistry), and open a corresponding docs PR? Let me know your preference, and I will update the PR(s) accordingly. <sub>View full conversation</sub>
Final summary (since last update) What I changed • Tests: Renamed the local variable in tests/sdk/conversation/test_secrets_manager.py from manager to secret_registry for consistency with the SecretRegistry class. ◦ Replaced all instances of: ▪︎ manager = SecretRegistry() → secret_registry = SecretRegistry() ▪︎ manager.update_secrets(...) → secret_registry.update_secrets(...) ▪︎ manager.secret_sources → secret_registry.secret_sources ▪︎ found = manager.find_secrets_in_text(...) → found = secret_registry.find_secrets_in_text(...) ▪︎ env_vars = manager.get_secrets_as_env_vars(...) → env_vars = secret_registry.get_secrets_as_env_vars(...) Verification • Pre-commit on the modified file: passed (ruff format/lint, pycodestyle, pyright) • Targeted test run: tests/sdk/conversation/test_secrets_manager.py — 7 passed • Git diff check: only the one test file changed for this update Checklist - [ ] Request fully addressed: variable name updated to secret_registry in the specified test file - [ ] Changes are concise: no unrelated edits - [ ] Pushed to remote branch rename-secretmanager-to-secretregistry Git • Commit message: test: rename local variable to secret_registry in secrets tests for clarity and consistency • Branch: rename-secretmanager-to-secretregistry • Pushed to origin and updated the existing branch/PR with this commit <sub>View full conversation</sub>
Final summary (new changes only) What I changed in OpenHands/docs • Updated SDK docs under sdk/ to reflect SecretRegistry and secret_registry: ◦ sdk/arch/conversation.mdx: Renamed “Secrets Manager” → “Secret Registry” and updated link to openhands-sdk/openhands/sdk/conversation/secret_registry.py ◦ sdk/guides/secrets.mdx: Updated page title and body to “Secret Registry” • Verified with a grep across sdk/ that no remaining references to “Secrets Manager” or “secrets_manager” remain Git and PRs • Branch: rename-secretmanager-to-secretregistry-docs • Commit: docs(sdk): rename Secrets Manager to Secret Registry; update link to secret_registry.py and guide title/body Co-authored-by: openhands <openhands@all-hands.dev> • Docs PR (draft): https://github.com/OpenHands/docs/pull/61 ◦ Cross-referenced SDK PR: OpenHands/software-agent-sdk#965 Checklist - [ ] Updated docs under sdk/ for class and module rename - [ ] Changes are concise; only the two intended files modified - [ ] Pushed branch and opened a docs PR, linked to the SDK PR Would you like me to mark the docs PR ready for review or adjust the title/description to your preference? <sub>View full conversation</sub>
Answer On the current branch (rename-secretmanager-to-secretregistry), I searched the repo for "secrets_manager". Results: • No references to the old module path or class: ◦ No imports from openhands.sdk.conversation.secrets_manager ◦ No occurrences of the class name SecretsManager • Remaining matches are only for the ConversationState attribute name secrets_manager (and its usage in code/tests): ◦ openhands-sdk/openhands/sdk/conversation/state.py ◦ openhands-sdk/openhands/sdk/conversation/impl/local_conversation.py ◦ openhands-tools/openhands/tools/execute_bash/impl.py ◦ tests/tools/execute_bash/test_secrets_masking.py (docstring mention) ◦ tests/cross/test_agent_secrets_integration.py ◦ tests/sdk/conversation/test_conversation_secrets_constructor.py Conclusion: The class and module rename is complete; only the state attribute name secrets_manager remains (as designed). <sub>View full conversation</sub>
Answer You asked for an analysis of renaming ConversationState.secrets_manager → secret_registry and to be thorough about the implications. Summary of analysis • Impacted areas ◦ Internal SDK and tools: All references to conversation.state.secrets_manager must change to conversation.state.secret_registry (e.g., execute_bash). ◦ Tests: Update any usage of conv.state.secrets_manager and related local variable names/docstrings. ◦ Public API: This is a breaking change for any external code accessing the attribute directly. ◦ Serialization/persistence: The Pydantic model field rename changes the serialized key from "secrets_manager" to "secret_registry". Existing saved state/remote payloads using the old key will no longer load unless we handle migration. • Compatibility options ◦ Option A: Hard rename (no alias) ▪︎ Pros: Clean, no legacy naming. ▪︎ Cons: Breaks user code and older persisted state/remote payloads. ◦ Option B: Soft migration via Pydantic read-alias (recommended middle ground) ▪︎ Use validation_alias=AliasChoices("secret_registry", "secrets_manager") and serialization_alias="secret_registry". ▪︎ Reads accept either key; writes always emit "secret_registry". ▪︎ Keeps runtime code strict (no attribute alias), so user code must use state.secret_registry going forward. ▪︎ Minimizes breakage for loading older sessions and remote API consumers. • Files that will need updates when we proceed ◦ openhands-sdk/openhands/sdk/conversation/state.py (rename field) ◦ openhands-sdk/openhands/sdk/conversation/impl/local_conversation.py ◦ openhands-tools/openhands/tools/execute_bash/impl.py ◦ tests/tools/execute_bash/test_secrets_masking.py (docstring mention) ◦ tests/cross/test_agent_secrets_integration.py ◦ tests/sdk/conversation/test_conversation_secrets_constructor.py • Proposed workflow (per your branching request) ◦ Checkout main, pull latest, create a new branch from main. ◦ Apply the rename across SDK, tools, and tests. ◦ If you choose Option B, implement the read-alias to preserve loading older state. ◦ Run pre-commit on changed files, run targeted tests, then broader tests as needed. ◦ Open a new SDK PR and call out the breaking attribute rename; if Option B is chosen, note that persisted sessions remain loadable. Please confirm whether you want Option A (strict, no alias) or Option B (read-only alias for persistence/remote compatibility). Once confirmed, I’ll create a new branch from main and implement thoroughly. <sub>View full conversation</sub>
Final summary of changes just made Scope • Complete the state attribute rename from secrets_manager to secret_registry with backward-loading compatibility (Option B), and update all usages across SDK, tools, and tests. What changed (since last summary) • Conversation state ◦ openhands-sdk/openhands/sdk/conversation/state.py ▪︎ Renamed field to secret_registry: SecretRegistry ▪︎ Added Pydantic migration helpers: ◦ validation_alias=AliasChoices("secret_registry", "secrets_manager") ◦ serialization_alias="secret_registry" ▪︎ Effect: Older persisted state with "secrets_manager" loads successfully; new serialization uses "secret_registry". No runtime attribute alias—code must use state.secret_registry. • SDK and tools usage updates ◦ openhands-sdk/openhands/sdk/conversation/impl/local_conversation.py ▪︎ self._state.secret_registry.update_secrets(...) ◦ openhands-tools/openhands/tools/execute_bash/impl.py ▪︎ Conversation env export and masking now use conversation.state.secret_registry • Tests/docstrings updates ◦ tests/tools/execute_bash/test_secrets_masking.py ▪︎ Docstring updated to reference conversation.state.secret_registry ◦ tests/cross/test_agent_secrets_integration.py ◦ tests/sdk/conversation/test_conversation_secrets_constructor.py ▪︎ All references updated to secret_registry (attribute and local variables) Validation • Pre-commit hooks passed (ruff format/lint, pycodestyle, pyright). • Targeted tests: ◦ tests/tools/execute_bash/test_secrets_masking.py::test_bash_executor_with_conversation_secrets — passed ◦ tests/sdk/conversation/test_conversation_secrets_constructor.py — 10 passed ◦ tests/cross/test_agent_secrets_integration.py — 9 passed • Broader keyword subset: ◦ uv run pytest -k secrets — 33 passed, 1 unrelated mark warning • Final grep: ◦ Secrets attribute references fully migrated; only remaining “secrets_manager” appears inside validation_alias (intended). Checklist - [ ] Rename ConversationState.secrets_manager → secret_registry - [ ] Add read-alias for backward loading; always serialize as secret_registry - [ ] Update SDK tools and code references - [ ] Update tests and docstrings - [ ] Run pre-commit and targeted tests - [ ] Repo-wide search to ensure no stray references remain Branch and commit • Branch: rename-state-secrets-attr (from up-to-date main) • Pushed: yes • Commit message: ◦ sdk(conversation): rename state field to secret_registry with read-alias for backward loading; update SDK/tools/tests to new attribute ◦ Co-authored-by: openhands <openhands@all-hands.dev> Next actions • Do you want me to open a PR for this branch now and draft the breaking-change note (runtime attribute rename) plus backward-loading note? Or keep the branch pushed but without a PR yet? <sub>View full conversation</sub>
Final summary (new since last summary) • Opened a draft PR with the completed rename work: ◦ PR: https://github.com/OpenHands/software-agent-sdk/pull/969 ◦ Branch: rename-state-secrets-attr (pushed) Quick compliance checklist • Rename done: ConversationState.secrets_manager → secret_registry (runtime attribute only) • Backward loading: validation_alias accepts both "secret_registry" and "secrets_manager"; serialization emits "secret_registry" • Usages updated: SDK/tools/tests migrated to state.secret_registry • Quality gates: pre-commit (ruff, pycodestyle, pyright) passed; targeted tests passed • Residual references: none, except the intended validation_alias literal • Changes are concise: only touched files directly required for the rename Pending • Docs update (r6): reflect state.secret_registry in SDK docs. <sub>View full conversation</sub>
Final summary (new since last update) • Opened a draft PR with the rename work: ◦ PR: https://github.com/OpenHands/software-agent-sdk/pull/969 ◦ Branch: rename-state-secrets-attr (already pushed) • Audited examples/ ◦ Searched for “secrets_manager”/“SecretManager” — none found ◦ examples/01_standalone_sdk/12_custom_secrets.py uses Conversation.update_secrets(...) and remains compatible; no references to conversation.state.secrets_manager ◦ No example changes required Checklist • Request addressed: Yes — PR opened; examples reviewed and updated only if needed (none needed) • Changes concise: Yes — only essential files were modified; examples left untouched since they were already compatible • CI/quality gates: Previously verified (pre-commit and targeted tests green); unchanged by example review Next steps • Do you want me to mark the PR ready for review? • Optional: I can augment 12_custom_secrets.py with a brief snippet showing conversation.state.secret_registry usage (e.g., get_secrets_as_env_vars) if you want a more explicit example. • Docs: I can update the docs PR to explicitly reference state.secret_registry where applicable. <sub>View full conversation</sub>