You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Test runs wrote logs/backend.log into whatever checkout they ran from because the log directory defaulted to a cwd-relative logs/. The fix is one shared resolver that every log writer uses, plus a guard that stops new in-repo log paths from appearing. Sites that cannot be migrated in this PR are frozen in a baseline and tracked in #20934, so the guard blocks growth now and the remainder is migrated there.
What Changed
autobot_shared/log_dir.py: new resolve_logs_dir(). Uses AUTOBOT_LOGS_DIR when set, otherwise a per-run temp directory. It never returns a path inside the source tree.
autobot_shared/logging_manager.py, autobot_shared/env_registry_logging.py, autobot_shared/ssot_config.py, autobot_shared/ssot_constants.py, autobot-backend/api/logs.py, autobot-backend/api/analytics_log_patterns.py: cwd-relative log defaults now use the resolver.
conftest.py, repo_tests/_mocked_config_import.py: test runs resolve the log directory outside the source tree.
autobot_shared/log_dir_20894_test.py: unit tests for the resolver.
docs/developer/ENV_VARS.md: documents the default.
plugins/core-plugins/logger-plugin/main.py:17, autobot-slm-backend/monitoring/performance_monitor.py, autobot_shared/ssot_config.py:80: now use resolve_logs_dir() / ssot_config.path.logs_path (two baseline sites migrated; plugin honours AUTOBOT_LOGS_DIR).
Deployment: the backend unit loads backend.env (autobot-backend.service.j2:62), not distributed.env (distributed.env.j2:35, coordinator only), so it had no AUTOBOT_LOGS_DIR; now set at roles/backend/templates/backend.env.j2:68 (backend_app_log_dir, defaults/main.yml:191).
The application logs (AUTOBOT_LOGS_DIR) and each unit's own stdout/stderr (StandardOutput=append:) deliberately use different directories: the file names overlap, and one file written by both systemd and the application's rotating handler would carry duplicate records and be orphaned on rotation. Each role declares the two as separate variables (backend_log_dir / backend_app_log_dir and the matching pairs); a guard in service_units_set_logs_dir_20894_test.py fails when they resolve to the same directory.
The audit log default is unchanged: <base>/logs/audit.log.
Visible location change for the backend only: its application log files move one directory up, from <base>/autobot-backend/logs (the old working-directory-relative default) to <base>/logs, which the existing log rotation already covers. The SLM backend, NPU worker, TTS worker and AI stack keep writing where they did. The unit's own stdout/stderr files stay in /var/log/autobot.
Verification
Guard test repo_tests/no_in_repo_log_path_20894_test.py runs in CI and in the pre-push fast gate.
Pre-push hook passed on the pushed head (see the park output on the branch).
Single-issue rationale: the resolver, its guard and the baseline form one change to the log-path rule and share no files with another open issue.
Service units (review follow-up)
Every Python service unit now sets AUTOBOT_LOGS_DIR; guard repo_tests/service_units_set_logs_dir_20894_test.py (15 units found, plus a planted-template control):
static units under autobot-infrastructure/*/templates/ (ai-stack, user-backend, npu-worker, slm-backend): <WorkingDirectory>/logs
Declined: the review's minor on _under_pytest() (module-level LOGS_DIR is read at collection, before PYTEST_CURRENT_TEST exists). Done: the per-process temp log directory is removed at exit.
File logging starts at service startup (maintainer decision 2026-11-09)
The import-hermeticity sweep failed because 268 swept modules log at import (49 sites, #21264) and the log file now lives outside the tree. Decision: file handlers attach only when a service calls the logging setup at startup; before that, records go to the console (stdout/stderr, captured by systemd/docker on every route). Importing a module writes no file. #21264 stays as cleanup and no longer blocks this PR.
Design (autobot_shared/logging_manager.py, the one logging module):
get_logger gives a logger console handlers only until startup, and records it in LoggingManager._managed.
acp/__main__.py:38, pki/cli.py:184, eval/run.py:218, chat_history/session_reply_backfill.py:215, chat_history/session_scope_backfill.py:274, services/workflow_redis_backfill.py:210, services/pricing_refresh.py:310, services/autoresearch/run_experiment.py:90, database/migrations/001_create_conversation_files.py:536, autobot_shared/error_boundaries/__main__.py:55, tools/index_documentation.py:215, scripts/{migrate_ceo_chat_to_sessions,migrate_connector_credentials,repair_kb_vector_index}.py, 7 scripts under autobot-infrastructure/shared/scripts/ (analysis/main.py:40 already called it)
Not wired, each with a reason in the guard:
stdlib logging only, never the logging manager (checked: the file must not name it): AI stack ai_api_server.py, NPU npu_inference_server.py, NPU and TTS worker templates (npu-worker.py.j2, tts-worker.py.j2), SLM agent slm/agent/agent.py.
console only by design: pipeline-scripts/pr_conflict_gate.py (CI job; the job log is its output).
76 modules frozen in repo_tests/entry_points_start_file_logging_20894_baseline.py: 75 library modules with a demo __main__ block, plus enhance_workflow_ui.py, which is over the 600-line ceiling. Not wired here because of the 100-file cap and the size pins. Follow-up: chore(logging): wire setup_logging() into the 76 __main__ blocks frozen by #20894 #21272. The list only shrinks.
Audit log: no audit record depends on file logging. Audit records go through services.audit.audit (the canonical trail). MiscConfig.audit_log_file is a path setting that no logging-manager handler writes. The audit log channel (get_audit_channel_logger) has no non-test caller. So no audit record emitted at import is lost to the console.
Guards and tests:
repo_tests/entry_points_start_file_logging_20894_test.py finds entry points mechanically: every Python unit template mapped to its source (a new unit fails until it is mapped), module-level FastAPI/Starlette/create_app/Celery apps, and __main__ modules that import the logging manager. Each must call the function imported from the logging manager; a local function with the same name does not count. Otherwise it must be exempt with a reason. A control plants each kind of entry point without the call.
repo_tests/import_hermeticity_file_logging_20894_test.py: a module that logs at import passes the sweep's own probe. The control, the same module with setup_logging() at import, fails it with HERMETIC_VIOLATION.
autobot_shared/logging_manager_startup_20894_test.py: before startup, no file; after startup, an existing logger writes to the file; later loggers get it too; startup is idempotent (one handler).
Full sweep: 936 modules examined, 6 failing, none involving a log file. All 6 are environment-specific and tracked in bug(backend): importing API modules spawns nvidia-smi and loads transformers (hidden from the CI sweep) #21283. Four spawn nvidia-smi through gpu_telemetry.py:198 (this host has it on PATH; the CI runner has none, so shutil.which gates the spawn). Two (api.multimodal, api.vision) write through the import-time probe in filelock/_strict.py, reached via transformers. The last green full sweep on main (2026-11-06) passed these two, so whether CI hits that probe is unverified.
The PR's touched tests plus env_planes_agree, ssot_config_test and the logging_manager tests: 198 passed. The earlier run that included changes_job_equivalence: 561 passed; its 3 failures were the new test colliding with the backend conftest's get_logger stub, fixed since.
Sweep controls and the new control: 23 passed. flake8: clean. File sizes: within ceilings.
Sweep
Command: git grep -nE "logs?/|\.log\b" -- '*.py' '*.sh' '*.yml' on this PR head (92ebb06): 986 hits on origin/main before the PR, 677 hits outside tests after (tests, repo_tests, conftest excluded). Most are docs, comments, test fixtures or read paths. In-repo log-path WRITERS among them (non-test; write call plus a literal logs/ or .log path), each listed:
Status: the cwd-relative logs/ writers in the 10 files frozen in repo_tests/no_in_repo_log_path_20894_baseline.py (ratchet, only goes down) are listed, not fixed here. Writers on absolute paths (/var/log/autobot/..., /app/logs/...) are outside the source tree. startup_coordinator.py and boundary_manager.py used a cwd-relative logs/; both are now migrated to autobot_shared/log_dir.py (resolve_logs_dir + FirstWriteFileHandler) in 40c57ee.
Sync with main (843 commits)
Merged origin/main into the branch (merge commit, no rebase). One textual conflict: repo_tests/changes_job_equivalence_15360_test.py, where main replaced the per-PR allowed-additions table with in-place, cited filter entries (#21205). Took main's file; this PR's four template-directory entries already sit in .github/filters/python-paths.yml with their # #20894 citation.
Staleness re-derived on the merged tree:
In-repo log-path detector: 11 sites in 10 files, identical to no_in_repo_log_path_20894_baseline.py; main added no new writer.
Entry-point guard: every launched target that is not exempt calls setup_logging(); no Python unit template or compose service was added or removed on main since the branch point.
no-in-repo-log-path-20894 reach floor 4005 against a live population of about 4122 (allowance 400): inside the window, not in the bottom band.
scripts/python_file_size_known_large.py: error_catalog.py pin lowered 775 to 774 (this PR removes the import-time load).
Name check: the only new public names are resolve_logs_dir and FirstWriteFileHandler; neither exists on main.
Tracked-file guard (repo_tests/no_tracked_cache_or_log_files_20892_test.py) now enumerates through tracked_paths (main's direct git ls-files ratchet) and declares a min_fraction=0.9 reach over the whole tree; its control fixture uses logs/example.log, a path that never exists, so the python-filter guard does not read a real local logs/backend.log.
Summary by CodeRabbit
New Features
Application logs now use a configurable directory, with a per-user state-directory fallback when none is set. Log files and directories are created on the first log write.
Deployment settings now support custom log locations across services, containers and Ansible-managed installations.
Services can start when the configured log directory is not yet present; deployment creates and configures the application log directory.
Documentation
Clarified log-directory configuration, defaults and the distinction between application logs and service output.
Bug Fixes
Improved logging startup and graceful handling of unavailable log locations.
It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.
This change centralises log-directory resolution, defers file creation until first log write, enables file logging at process startup, updates deployment templates to pass AUTOBOT_LOGS_DIR, adds repository checks for these rules, and makes error-catalog loading lazy and locked.
Adds resolve_logs_dir() and FirstWriteFileHandler. Shared logging code now uses resolved log paths and delayed file creation. Several log consumers switch from relative logs paths or eager file handlers to the shared resolver and deferred handler.
Many launched Python entry points now call setup_logging() at startup. Celery enables file logging from startup signals. Compose, static service units, and Ansible templates now set AUTOBOT_LOGS_DIR, add writable-path settings, and add shared tasks that create application log directories.
ErrorCatalog now defers loading until first accessor use, serialises first load with a re-entrant lock, sets source before _initialized, and updates probe code and tests for unloaded and concurrent first-use cases.
Merge Risk: Low · previous review 22ea7
This change moves log files out of the source tree and makes file logging start at service startup. Most deployment and guard issues raised in earlier reviews are fixed. A few edge cases remain: an unusual no-home, no-temp-directory environment, inventory overrides of the backend log directory, a config-only worker deploy that skips directory creation, and gaps in the new repository guards. None of these block ordinary deployments, but they are worth fixing before or soon after merge.
Pre-merge checks: 4
Check name
Status
Explanation
Description Check
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
The title names the main change: a single log-directory resolver (resolve_logs_dir, AUTOBOT_LOGS_DIR) plus guards against in-repo log paths. The changeset matches this. The title follows the conventio…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Title check
Explanation
The title names the main change: a single log-directory resolver (resolve_logs_dir, AUTOBOT_LOGS_DIR) plus guards against in-repo log paths. The changeset matches this. The title follows the conventional-commit style and cites the issue number. It is slightly dense, but it is specific and clear.
Finishing Touches
Generate unit tests (beta)
Commit to this branch
Create a new PR
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.
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.
If the queue is draining normally, ignore this. Otherwise:
Check whether CI is dispatching at all — see the ci-dispatch-watchdog status on these PRs
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
Look for a loop opening near-identical PRs
Warn-only runaway detector — .github/workflows/pr-queue-gate.yml. It never blocks a merge.
The reason will be displayed to describe this comment to others. Learn more.
Code review (code-reviewer pass) at 1a0da9a -- CHANGES NEEDED
One resolver exists (autobot_shared/log_dir.py, stdlib-only, env-backed, no IPs) and the guard, baseline count (13 sites, 12 files, sums to 13) and floor are sound. Three items need work before merge.
#
Severity
Where
Finding
Fix
1
Blocker
plugins/core-plugins/logger-plugin/main.py:28
A second log-dir reader remains. It reads only the deprecated AUTOBOT_LOG_DIR. Since this PR makes AUTOBOT_LOGS_DIR the one name (and installs set only that), the plugin silently falls back to a temp dir: a regression, and exactly the "no second resolver" requirement.
Use resolve_logs_dir() (or PATH.LOGS_DIR) for the base. Add a test.
Baselined but trivially migratable. ssot_config.path.logs_dir now IS the resolver (PathConfig.logs_dir, line 1251), so the first is Path(ssot_config.path.logs_dir) / "performance". The second can call resolve_logs_dir() / "audit.log" (same module, no import cycle: log_dir is already imported there). Leaving them keeps a source-tree log path and an audit-log default that disagrees with PATH.LOGS_DIR.
Migrate both, lower BASELINE to 11 (the security_layer_test pin moves with it).
Value is correct: the live population at the head is 3986 (measured: tracked non-test .py, by the guard's own filter), and with growth=0 the repin tool's mid value is highest - 0 = 3986, so a hand edit equals what scripts/repin_reach_floors.py writes (the +22 is just live growth, not tied to the guard's declarations). But growth=0 means slack>0 is stale (Reach.staleness) on every train once any other PR adds one non-test .py: a red-for-one-more-file pin, in a population that grows constantly.
Declare growth= (e.g. 100) and pin mid-window with the repin script.
4
Medium
default config
Resulting path on the default config is NOT identical to before: unset AUTOBOT_LOGS_DIR moves from <checkout>/logs to $XDG_STATE_HOME/autobot/logs, and PATH.LOGS_DIR/api/logs.py/analytics_log_patterns.py follow. This is the stated intent of #20894 and deployed nodes set the env explicitly (agent.env, distributed.env, slm-agent unit, compose), but I found no explicit setting for the backend unit itself. Confirm it inherits distributed.env, and state the change in the changelog entry.
Evidence in PR body.
5
Low
detector blind spots
rotate_startup_logs.py:23 (Path("logs")), windows-npu-worker/app/worker_settings.py:191, gui/utils/app_config.py:22 (self.app_dir / "logs"), and hardcoded /var/log/autobot in api/files.py:1136, services/process_adapter_service.py:45 are not seen by the guard, so "13" is a lower bound.
stdlib logging.getLogger is justified (bootstrap, stdlib-only) and no repo_tests guard forbids it.
None.
Checked clean: no fixed sleeps, no line-number comments in the diff; all files under 600 lines; no swallowed errors (the OSError path in logging_manager is pre-existing and sets _file_logging_disabled); resolver tests cover unset/XDG/env/relative-anchor/alias-warn-once/precedence/subprocess write; the guard has a control-string test and a planted-violation test; _reach_unscoped addition is documented.
Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.
Scope: everything after the previous verdict (b352ecc) that is not a pure merge of main: 42a0816 (task-file enumeration without a glob) and f6cf0f9 (collision detector reads a jinja path whole; reach assertion). Both are test-only and correct. The CHANGES verdict comes from the whole-PR sweep, not from those two commits.
The template now reads backend_app_log_dir, declared only in roles/backend/defaults/main.yml:191. playbooks/deploy-backend-env.yml loads no role (vars_files vars/backend-env.yml, which has backend_log_dir/backend_data_dir but not the new variable) and templates backend.env.j2 at line 69, so the render sees an undefined variable. update-all-nodes.yml is not affected (it uses include_role ... tasks_from: env_only, which puts the role defaults in scope). Not run; whether that playbook already trips on other role-only variables is not verified.
Add backend_app_log_dir: "{{ autobot.base_dir }}/logs" next to backend_log_dir in playbooks/vars/backend-env.yml (or `
Application log directories are created only on full-provision paths (main.yml). The updater's code-only / self-update paths do not create them, and no task creates an overridden backend_app_log_dir. Default paths are fine (under an install dir the service user owns, or <base>/logs from the common role); only overrides can leave a missing dir, and then file logging turns off with one stderr line while console logging continues.
Add the directory task to the code-only / unit-deploy task files (bot suggestions are usable as written).
Textual conflict in the import block: both PRs insert an import after autobot_shared.env_utils (this PR log_dir, #21251logging_once). Semantic collision as well: #21251 deletes _warned_config_keys; this PR's tests (logging_manager_startup_20894_test.py:26, ..._config_types_19288_test.py:38, ..._readonly_logs_19628_test.py:35, ..._shared_handler_20139_test.py:49) monkeypatch.setattr(logging_manager, "_warned_config_keys", ...), which raises once the attribute is gone. #21251 also rewrites the same four tests' fixtures (reset_log_once()). Hunks in _warn_config_fallback/_warn_file_logging_off themselves do not collide.
Whichever lands second rebases: replace the monkeypatch with the #21251 reset helper.
Pre-existing on main, not introduced here: the coordinator's AUTOBOT_LOGS_DIR is the directory the backend unit's StandardOutput appends backend.log to (both use the default log type name backend). The guard checks directory equality per unit, so a cross-unit overlap is out of its reach.
Track separately if the coordinator is co-hosted with the backend.
INFO
Old backend location
Backend app logs move <base>/autobot-backend/logs -> <base>/logs (declared in the PR body). Existing files stay in the old directory; nothing migrates them. No reader of the old path found at head (no non-test hit for autobot-backend/logs other than hardened-compose tmpfs for the legacy path; api/logs.py and analytics_log_patterns.py use the resolver). Logrotate already globs {{ autobot.base_dir }}/logs/*.log (roles/common/templates/autobot-logrotate.j2:58), so the new location is rotated; the old one never was.
None blocking.
Role / log-path table (templates and defaults at head)
none (all four have no append: directives); user-backend and slm-backend set LogsDirectory=autobot (/var/log/autobot)
none
No application directory equals a directory that systemd creates via LogsDirectory= (/var/log/autobot, only on the static user-backend and slm-backend units, whose application dirs are under /opt/autobot//logs). The two static units that use ProtectSystem=strict with an optional ReadWritePaths=- entry for the application dir rely on the directory already existing (shipped by the install); no task creates it (not verified on a host).
Guard reach: _MIN_COLLISION_CHECKED = 6 is a real floor. 8 units both set the variable and append output (backend, celery, celery-beat, mcp-bridge, slm-backend, ai-stack, npu-worker, tts-worker). _unresolved skips units with an empty out/apps set and counts only fully resolved ones, so if _OUTPUT matched nothing, resolved would be 0 and test_the_collision_check_resolves_both_directories... fails. test_control_..._is_caught also asserts an undefined default is reported as unresolved. Remaining limits: the floor is 6 against 8 (two units of slack), and equality is checked per unit and per directory, not per file name or across units.
Resolver
autobot_shared/log_dir.py is the single definition (resolve_logs_dir; logging_manager, ssot_config, ssot_constants and the SLM/backend entry points use it). Remaining /var/log/autobot literals in Python are systemd-output or provisioning logs (slm-backend/api/monitoring.py:820, provision_progress.py:37, playbook_executor.py:129, process_adapter_service.py:45), not application-handler paths; they read the unit-output directory, which this PR leaves unchanged.
Open review threads: 8 of 18 unresolved (all bot threads, none replied to, none addressed at head)
error_catalog.py:694 (lock) - not addressed. Reply: valid; the lock is added in the fix commit, or deferred to a filed issue if the owner decides it is out of scope.
roles/backend/defaults/main.yml:191 (create overridden app dir) - not addressed. Reply: default path is created by the common role; overrides will be created by a new backend task.
roles/backend/templates/backend.env.j2:68 (undefined in deploy-backend-env.yml) - not addressed; correct (Finding 1). Reply: fixed by declaring the variable in vars/backend-env.yml.
roles/npu-worker/tasks/main.yml:106 (code_only) - not addressed. Reply: add the directory task to npu/tts code_only.yml.
roles/slm_manager/tasks/main.yml:117 (self-update path) - not addressed. Reply: move the directory task to service_units.yml.
entry_points_start_file_logging_20894_test.py:409 (CONSOLE_ONLY) - not addressed. Reply: extend the stale check, add control.
no_in_repo_log_path_20894_test.py:148 (filename keyword) - not addressed. Reply: inspect the keyword, add controls.
service_units_set_logs_dir_20894_test.py:94 (blank value) - not addressed. Reply: validate the assignment value, add blank/non-blank controls.
Hygiene
Body headings present (## Thinking Path, ## What Changed, ## Verification, ## Model Used); Refs #20894 (no closing keyword, consistent with the undelivered ACs); no hosts, IPs or home paths in the body.
The two new commits carry no trailers.
mergeable: MERGEABLE, state BLOCKED (review required / unresolved threads).
Verified / not verified
Verified by reading origin/issue-20894-log-dir: units, role defaults, env templates, the guard source, the two fix diffs, the logging_manager.py hunks against #21251 (old-style three-way git merge-tree: one conflict block in the import region), logrotate templates, grep of old-path consumers. Not verified: any test, lint, ansible run or host state; whether deploy-backend-env.yml already fails on other role-only variables; CI results beyond mergeable.
Delta reviewed: d53247b..b0c4f00 (one non-merge commit, b0c4f00). All eight earlier findings are addressed in code. No blocking defect found in the Ansible mechanics; everything below was read, not executed.
The "required unless every read is guarded" rule over-reports: a read inside the body of {% if x | default('') | length > 0 %} counts as unguarded, and x.stat.exists | default(false) counts x as unguarded (the Name's parent is a Getattr). So autobot_admin_password (backend.env.j2:150-151), backend_postgres_password (:144-145) and tls_ca_cert (:89) are in the baseline but render fine when undefined. Five of the eight are real (backend_chromadb_auth_token :133, backend_prometheus_scrape_token :58, backend_frontend_tls_enabled :107, frontend_tls_port :108, frontend_http_port :109 are read bare). The PR body and #21496 say "eight undefined". The opposite error also exists: one x is defined anywhere makes every other read of x optional.
Say "up to eight" in #21496/body, or treat reads under an enclosing if that guards the same name as guarded; note the is defined under-report in the docstring.
LOW
autobot-backend/utils/error_catalog.py:519 and :568
Both load paths set _initialized = True before source. The unlocked fast path in ensure_loaded can therefore return while source still reads SOURCE_UNLOADED, and source readers call ensure_loaded then read it. The lock itself is correct (RLock, re-check inside, no path takes it while holding another lock; load_catalog does not take it).
Assign source before _initialized in _load_builtin_fallback and the YAML branch.
LOW
repo_tests/..._20894_test.py _src_path
A template: task whose template file is not found is skipped silently. Today that is roles/backend_services/tasks/main.yml:127 (renders a backend.env.j2 its role does not ship; referenced by playbooks/deploy-full.yml; pre-existing and dangling, see the comment in site.yml:54). It would also be unprotected by the new directory task.
Out of scope here; the 12 measured renderings are 13 template tasks minus this one.
LOW
roles/npu-worker/tasks/code_only.yml:23
Neighbouring tasks in this file are untagged; the new include carries npu, deploy, so --skip-tags deploy skips the directory task while the unit and env still deploy. Same file for tts matches its neighbours (tts, deploy).
Drop the tags on the npu include, or tag the neighbours.
Floor 12 equals the population (12), growth 6: window [6, 12], recommended mid-pin 9. The bottom-band rule only refuses the bottom, so 12 is legal, but one removed rendering turns the guard red.
Optional: pin 9.
INFO
npu/tts main.yml comments
"the other two/three dirs" comments next to the shared-log-dir note are now off by one after the loop entry moved.
Reword.
Checks you asked for
a. Include mechanics (all correct against ansible-core 2.17 as I read it)
apply sits under the module args beside file:; vars:, tags: and when: are task keywords; nothing invalid on any include; become: true is on the inner task.
Paths: roles use ../../../_shared/tasks/ensure_app_log_dir.yml, which from roles/<r>/tasks is ansible/_shared (precedent: roles/backend_services/tasks/main.yml:119 includes ../../../_shared/tasks/resolve_internal_api_key.yml). playbooks/deploy-backend-env.yml uses ../_shared/... (same form as its lines 52 and 61). Top-level apply-secrets.yml uses _shared/..., relative to ansible/.
backend, config, env (superset of neighbour backend, env)
playbooks/deploy-backend-env.yml
backend_app_log_dir
backend_user / backend_group
playbooks/vars/backend-env.yml:18 (new), :13-14
backend, config (play has no role)
npu-worker code_only.yml, main.yml
npu_app_log_dir
npu_user / npu_group
role defaults
npu, deploy / npu, dirs
tts-worker code_only.yml, main.yml
tts_app_log_dir
tts_user / tts_group
role defaults
tts, deploy / tts, dirs = neighbours
ai-stack env_files.yml
ai_app_log_dir
ai_user / ai_group
role defaults
ai, config = neighbours
slm_manager service_units.yml
slm_app_log_dir
slm_user / slm_group
role defaults
slm, backend, systemd, directories (superset)
apply-secrets.yml
tts_app_log_dir
tts_user / tts_group
vars_files roles/tts-worker/defaults/main.yml
when: same role guard as the render
b. Loop removal and ordering
Each include sits before the first task that needs the directory (unit deploy / start). ai-stack, npu, tts and slm place it after their install directory is made, and the file module does not create parents.
Owner/group/mode are unchanged for the removed loop entries (ai, npu, tts, slm: 0755 with the role's user and group).
For <base>/logs, the common and backend_services roles create it as autobot:autobot 0755. The backend include sets backend_user:backend_group 0755, and both default to autobot, so the shared writers (celery, mcp-bridge, agent) see no change. Only a non-default backend_user would flap ownership; that was already possible via agent_config's own loop.
c. Completeness test
It collects: imports resolve (jinja2, yaml, repo_tests._reach), and the two reach policy files list the new declaration.
Jinja parse needs no filter table. The five templates contain no macros, loop, namespace or with, so the for/set scoping shortcut is sound for them.
Measured entries by reading: 13 template tasks (apply-secrets 1, deploy-backend-env 1, ai-stack env_files 2, backend main 2, env_only 1, npu 2, tts 2, slm 1, backend_services 1) minus the unresolvable backend_services one = 12.
_KNOWN_GAPS: a listed name that becomes defined fails as stale; five of eight are real pre-existing, three are over-reports (see the first finding).
Window: pop 12, skips 0, growth 6 gives [6, 12], so floor 12 is legal and not in the bottom band.
d. error_catalog.py
Double-checked RLock is correct. list(dict.fromkeys(candidates)) keeps first-occurrence order, identical to the replaced loop (Path is hashable).
The thread test is deterministic enough: a 4-thread barrier plus a 50 ms load; without the lock it would load 4 times.
Verified by reading origin/issue-20894-log-dir: the full delta, shared task, all nine include sites and their neighbours' tags, variable definitions in role defaults and vars files, templates, the new test and _reach window arithmetic.
Not verified: no ansible run, no --tags run of the updater, no test or CI result, whether reach_declarations_test and the python filter pass on this head.
The full-provision include is not tagged like the env template it accompanies (npu, config / tts, config): npu include is untagged, tts include is tts, dirs. A --tags config run rewrites the env pointing at the directory without creating it. Not a regression: the removed loop entry carried the same tags (untagged / dirs), and every updater entry goes through code_only, where the include matches the neighbours.
The five remaining names have no definition in the playbook, its vars file or inventory group_vars. The updater may still supply some as extra-vars at run time; that is not visible to a static check.
None here.
Checks
error_catalog.py: source is now assigned before _initialized in the fallback (line 515) and the YAML branch (line 564). File stays 773 lines. The earlier finding is closed.
Per-read rule against backend.env.j2 (head):
Dropped, truly guarded at every read: autobot_admin_password lines 150-151 (read in the body of an if whose test is x | default('')); backend_postgres_password lines 144-145 (same shape); tls_ca_cert line 89 is its only read (tls_ca_cert.stat.exists | default(false), the Getattr chain is climbed to the filter).
Remaining five are bare reads: backend_prometheus_scrape_token :58, backend_frontend_tls_enabled :107, frontend_tls_port :108, frontend_http_port :109, backend_chromadb_auth_token :133.
The rule: a read is excused only by a default/is defined on that read, or by sitting in the body of an if/elif whose test establishes the name (else branch does not count). I walked the 12 parametrised controls by hand and each expected set matches the rule, including the guarded-read-plus-bare-read and else-branch cases. elif bodies are handled (the elif is itself an If node). Names stored by set/for are excluded globally, acceptable for these templates, which have no macros.
The new unresolvable() / _UNRESOLVABLE freeze names exactly roles/backend_services/tasks/main.yml -> backend.env.j2; a new or a now-resolved entry fails.
Tags, per site (protected task's tags = include's tags, task and apply):
Site
Protected task tags
Include now
Match
backend env_only.yml
backend, env
backend, env
yes (was a superset)
backend main.yml
backend, config
backend, config
yes
deploy-backend-env.yml
untagged
untagged
yes
npu / tts code_only.yml
untagged / tts, deploy
untagged / tts, deploy
yes
ai-stack env_files.yml
ai, config
ai, config
yes
slm service_units.yml
slm, backend, systemd
slm, backend, systemd
yes
npu / tts main.yml
npu, config / tts, config (env)
untagged / tts, dirs
see LOW
Updater entries: slm_manager service_units.yml is entered with tags: [slm, systemd] on the include_role, and the include now carries both. The tts, npu and ai-stack code_only entries use tags: [... deploy], and the include matches the neighbouring tasks in each file. Backend env_only runs from the include_role at update-all-nodes.yml:1317.
SLM side effect: --tags directories on slm_manager no longer creates slm_app_log_dir (it left the :119 loop). I found no playbook, script or API in the tree that passes directories as a tag selection; playbook_executor.py:454 only forwards caller-supplied tags. Nothing relies on it.
Reach: population 12, skips 0, growth 6, floor 9. slack = 3; legal window [6, 12], mid 9. _reach.py:341-346: slack <= allowance leads to _bottom_band, which refuses only when slack > 6 - ceil(0.6) = 5, so 3 passes; no stale warning.
Verified by reading the diff and the files at head. Not verified: any ansible, --tags or test run; CI; whether the test file passes reach_declarations_test beyond the window arithmetic above.
Conflicts: autobot_shared/logging_manager.py (import block: keep both
log_dir and logging_once imports), logging_manager_config_types_19288_test.py
(reset_log_once() plus this branch's _file_logging_enabled/_managed lines).
Semantic adjustments for the removal of logging_manager._warned_config_keys
(#21251), delivering the ordering dependency tracked in #21495 (#20894):
- logging_manager_startup_20894_test.py and log_dir_20894_test.py reset
once-only warnings through reset_log_once().
- log_dir._configured() uses logging_once.log_once instead of a hand-rolled
_warned_alias flag, which the one-helper guard (#21071) forbids.
Delta: merge 22ea706 (parents aa69be1 and main 7c15278). Read-only review of the combined diff; nothing executed.
Findings
Severity
File:line
Finding
Suggested fix (non-blocking)
INFO
autobot_shared/log_dir.py:4
The module docstring still says "Stdlib-only on purpose". It already imported autobot_shared.paths; it now also imports autobot_shared.logging_once. Both are inside autobot_shared and neither imports config, which is the property the sentence protects.
Reword to "imports nothing from config".
Checks
logging_manager.py is coherent. Against aa69be1 the only changes are refactor(logging): one shared log-once helper, guard against hand-rolled copies (#21071) #21251's: first_time import (kept beside this PR's log_dir import, both present at lines 20-21), the _warned_config_keys set removed, and _warn_config_fallback / _warn_file_logging_off now ask first_time(__name__, key) (same keys, same stderr text). Against main the PR's startup logic (setup_logging, _file_logging_enabled, _managed, FirstWriteFileHandler, resolve_logs_dir) is intact. git grep for _warned_config_keys and _warned_alias finds nothing.
log_dir.py importing logging_once:
No cycle. logging_once imports only env_utils; env_utils imports stdlib at the top. Its one env_registry import is inside env_registered(), which logging_once does not call (it uses env_int_clamped). So env_registry to env_registry_logging to log_dir to logging_once to env_utils never loops back.
No hermeticity guard names log_dir.py's imports; import_hermeticity_test.py:66 only imports its constants.
Call matches the helper: log_once(logger, level, key, msg, *args), with the helper adding stacklevel=2 itself. Same level (WARNING), same message and args, once per process via key AUTOBOT_LOG_DIR under the logger name. The only behavioural difference is the helper's bounded seen-set (1024 keys), irrelevant for one key.
Early startup: it is a plain logger.log on a stdlib logger, the same call as before; with no handlers configured the stdlib last-resort handler prints the warning to stderr exactly as the old .warning did.
Tests: all five files reset through reset_log_once() (no scope, so all keys) inside autouse fixtures (log_dir_20894_test.py:25, startup_20894_test.py:27, config_types_19288_test.py:39, readonly_logs_19628_test.py:36, shared_handler_20139_test.py:50). The alias test counts one warning across two resolves, and the fixture clearing the state means a leaked once-state cannot make it pass or fail vacuously. The config_types fixture keeps this PR's _file_logging_enabled / _managed lines.
refactor(logging): one shared log-once helper in autobot_shared.logging_manager, replace the private _warn_once copies #21071 sweep: tracked non-test .py outside the helper is 4111 on main and 4112 on this head (this PR adds only autobot_shared/log_dir.py). Floor 3951, growth 300: window [3812, 4112], slack 161, which is mid-window and outside the bottom band (refused above 270). Verdict files: _reach_policy_verdicts.py 387, _reach_policy_verdicts_n_to_z.py 353, _reach_policy_verdicts_mid.py 268, _reach_unscoped.py 146, all under 600; no row key appears twice across them, and this PR's ansible-log-dir-templates-complete-20894 row exists once.
Nothing else: the 97 files that differ from main on this head are exactly the 97 the PR already differed by before the merge; no non-merge commit after aa69be1; no trailers. Mergeable: MERGEABLE.
Verified / not verified
Verified by reading the combined diff, helper source, import chain, test fixtures and counting tracked files with a git listing. Not verified: any test, lint or CI run; the exact population figure the sweep itself measures (my filter mirrors its _SKIP regex, so within a file or two).
Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.
Delta 22ea706..858c6b3: one commit, 12 files, no trailers. Read-only review; nothing executed. CI shows no failed check at this head (5 green, 4 still pending when I looked); the 3 review threads still unresolved are the ones this commit answers.
With the config tag the include can now run in a --tags config run that skips the users tasks; on a host where the service user/group does not exist yet, owner:/group: of the shared task would fail. The neighbouring env template already needs the group (tts_group) in that run, so this is no new class of failure.
None.
INFO
autobot_shared/log_dir.py:49-51
<sep>tmp is only reached when TMPDIR/TEMP/TMP are all unset or relative and tempfile.tempdir is still None. On Windows that would give \tmp, but TEMP/TMP are always set there, and the Windows NPU worker does not use this module (its own log_dir in resources/windows-npu-worker/app/worker_settings.py:191 is path-relative).
None.
Product-side checks
log_dir._temp_base(): only the branch where Path.home() raises (no resolvable home) changed. With HOME set, _state_home() returns ~/.local/state exactly as before. Without HOME it is <TMPDIR|TEMP|TMP if absolute, else tempfile.tempdir, else /tmp>/autobot-state-<uid>, so on a Linux service host with none of those set it is /tmp/autobot-state-<uid>/autobot/logs, the same as gettempdir() would have chosen, but without creating, writing and deleting a probe file at import. The new test sets TMPDIR, makes Path.home raise and gettempdir assert, checks <tmp>/autobot-state-<uid>/autobot/logs (three .parents are right), and a relative TMPDIR as a near miss (the result stays absolute).
deploy-backend-env.yml: the set_fact is the first pre_task (line 22), before the secret reads, the ensure-directory include (line 74) and the env template (line 82). Value {{ autobot.base_dir }}/logs is identical to the role default and to the removed vars-file line, so the default case renders the same AUTOBOT_LOGS_DIR. when: backend_app_log_dir is not defined means an inventory or extra-var override is never replaced (a set_fact is only issued when undefined, so it cannot shadow one). It is a single play, so nothing later inherits a stale fact. The update path still gets the variable from the role defaults via include_role (update-all-nodes.yml:1317). The playbook has no tags: anywhere, so the set_fact cannot be skipped separately from its users.
Tags: npu main.yml include is now npu, config (matches the env template at :60 tagged npu, config); tts include is tts, config, dirs (env template tts, config plus the old dirs). The variables (npu_app_log_dir, npu_user, npu_group, tts_*) come from the role defaults, which are in scope whenever the role's tasks run, whatever the tag selection; file creates missing parents. So no tag selection reaches the include with a variable undefined.
Test-side checks
repo_tests/_template_required_names.py has a leading underscore and no test_ functions, so it is not collected; the new template_required_names_rule_20894_test.py has the *_test.py shape and a 25-row parametrize with contrast pairs. I walked the polarity and scope rows by hand (is not defined body vs else, and/or, != '', truthy fallback, order of set, for scope and tuple targets) and each expected set follows the code.
glob_declared_reads_15900_test._is_path_like: the new string constants are "*" (rglob; no slash, not a suffix glob) and "*/templates/*" (first segment * is not a directory), both rejected; the f"*{suffix}" calls are not constants. No new root-relative glob constant, so no new record entry.
Reach: the declaration is unchanged (floor 9, growth 6, population 12, window [6, 12]); recursive discovery adds no nested renderer in the real tree as far as I can tell by reading, not by running. Floors elsewhere: no new hand-rolled floor of 100 or more. Sizes: ansible completeness test 492 lines, entry-point guard 549, service-unit guard 378, no-in-repo guard 199, helper 153, rule test 44, all at or under 600.
Other guard changes read and sound: unaliased dotted import recognised (_dotted, with near misses), default= keyword inspected, Compose environment: parsed with yaml.safe_load in both list and mapping form (a literal in service B is not hidden by an overridable one in service A).
Verified / not verified
Verified by reading the diff and the files at head. Not verified: any test, lint, ansible or CI run beyond the check state above; the real-tree result of the tightened _caller_names chain rule (it moves what counts as defined for each entry, so a real-tree change in the five-name baseline is possible and only CI shows it).
Delta 858c6b3..d5d7b4e: one commit, one file (repo_tests/entry_points_start_file_logging_20894_test.py, 5 lines swapped at 545-549). No trailers. Read-only; nothing executed.
Findings
None.
Checks
Only change: the five ast.parse(...) calls in test_control_an_unaliased_dotted_import_counts_and_a_near_miss_does_not became parse_cache.parse(...); the planted snippets are byte-for-byte the same. No ast.parse remains in the file (grep shows only parse_cache.parse at 171, 516, 545-549); import ast stays and is still used (ast.walk, ast.FunctionDef).
parse_cache is tools.lint._parse_cache (import at line 45). parse(source, filename="<unknown>", mode="exec", type_comments=False) takes source text, so the f-string snippets fit.
Cache correctness: it is functools.lru_cache keyed on the exact (source, filename, mode, type_comments), so two different snippets can never share an entry and a snippet can never be served another's tree; identical text returns the shared tree. The returned tree is shared and read-only by contract, and calls_setup_logging only walks it, so there is no mutation.
No alias dodge: the guard (parse_cache_test::test_no_new_direct_parse) detects ast.parse under any alias, and this change removes the calls rather than aliasing them.
Verified / not verified
Verified by reading the commit, the cache module and the call sites. Not verified: running parse_cache_test or CI.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Thinking Path
Test runs wrote
logs/backend.loginto whatever checkout they ran from because the log directory defaulted to a cwd-relativelogs/. The fix is one shared resolver that every log writer uses, plus a guard that stops new in-repo log paths from appearing. Sites that cannot be migrated in this PR are frozen in a baseline and tracked in #20934, so the guard blocks growth now and the remainder is migrated there.What Changed
autobot_shared/log_dir.py: newresolve_logs_dir(). UsesAUTOBOT_LOGS_DIRwhen set, otherwise a per-run temp directory. It never returns a path inside the source tree.autobot_shared/logging_manager.py,autobot_shared/env_registry_logging.py,autobot_shared/ssot_config.py,autobot_shared/ssot_constants.py,autobot-backend/api/logs.py,autobot-backend/api/analytics_log_patterns.py: cwd-relative log defaults now use the resolver.conftest.py,repo_tests/_mocked_config_import.py: test runs resolve the log directory outside the source tree.autobot_shared/log_dir_20894_test.py: unit tests for the resolver.docs/developer/ENV_VARS.md: documents the default.repo_tests/no_in_repo_log_path_20894_test.py: guard against in-repo log paths, with a baseline of 11 existing sites that are tracked in fix(logging): move the remaining in-tree log-path sites onto the one resolver #20934.plugins/core-plugins/logger-plugin/main.py:17,autobot-slm-backend/monitoring/performance_monitor.py,autobot_shared/ssot_config.py:80: now useresolve_logs_dir()/ssot_config.path.logs_path(two baseline sites migrated; plugin honoursAUTOBOT_LOGS_DIR).backend.env(autobot-backend.service.j2:62), notdistributed.env(distributed.env.j2:35, coordinator only), so it had noAUTOBOT_LOGS_DIR; now set atroles/backend/templates/backend.env.j2:68(backend_app_log_dir,defaults/main.yml:191).changelog/unreleased/20894-log-dir-resolver.md: changelog entry.AUTOBOT_LOGS_DIR) and each unit's own stdout/stderr (StandardOutput=append:) deliberately use different directories: the file names overlap, and one file written by both systemd and the application's rotating handler would carry duplicate records and be orphaned on rotation. Each role declares the two as separate variables (backend_log_dir/backend_app_log_dirand the matching pairs); a guard inservice_units_set_logs_dir_20894_test.pyfails when they resolve to the same directory.<base>/logs/audit.log.<base>/autobot-backend/logs(the old working-directory-relative default) to<base>/logs, which the existing log rotation already covers. The SLM backend, NPU worker, TTS worker and AI stack keep writing where they did. The unit's own stdout/stderr files stay in/var/log/autobot.Verification
repo_tests/no_in_repo_log_path_20894_test.pyruns in CI and in the pre-push fast gate.Refs: the 11 baseline sites remain to be migrated (fix(logging): move the remaining in-tree log-path sites onto the one resolver #20934), and thelogs/and*.logpatterns for the chore(guards): fail any commit that tracks a cache file #20892 tracked-file guard still need their comment on chore(guards): fail any commit that tracks a cache file #20892.Refs #20894
Model Used
Claude Sonnet 5.5
Single-issue rationale: the resolver, its guard and the baseline form one change to the log-path rule and share no files with another open issue.
Service units (review follow-up)
Every Python service unit now sets
AUTOBOT_LOGS_DIR; guardrepo_tests/service_units_set_logs_dir_20894_test.py(15 units found, plus a planted-template control):roles/backend/templates/backend.env.j2:68(backend_app_log_dir)roles/slm_manager/templates/autobot-slm-backend.service.j2(slm_app_log_dir)npu-worker.env.j2(npu_app_log_dir); tts-worker:tts-worker.env.j2(tts_app_log_dir); ai-stack:ai-stack.env.j2(ai_app_log_dir)autobot-infrastructure/*/templates/(ai-stack, user-backend, npu-worker, slm-backend):<WorkingDirectory>/logs_under_pytest()(module-levelLOGS_DIRis read at collection, beforePYTEST_CURRENT_TESTexists). Done: the per-process temp log directory is removed at exit.File logging starts at service startup (maintainer decision 2026-11-09)
The import-hermeticity sweep failed because 268 swept modules log at import (49 sites, #21264) and the log file now lives outside the tree. Decision: file handlers attach only when a service calls the logging setup at startup; before that, records go to the console (stdout/stderr, captured by systemd/docker on every route). Importing a module writes no file. #21264 stays as cleanup and no longer blocks this PR.
Design (
autobot_shared/logging_manager.py, the one logging module):get_loggergives a logger console handlers only until startup, and records it inLoggingManager._managed.setup_logging()is the ONE startup call. It is idempotent, attaches the shared file handler (bug(logging): each logger gets its own RotatingFileHandler on one file, so one rotation cascades and backups age out early #20139) to every logger made so far, and to every logger made afterwards. Pre-startup records are not replayed; they are already on the console.Entry points wired (all call
autobot_shared.logging_manager.setup_logging):main:app, both unit templates)autobot-backend/main.py:42main:app, both unit templates)autobot-slm-backend/main.py:120celeryd_init+beat_init; pool children inherit)autobot-backend/celery_app.py:375autobot-mcp-bridge@)autobot-backend/services/mcp_bridge_workers/worker_entrypoint.py:225autobot-backend/api/codebase_analytics/indexing_worker.py:98acp/__main__.py:38,pki/cli.py:184,eval/run.py:218,chat_history/session_reply_backfill.py:215,chat_history/session_scope_backfill.py:274,services/workflow_redis_backfill.py:210,services/pricing_refresh.py:310,services/autoresearch/run_experiment.py:90,database/migrations/001_create_conversation_files.py:536,autobot_shared/error_boundaries/__main__.py:55,tools/index_documentation.py:215,scripts/{migrate_ceo_chat_to_sessions,migrate_connector_credentials,repair_kb_vector_index}.py, 7 scripts underautobot-infrastructure/shared/scripts/(analysis/main.py:40already called it)Not wired, each with a reason in the guard:
ai_api_server.py, NPUnpu_inference_server.py, NPU and TTS worker templates (npu-worker.py.j2,tts-worker.py.j2), SLM agentslm/agent/agent.py.pipeline-scripts/pr_conflict_gate.py(CI job; the job log is its output).autobot-ai-stack.service(main:app),autobot-agent.service.j2(autobot_agent.main),autobot-coordinator.service.j2(autobot_user_backend.main), filed as bug(deploy): three Python unit templates start a module that is not in the repo #21271.repo_tests/entry_points_start_file_logging_20894_baseline.py: 75 library modules with a demo__main__block, plusenhance_workflow_ui.py, which is over the 600-line ceiling. Not wired here because of the 100-file cap and the size pins. Follow-up: chore(logging): wire setup_logging() into the 76 __main__ blocks frozen by #20894 #21272. The list only shrinks.Audit log: no audit record depends on file logging. Audit records go through
services.audit.audit(the canonical trail).MiscConfig.audit_log_fileis a path setting that no logging-manager handler writes. Theauditlog channel (get_audit_channel_logger) has no non-test caller. So no audit record emitted at import is lost to the console.Guards and tests:
repo_tests/entry_points_start_file_logging_20894_test.pyfinds entry points mechanically: every Python unit template mapped to its source (a new unit fails until it is mapped), module-levelFastAPI/Starlette/create_app/Celeryapps, and__main__modules that import the logging manager. Each must call the function imported from the logging manager; a local function with the same name does not count. Otherwise it must be exempt with a reason. A control plants each kind of entry point without the call.repo_tests/import_hermeticity_file_logging_20894_test.py: a module that logs at import passes the sweep's own probe. The control, the same module withsetup_logging()at import, fails it withHERMETIC_VIOLATION.autobot_shared/logging_manager_startup_20894_test.py: before startup, no file; after startup, an existing logger writes to the file; later loggers get it too; startup is idempotent (one handler).log_dir_20894_testsubprocess writer.Local verification on 133e30c:
nvidia-smithroughgpu_telemetry.py:198(this host has it on PATH; the CI runner has none, soshutil.whichgates the spawn). Two (api.multimodal,api.vision) write through the import-time probe infilelock/_strict.py, reached viatransformers. The last green full sweep on main (2026-11-06) passed these two, so whether CI hits that probe is unverified.changes_job_equivalence: 561 passed; its 3 failures were the new test colliding with the backend conftest'sget_loggerstub, fixed since.Sweep
Command:
git grep -nE "logs?/|\.log\b" -- '*.py' '*.sh' '*.yml'on this PR head (92ebb06): 986 hits on origin/main before the PR, 677 hits outside tests after (tests, repo_tests, conftest excluded). Most are docs, comments, test fixtures or read paths. In-repo log-path WRITERS among them (non-test; write call plus a literal logs/ or .log path), each listed:Status: the cwd-relative
logs/writers in the 10 files frozen inrepo_tests/no_in_repo_log_path_20894_baseline.py(ratchet, only goes down) are listed, not fixed here. Writers on absolute paths (/var/log/autobot/...,/app/logs/...) are outside the source tree.startup_coordinator.pyandboundary_manager.pyused a cwd-relativelogs/; both are now migrated toautobot_shared/log_dir.py(resolve_logs_dir+FirstWriteFileHandler) in 40c57ee.Sync with main (843 commits)
Merged
origin/maininto the branch (merge commit, no rebase). One textual conflict:repo_tests/changes_job_equivalence_15360_test.py, where main replaced the per-PR allowed-additions table with in-place, cited filter entries (#21205). Took main's file; this PR's four template-directory entries already sit in.github/filters/python-paths.ymlwith their# #20894citation.Staleness re-derived on the merged tree:
no_in_repo_log_path_20894_baseline.py; main added no new writer.setup_logging(); no Python unit template or compose service was added or removed on main since the branch point.no-in-repo-log-path-20894reach floor 4005 against a live population of about 4122 (allowance 400): inside the window, not in the bottom band.scripts/python_file_size_known_large.py:error_catalog.pypin lowered 775 to 774 (this PR removes the import-time load).resolve_logs_dirandFirstWriteFileHandler; neither exists on main.repo_tests/no_tracked_cache_or_log_files_20892_test.py) now enumerates throughtracked_paths(main's directgit ls-filesratchet) and declares amin_fraction=0.9reach over the whole tree; its control fixture useslogs/example.log, a path that never exists, so the python-filter guard does not read a real locallogs/backend.log.Summary by CodeRabbit