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 calls self._conversation.set_confirmation_policy(policy); no self.stored update, no save_meta()
EventService.set_security_analyzer (line 1677) — same pattern
EventService.update_secrets (line 1658) — only calls self._conversation.update_secrets(secrets); no self.stored update, no save_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
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.
Bug Description
When
set_confirmation_policy,set_security_analyzer, orupdate_secretsare called via the API, the change is written toConversationState/base_state.jsonbutStoredConversation/meta.jsonis never updated. On next startup,event_service.pylines 1090–1102 read all three fields fromstoredto initialize the conversation, so the changes are silently reverted after eviction or server restart.Expected Behavior
API mutations to
confirmation_policy,security_analyzer, andsecretspersist 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:
set_confirmation_policy)_event_services_get_or_load_event_servicepytest 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.pyreads all three fromstored:Compare to
EventService.apply_resume_secrets(lines 352–355) which correctly updatesself.storedand callsawait self.save_meta()after mutating state.Acceptance Criteria
set_confirmation_policyupdatesself.stored.confirmation_policyand callssave_meta()after mutatingConversationStateset_security_analyzerupdatesself.stored.security_analyzerand callssave_meta()after mutatingConversationStateupdate_secretsupdatesself.stored.secretsand callssave_meta()after mutatingConversationStateAdditional Context
Discovered while reviewing #4617.
tagsis currently the only field where API mutations correctly write back tostoredand persist tometa.json. Discussed in #proj-agent-server.