Skip to content

The workers child's tracker loop and boot reads, and the drops timer flush, carry query tags - #207

Merged
zlareb1 merged 9 commits into
mainfrom
fix/worker-child-query-tags
Nov 3, 2026
Merged

zlareb1 merged 9 commits into
mainfrom
fix/worker-child-query-tags

Conversation

@zlareb1

@zlareb1 zlareb1 commented Nov 3, 2026 •

Copy link
Copy Markdown
Member

Changelog category (leave one):

  • Improvement

Changelog entry (one or two sentences a user of Loom can read without the diff; the release pull request collects these into the release notes):

The workers process's tracker-registry refresh and startup reads, and every process's timed flush of the memory drop log, now carry their own query tags in system.query_log.

Why

These loops run in tasks that no request or worker pass reaches, and none of them set a tag. Their statements therefore reached ClickHouse as untagged:<module>.<function>, which the clickhouse-sql rule asks a background loop to avoid:

  • the workers child's tracker-registry refresh, every tracker_sources_refresh_seconds;
  • the child's startup reads;
  • the drop log's timer flush.

The web process's copy of the tracker loop already sets tracker.sources_refresh (server/boot.py).

Measured on a local server with workers in a child process (LOOM_BACKGROUND_WORKERS=auto, LOOM_DEPLOYMENT=true), over a few minutes of system.query_log. Before this change, the repeating statements came in as untagged:tracker.app.registry_sources._read_rows and untagged:memory.app.drops.flush_drops. After it, they carry tracker.sources_refresh (5 statements), drops.flush (5) and boot.workers_child (3), and neither untagged name appears.

The remaining untagged: statements are one-shot: the web process's boot reads (the schema status, the vector probes) and the shutdown drains of both processes. The fallback names their caller, so they stay as they are.

Scope and risk

  • Touches: server/worker_main.py and the drops timer in server/memory/app/drops.py.
  • Context: the tasks the child starts while booting inherit boot.workers_child. Each of them (provider refresh, repository refresh, runtime overrides, tracker refresh, the calibration refresh) sets its own tag first.
  • Unchanged: statements themselves.
  • Risk: none beyond attribution.

Compatibility, rollout and rollback

  • Wire: none.
  • Operator steps: none. Dashboards grouping log_comment see three new tag names in place of the untagged: ones.
  • Rollback: revert.

Tests

  • New tests in tests/unit/test_workers_child.py (a shared fixture with the child's existing boot test) and tests/unit/test_memory_drops.py record the tag each ClickHouse-bound call sees:

    • the drop log's timer flush runs under drops.flush;
    • the child's boot refresh runs under boot.workers_child, and the loop's next refresh under tracker.sources_refresh;
    • the caller's tag is unchanged afterwards.

    Both tests fail on main.

  • The system.query_log comparison above.

  • make format lint typecheck test-unit pass.

AI assistance in the code (leave one; writing this description with AI is fine):

  • AI-generated (an agent wrote most of the diff): Claude Code. The untagged statements were measured before and after on a local server.

  • I can explain every line of this diff and how it interacts with the rest of Loom.

Checklist

  • make format-check, make lint, make typecheck and make test-unit pass; the integration suite passes if server behaviour changed.
  • Generated files are regenerated in this PR, not by hand (none change).
  • A new migration is additive and numbered after the latest on main; no merged migration is edited (none).
  • A behaviour change to any file a plugin ships bumps both plugin manifests' version (none).
  • The frontend builds and its tests pass, if frontend/ changed (unchanged).
  • Docs under docs/ describe the system as it now is, and this description names any operator steps and wire changes.
  • Repository text has no dates, people, host names, internal namespaces, ticket or decision numbers.
  • Commits are signed off (git commit -s).

🤖 Generated with Claude Code

@zlareb1
zlareb1 force-pushed the fix/worker-child-query-tags branch 2 times, most recently from 0873070 to d3ecc4c Compare November 3, 2026 12:39
zlareb1 and others added 9 commits November 3, 2026 12:59
…flush, carry query tags

These run in tasks no request or worker pass reaches, so their statements reached ClickHouse as untagged:<module>.<function>. The web process's copy of the tracker loop already sets tracker.sources_refresh.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: zlareb1 <[email protected]>
…ild's and the drops' tests

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: zlareb1 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: zlareb1 <[email protected]>
@zlareb1
zlareb1 force-pushed the fix/worker-child-query-tags branch from acb2d82 to fe26578 Compare November 3, 2026 13:01
@zlareb1
zlareb1 merged commit 9a77384 into main Nov 3, 2026
21 of 22 checks passed
@zlareb1
zlareb1 deleted the fix/worker-child-query-tags branch November 3, 2026 13:07
@pufit pufit mentioned this pull request Nov 4, 2026
9 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant