Skip to content

bug(config): developer, embeddings and auth config_manager writes bypass the config write lock #21858

Closed

Description

@mrveiss

Found while landing #21742 (agent-config writes now hold the one config write lock).

Problem

services/config_write_lock.py serialises the ConfigService writers, the agent-config writes and config rollback. These direct config_manager read-modify-writes still take no lock, so they can interleave with a rollback or a ConfigService write and lose one of the two writes:

  • autobot-backend/api/developer.py:141-142 (set_nested("developer", ...) + save_settings())
  • autobot-backend/api/embeddings.py:178-182 (set_nested(...) + save_settings())
  • autobot-backend/api/auth.py:387-391 (set_nested(...) + save_settings())

Other direct writers seen in the same grep, to be judged in this issue: autobot-backend/utils/llm_config_sync.py:219-222, autobot-backend/services/web_research_config.py:87-92, autobot-backend/config/model_config.py:83-86.

Acceptance criteria

  • Each listed read-modify-write holds CONFIG_WRITE_LOCK (via locked_config_write) for its whole operation; no second lock is added.
  • The config_write_lock.py docstring no longer lists them as uncovered.
  • A test shows a concurrent write from one of them and a rollback serialise.

Activity

  1. added
    needs-ac-evidenceClosed by a merge keyword; awaits an AC evidence table comment (#19520)
    on Nov 19, 2026
  2. github-actions commented on Nov 19, 2026

    @github-actions
    Contributor

    Landed in #21860, merge 518fda9daf

  3. removed
    needs-ac-evidenceClosed by a merge keyword; awaits an AC evidence table comment (#19520)
    on Nov 19, 2026
  4. mrveiss commented on Nov 19, 2026

    @mrveiss
    OwnerAuthor

    Closure evidence, origin/main after #21860 (5002cb4):

    AC Evidence
    Each listed read-modify-write holds CONFIG_WRITE_LOCK for its whole operation, with no second lock The new autobot-backend/services/config_manager_writer.py:16-17,23-24 defines set_nested_and_save and merge_nested_and_save, both @locked_config_write. Callers: api/developer.py:138 (merge_nested_and_save, so the read is now inside the lock), api/embeddings.py:179 and api/auth.py:388 (set_nested_and_save). The extra writers are locked too: utils/llm_config_sync.py:220 (a whole-key overwrite of the model list), services/web_research_config.py:82 and config/model_config.py:80 (@locked_config_write on save_settings / update_llm_model). No new lock object; all of them share the RLock in services/config_write_lock.py.
    The config_write_lock.py docstring no longer lists them as uncovered Lines 11-17 list them as covered. They state that every config_manager.save_settings() caller is locked and name the sweep result, and they say the sweep covers save_settings only.
    A test shows a concurrent write from one of them and a rollback serialise api/config_manager_write_lock_21858_test.py::test_developer_merge_and_rollback_do_not_lose_either_write (L16) parks one writer inside the lock and asserts that rollback_locked does not enter until it is released, then checks the final state. ::test_two_direct_writers_do_not_interleave (L33). Shared doubles: tests/_config_write_lock_doubles.py.
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

    backendbugSomething isn't workingphase:M4.4One config source

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions