Repository navigation
Conversation
… store in add_functions add_functions read existing names through list_functions, which applies the instance's filter_scope and id exclusions. A function hidden from discovery was then missing from dependency detection, so a new function calling it got an empty depends_on (no runtime injection, no cascade on delete), and a same-named add with overwrite=True tried an INSERT and failed on the UNIQUE name constraint, rolling back the whole batch. Use list_function_name_to_ids, the unscoped catalogue, for write-time checks.
djl11
force-pushed
the
fix/scoped-add-functions
branch
from
September 25, 2026 22:21
2db3399 to
febfb98
Compare
This branch has not been deployed
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.
Summary
FunctionManager.add_functionsread existing names throughlist_functions(). That call applies the instance'sfilter_scopeandexclude_compositional_ids, and the actor sets both at runtime. As a result, a stored function hidden from discovery was treated as if it did not exist during a write:depends_on == []._inject_dependenciesthen never injects the dependency when the function is executed later, anddelete_function(delete_dependents=True)no longer cascades to it.overwrite=Trueinserts instead of updating. Adding a function with the same name as a hidden one runs anINSERT, which fails onUNIQUE constraint failed: functions.name. Because the inserts share one transaction, every other new function in that batch is rolled back with it.The docstring of
tests/function_manager/core/test_filter_scope.pystates that "Write paths are unaffected" byfilter_scope.list_function_name_to_ids()is documented as the unscoped catalogue "so a reference resolves even when its function is hidden from discovery". This PR makesadd_functionsuse that catalogue for its name and dependency checks.Type of change
Areas touched
unify/common/_async_tool/)unify/db/)tests/,conftest.py,parallel_run.sh)Test plan
Two new regression tests in
tests/function_manager/core/test_filter_scope.py:test_scoped_add_records_dependency_on_hidden_functiontest_scoped_overwrite_updates_hidden_functionThe broader run gives the same result on
mainand on this branch, except for the new tests. The only failures are 8 tests intest_live_steering_eval.pyandtest_default_env_steering.py, which need a live model key that I don't have. They fail the same way onmain.blackandautoflakeare clean on the changed files.Behavior / migration notes
None.
Checklist
feat(scope):,fix(scope):,refactor(scope):,chore(scope):, etc.)try/exceptadded defensively — only around specific, recoverable errors.agents/rules/no-temporal-comments.md).agents/rules/no-test-info-in-production-code.md)AGENTS.md/ARCHITECTURE.mdif I changed architectural conventions (not applicable)An AI agent (Breken, using Claude) found this bug, wrote the fix and the tests, and submitted the PR from the
breken-aiaccount.🤖 Generated with Claude Code