Skip to content

fix(config): hold the config write lock across developer, embeddings, auth and sync config writes (#21858) - #21860

Merged
mrveiss merged 3 commits into
mainfrom
issue-21858-config-lock-review-gates
Nov 19, 2026
Merged

mrveiss merged 3 commits into
mainfrom
issue-21858-config-lock-review-gates

Conversation

@mrveiss

@mrveiss mrveiss commented Nov 19, 2026

Copy link
Copy Markdown
Owner

Thinking Path

#21742 put agent-config writes under the one CONFIG_WRITE_LOCK. Six more direct config_manager set+save sequences still bypassed it and could lose a write against a rollback or ConfigService write. Same store, same lock: wrap them with locked_config_write, add no second lock.

What Changed

  • New services/config_manager_writer.py: set_nested_and_save, merge_nested_and_save, both @locked_config_write.
  • Covered: api/developer.py (config update), api/embeddings.py (model refresh), api/auth.py (_persist_password_change), utils/llm_config_sync.py (models-list populate), services/web_research_config.py (save_settings, decorated), config/model_config.py (update_llm_model, decorated).
  • All three extra writers are read-modify-saves of the same config store, so all were taken; none left out.
  • config_write_lock.py docstring no longer lists uncovered writers.
  • auth.py: open PR chore(merge-train): #21233 #21162 #21132 #21258 #21267 #21285 edits lines ~358-372 (password verification); this edit is at the persist function, disjoint. File stays below its grandfathered 650.
  • Test: api/config_manager_write_lock_21858_test.py (Event checkpoints, re-raised worker errors, final-state asserts).

Verification

No local tests (owner rule). Compiled with py_compile; the pre-commit hooks passed; CI runs the suite.

Model Used

Claude Sonnet 5.5 (claude-sonnet-5-5)

Closes #21858

🤖 Generated with Claude Code

@mrveiss mrveiss added bug Something isn't working backend phase:M4.4 One config source labels Nov 19, 2026
@coderabbitai

coderabbitai Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 47 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

Commits

Reviewing files that changed from the base of the PR and between ef5b242 and 5002cb4.

Files selected for processing: 12

  • autobot-backend/api/agent_config_write_lock_21742_test.py
  • autobot-backend/api/auth.py
  • autobot-backend/api/config_manager_write_lock_21858_test.py
  • autobot-backend/api/developer.py
  • autobot-backend/api/embeddings.py
  • autobot-backend/config/model_config.py
  • autobot-backend/services/agent_config_writer.py
  • autobot-backend/services/config_manager_writer.py
  • autobot-backend/services/config_write_lock.py
  • autobot-backend/services/web_research_config.py
  • autobot-backend/tests/_config_write_lock_doubles.py
  • autobot-backend/utils/llm_config_sync.py
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@github-actions

Copy link
Copy Markdown
Contributor

✅ SSOT Configuration Compliance: Passing

🎉 No new hardcoded values of either class — ssot and other both block.

Known backlog in pipeline-scripts/hardcoded_values_baseline.txt is suppressed and tracked in #14371.

@mrveiss mrveiss added the land-next Landing set: CI capacity goes to these PRs first (owner direction 2026-09-18, #15397) label Nov 19, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Notice: 29 open PRs — past the runaway threshold (25)

This is not a request to defer this PR. There is no cap on open PRs (#19397) -- nothing blocks opening or pushing a PR.

This notice only means the count is high enough to be worth a glance for a runaway — something opening PRs in a loop, or a merge pipeline that has stalled so nothing is draining.

Currently open:

If the queue is draining normally, ignore this. Otherwise:

  1. Check whether CI is dispatching at all — see the ci-dispatch-watchdog status on these PRs
  2. Approved PRs land through the merge train the coordinator sequences (merge commits, never squash) -- check the open chore(merge-train) PR is moving, not each PR on its own
  3. Look for a loop opening near-identical PRs

Warn-only runaway detector — .github/workflows/pr-queue-gate.yml. It never blocks a merge.

@mrveiss

mrveiss commented Nov 19, 2026

Copy link
Copy Markdown
Owner Author

Verdict: APPROVE @ 81388ea

The review at ed1d1b4 approved the PR with three Low findings, all fixed in this commit:

  • The config_write_lock.py docstring now states exactly what the sweep proved: every config_manager.save_settings() caller is locked, and it names them. It says the sweep did not cover other store writes, replacing the overclaim "nothing uncovered".
  • The shared concurrency test helpers (ParkingStore, Workers, run_serialised) moved to api/config_write_lock_testing.py. That name is not collected by pytest.ini python_files. Both lock tests import from it, so there are no more private cross-test imports.
    • The 21858 test's rollback agent is "orchestrator", the first key of DEFAULT_AGENT_CONFIGS (api/agent_config.py) and the same agent the test used before through next(iter(...)). An unknown id would raise UnsupportedRollbackTarget (config_rollback.py:69-70), so a rename fails loudly.
  • config_manager_writer and agent_config_writer now cross-reference each other. They stay two modules because the agent writers read and return the prior value inside the same locked body.

#21858's ACs (from the review):

  • Every listed read-modify-write holds CONFIG_WRITE_LOCK. That covers developer, embeddings and auth, plus the model-list sync, web_research_config.save_settings and update_llm_model, with no second lock.
  • The docstring is updated.
  • A parked-writer test serialises the developer merge against rollback_locked.

The auth.py hunks are disjoint from open train #21285. Unresolved threads: 0.

@mrveiss mrveiss removed the land-next Landing set: CI capacity goes to these PRs first (owner direction 2026-09-18, #15397) label Nov 19, 2026
@mrveiss

mrveiss commented Nov 19, 2026

Copy link
Copy Markdown
Owner Author

Verdict: APPROVE @ 5002cb4

Fixes the red python-suite shard 2/8 at 81388ea.

Cause. The unconnected-code gate (#20512) reported module:autobot-backend/api/config_write_lock_testing.py. That name matches no test-file pattern (autobot_shared/testfile_names._PY_TEST_RE), so the gate treated the shared helper as an unimported production module.

Fix. The module moves to autobot-backend/tests/_config_write_lock_doubles.py, where the repo already keeps shared test doubles (tests/test_helpers.py, tests/memory_graph/_graph_test_doubles.py). Both lock tests import it from there.

No production change. The pre-push guard stage passed, and main is an ancestor of the head. Unresolved threads: 0.

@mrveiss mrveiss added the land-next Landing set: CI capacity goes to these PRs first (owner direction 2026-09-18, #15397) label Nov 19, 2026
@mrveiss
mrveiss merged commit 518fda9 into main Nov 19, 2026
65 checks passed
@mrveiss
mrveiss deleted the issue-21858-config-lock-review-gates branch November 19, 2026 08:05
@mrveiss mrveiss removed the land-next Landing set: CI capacity goes to these PRs first (owner direction 2026-09-18, #15397) label Nov 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend bug Something isn't working phase:M4.4 One config source

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

1 participant