Skip to content

[Bug]: confirmation_policy, security_analyzer, and secrets mutations not persisted to meta.json #4810

Description

@BSmick6

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:

  1. Creates a conversation
  2. Calls the mutation endpoint (e.g. set_confirmation_policy)
  3. Simulates eviction by removing the event service from _event_services
  4. Reloads the conversation via _get_or_load_event_service
  5. 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

  • set_confirmation_policy updates self.stored.confirmation_policy and calls save_meta() after mutating ConversationState
  • set_security_analyzer updates self.stored.security_analyzer and calls save_meta() after mutating ConversationState
  • update_secrets updates self.stored.secrets and calls save_meta() after mutating ConversationState
  • 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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingpriority:mediumFor bugs, a serious source of annoyance, but not blocking a large number of users.ready-for-devIssue meets development readiness criteriasession

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions