OpenHands / OpenHands/software-agent-sdk
[Bug]: confirmation_policy, security_analyzer, and secrets mutations not persisted to meta.json
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1.1k
- Forks
- 539
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 137
Description
Bug Description
When set_confirmation_policy, set_security_analyzer, or update_secrets are called via the API, the change is written to ConversationState/base_state.json but StoredConversation/meta.json is never updated. On next startup, event_service.py lines 1090–1102 read all three fields from stored to initialize the conversation, so the changes are silently reverted after eviction or server restart.
Expected Behavior
API mutations to confirmation_policy, security_analyzer, and secrets persist across conversation eviction and server restart.
Actual Behavior
Changes are lost; the conversation reverts to the values set at creation time. This can be verified by running the existing test suite and adding a test that:
- Creates a conversation
- Calls the mutation endpoint (e.g.
set_confirmation_policy) - Simulates eviction by removing the event service from
_event_services - Reloads the conversation via
_get_or_load_event_service - Asserts the updated value is still present
pytest tests/agent_server/ -k "confirmation_policy or security_analyzer or secrets"
The relevant code paths are:
EventService.set_confirmation_policy(line 1668) — only callsself._conversation.set_confirmation_policy(policy); noself.storedupdate, nosave_meta()EventService.set_security_analyzer(line 1677) — same patternEventService.update_secrets(line 1658) — only callsself._conversation.update_secrets(secrets); noself.storedupdate, nosave_meta()
On startup, event_service.py reads all three from stored:
# line 1090
secrets=self.stored.secrets,
# line 1101
conversation.set_confirmation_policy(self.stored.confirmation_policy)
# line 1102
conversation.set_security_analyzer(self.stored.security_analyzer)
Compare to EventService.apply_resume_secrets (lines 352–355) which correctly updates self.stored and calls await self.save_meta() after mutating state.
Acceptance Criteria
-
set_confirmation_policyupdatesself.stored.confirmation_policyand callssave_meta()after mutatingConversationState -
set_security_analyzerupdatesself.stored.security_analyzerand callssave_meta()after mutatingConversationState -
update_secretsupdatesself.stored.secretsand callssave_meta()after mutatingConversationState - Tests verify each change survives a simulated eviction/reload
Additional Context
Discovered while reviewing #4617. tags is currently the only field where API mutations correctly write back to stored and persist to meta.json. Discussed in #proj-agent-server.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with EventService.update_secrets, set_confirmation_policy, and set_security_analyzer in event_service.py, then compare them with apply_resume_secrets around lines 352–355. Run pytest tests/agent_server/ -k "confirmation_policy or security_analyzer or secrets" and add coverage for eviction and reload. Done means all three mutations remain present after _get_or_load_event_service reloads the conversation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 82/100