Repository navigation
entity_communities: a namespace that fails no longer skips the rest of the pass - #2131
Merged
Merged
Conversation
…f the pass run_entity_communities walked the namespaces in a stable (org, namespace) order with no per-namespace handler, so an edge read, partition or write that raised for one namespace ended the pass and skipped every namespace after it, on every pass. Each namespace's work now runs in its own try: a failure is logged, noted on the pass with pass_context.note_failure, listed in EntityCommunitiesResult.failed (the pass outcome's `failed` count) and the pass goes on. PassStopped and a cancel are BaseExceptions and still end the pass. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…t write Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
…s-namespace-failure Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
…failed Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
Merged
8 of 10 tasks
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Changelog category (leave one):
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
entity_communitiesworker keeps going when one namespace's edge read, partition or write fails. The failure is noted on the pass, and every other namespace still gets its communities.Why
run_entity_communitiesloops over_namespaces_with_edges, which returns the consolidation opt-ins and then the walked namespaces, eachORDER BY org, namespace. The loop body (_edges,_partitionin a thread,ch.insert) had no handler. A namespace whose read, partition or write raised therefore ended the pass. Because the order is the same on every pass, the same namespaces after it were skipped on every pass, and the pass recorded one failure for the whole worker.o/a,o/bwhereo/a's edge read raises, or its insert raises. TheRuntimeErrorleavesrun_entity_communitiesando/bis never read or written.try. OnExceptionthe pass appendsorg/nsto the newEntityCommunitiesResult.failed, logs a warning with the traceback, callspass_context.note_failure(e, "org/ns")and moves on to the next namespace. It also drops what the pass had recorded for that namespace (truncated,hubs_dropped,hub_fraction_used,giant), so the result names a namespace that raised only infailed. This is howcode_graph_statsandknowledge_source_synctreat one repository or source.pass_context.PassStoppedandasyncio.CancelledErrorareBaseExceptions, so a stopped pass or a lost lease still ends the pass before any further write (tests/unit/test_pass_stop.pycovers this path).Scope and risk
server/memory/app/entity_communities.py: the per-namespacetry, thefailedfield, and the handler's removal of what the pass recorded for the failed namespace.server/memory/workers/entity_communities.py: the pass outcome and its log line gain afailedcount.tests/unit/degraded_unnoted.txt: the new handler is listed aslogged_only_nonanswer. It is a background pass with no response path, and the failure reaches the pass's ledger row throughnote_failure.failure_hold_seconds, since the interval is longer than the deadline). A pass with a noted failure goes throughnext_interval_secondsinstead. It waitsworker_partial_retry_s(default 3600 s), doubled for each such pass in a row and capped at the interval. While one namespace keeps failing, the whole pass reruns after 1 h, 2 h and 4 h, then settles at 6 h. This is the supervisor's existing rule for partial passes.docs/reference/workers.mdsays a partial pass keeps its normal interval; that is wrong today for every worker and is left for a separate change.Compatibility, rollout and rollback
failedkey, the count of namespaces that raised.Tests
test_a_failing_namespace_does_not_skip_the_rest_of_the_pass[read],[partition]and[write]intests/unit/test_entity_communities.py. In a pass overo/aando/b,o/a's edge read, its partition or its insert raises.o/ais the fused graph oftest_entity_communities_walked.pywith one weaker pair pastmax_edges_per_namespace, so a pass that writes it records its truncation, a dropped hub, an escalated fraction and a giant community; the test asserts that it does, as a precondition. It then asserts thato/b's rows are the only insert, thatfailed == ["o/a"], that the result withfailedcleared equals a clean pass overo/balone, and that the pass context noted oneRuntimeErrorlabelledo/a. Onmainevery parameter fails with theRuntimeErrorraised out ofrun_entity_communities. Leaving any one of the four removals out of the handler fails[partition]and[write];[read]raises before anything is recorded.test_the_worker_outcome_counts_failed_namespaces: the worker's pass outcome carriesfailed, the count of namespaces that raised..venv/bin/python -m pytest -q -p randomly tests/unit/test_entity_communities.py tests/unit/test_entity_communities_walked.py tests/unit/test_pass_stop.py tests/unit/test_package_contracts.py tests/unit/test_worker_registry_snapshot.py: 44 passed..venv/bin/python -m pytest -q tests/unit/test_degraded_unnoted.py: 2 passed, withmainmerged at43e6e58, which lists themcp_worker_enrollment_flow.py::_spend::1handler (test_degraded_unnoted lists the enrollment challenge spend, so main's unit job passes #2132).ruff format --checkandruff checkover the tree,scripts/gates/function_length_gate.pyandscripts/gates/check_no_secrets.pypass.mypyon the two changed server files reports no issues. The localscripts/gates/mypy_gate.pyreports onlyserver/clients/mcp_source.pyandserver/llm/vertex_auth.py, which fail because packages are missing from this environment. CI runs the full unit suite and the mypy gate.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. Checked: the stop signal and a cancel are
BaseExceptions and are not caught; the new test fails before the change and passes after it.I can explain every line of this diff and how it interacts with the rest of Loom.
Checklist
make test-unitand applicable integration results are reported by CI; a full local run is not required before pushing.main; no migration in this PR.frontend/changed: not changed.docs/describe the system as it now is: no doc describes the per-namespace failure behaviour.git commit -s), as CONTRIBUTING.md asks.🤖 Generated with Claude Code