feat(cli): context-intelligence opt-in dispatch filtering — path-rule to workspace-pattern injection#188
Closed
colombod wants to merge 0 commit into
Closed
feat(cli): context-intelligence opt-in dispatch filtering — path-rule to workspace-pattern injection#188colombod wants to merge 0 commit into
colombod wants to merge 0 commit into
Conversation
4f016c2 to
3fe5ddf
Compare
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
Adds host-side path-rule evaluation that translates disk path patterns to workspace name patterns, injected additively into the context-intelligence bundle's
allow_workspaces/deny_workspacesfilter config.This is one half of a two-PR feature. The companion PR in
amplifier-bundle-context-intelligenceimplements the bundle-side workspace filter inConfigResolverand the dispatch gate inLoggingHandler.What changed
AppSettings— two new methods (lib/settings.py)get_context_intelligence_config()— reads thecontext_intelligence:top-level section from merged settings.get_context_intelligence_hook_overrides(working_dir)— evaluatescontext_intelligence.path_rulesagainst the current working directory:~in path patterns before matching~/work/**→-home-<user>-work-*)forwarding_enabled: true→ appends workspace pattern toallow_workspacesforwarding_enabled: false→ appends workspace pattern todeny_workspaces[]whenworking_diris None, no rules are configured, or no rule matchesruntime/config.py— additive list merge + wiring_merge_hook_config— new helper replacing the flat{**base, **overlay}merge for hook configs.allow_workspacesanddeny_workspacesare unioned (base values preserved, overlay appended) rather than replaced. Applied generally across all hook overrides.One-line wiring — calls
get_context_intelligence_hook_overrides(os.getcwd())alongsideget_notification_hook_overrides()so path-rule-derived workspace patterns reach the session config.Pre-existing test fix
tests/test_session_spawner_subprocess.py::test_subprocess_param_routes_to_subprocess— updated assertion to match the current config shape ({"agents": {}, "session": {}}) which had drifted from the test expectation onmain. Acknowledged as pre-existing in the PR #186 commit message.Configuration
Compatibility
Bundle PR not yet merged: If this PR lands first, the injected workspace patterns are silently ignored by the current bundle (no
allow_workspacessupport). Old all-dispatch behaviour continues. Zero regression.This PR not yet merged: If the bundle PR lands first, the bundle's deny-all default activates. No events dispatch until
allow_workspacesis explicitly configured inoverrides.hook-context-intelligence.config. No crash — silent no-dispatch.Tests
tests/test_context_intelligence_hook_overrides.pycovering:_path_pattern_to_workspace_pattern, tilde expansion, all-match semantics, allow/deny injection, additive union,Noneworking_dir, non-matching rulesruff check/ruff format/pyright— all clean