refactor: centralize audience filtering before providers receive messages#6728
refactor: centralize audience filtering before providers receive messages#6728DOsinga merged 1 commit intoblock:mainfrom
Conversation
9c31467 to
c33dc9c
Compare
|
so https://github.com/block/goose/pull/6646/files#diff-0ceb972208a9cbe6f665656b11f613ea51588bedeeace7bfeae766302d8ea332 introduces filter_for_audience, can we use that here? |
That's a good idea. Moving filtering earlier in the pipeline to the agent level using agent_visible_content() would be cleaner and easier to maintain, but it involves cloning entire Message structures upfront rather than filtering during extraction. Happy to refactor if the tradeoff is acceptable. |
|
yeah, but you could just call that on the filter_map(|c| { ? that should be a content object that has the filter, no? |
Isn't |
Instead of inline filtering at the Content level in each format handler, filter at the Message level using the existing filter_for_audience() method via agent_visible_content(). This: - Eliminates code duplication across format handlers - Uses the centralized filtering logic from filter_for_audience - Makes the code more maintainable and consistent The filtering now happens once before format_messages/conversion functions rather than inline during content iteration. Addresses review feedback from DOsinga on PR #6728.
Instead of inline filtering at the Content level in each format handler, filter at the Message level using the existing filter_for_audience() method via agent_visible_content(). This: - Eliminates code duplication across format handlers - Uses the centralized filtering logic from filter_for_audience - Makes the code more maintainable and consistent The filtering now happens inside format_messages() and similar functions rather than requiring callers to filter before calling these functions. Addresses review feedback from DOsinga on PR #6728.
Move filtering to stream_response_from_provider() so providers receive pre-filtered messages. Signed-off-by: rabi <ramishra@redhat.com>
* 'main' of github.com:block/goose: (62 commits) Swap canonical model from openrouter to models.dev (#6625) Hook thinking status (#6815) Fetch new skills hourly (#6814) copilot instructions: Update "No prerelease docs" instruction (#6795) refactor: centralize audience filtering before providers receive messages (#6728) update doc to remind contributors to activate hermit and document minimal npm and node version (#6727) nit: don't spit out compaction when in term mode as it fills up the screen (#6799) fix: correct tool support detection in Tetrate provider model fetching (#6808) Session manager fixes (#6809) fix(desktop): handle quoted paths with spaces in extension commands (#6430) fix: we can default gooseignore without writing it out (#6802) fix broken link (#6810) docs: add Beads MCP extension tutorial (#6792) feat(goose): add support for AWS_BEARER_TOKEN_BEDROCK environment variable (#6739) [docs] Add OSS Skills Marketplace (#6752) feat: make skills available in codemode (#6763) Fix: Recipe Extensions Not Loading in Desktop (#6777) Different approach to determining final confidence level of prompt injection evaluation outcomes (#6729) fix: read_resource_tool deadlock causing test_compaction to hang (#6737) Upgrade error handling (#6747) ...
…sion-session * 'main' of github.com:block/goose: (78 commits) copilot instructions: Update "No prerelease docs" instruction (#6795) refactor: centralize audience filtering before providers receive messages (#6728) update doc to remind contributors to activate hermit and document minimal npm and node version (#6727) nit: don't spit out compaction when in term mode as it fills up the screen (#6799) fix: correct tool support detection in Tetrate provider model fetching (#6808) Session manager fixes (#6809) fix(desktop): handle quoted paths with spaces in extension commands (#6430) fix: we can default gooseignore without writing it out (#6802) fix broken link (#6810) docs: add Beads MCP extension tutorial (#6792) feat(goose): add support for AWS_BEARER_TOKEN_BEDROCK environment variable (#6739) [docs] Add OSS Skills Marketplace (#6752) feat: make skills available in codemode (#6763) Fix: Recipe Extensions Not Loading in Desktop (#6777) Different approach to determining final confidence level of prompt injection evaluation outcomes (#6729) fix: read_resource_tool deadlock causing test_compaction to hang (#6737) Upgrade error handling (#6747) Fix/filter audience 6703 local (#6773) chore: re-sync package-lock.json (#6783) upgrade electron to 39.3.0 (#6779) ...
* main: docs: usage data collection (#6822) feat: platform extension migrator + code mode rename (#6611) feat: CLI flag to skip loading profile extensions (#6780) Swap canonical model from openrouter to models.dev (#6625) Hook thinking status (#6815) Fetch new skills hourly (#6814) copilot instructions: Update "No prerelease docs" instruction (#6795) refactor: centralize audience filtering before providers receive messages (#6728) update doc to remind contributors to activate hermit and document minimal npm and node version (#6727) nit: don't spit out compaction when in term mode as it fills up the screen (#6799) fix: correct tool support detection in Tetrate provider model fetching (#6808) Session manager fixes (#6809) fix(desktop): handle quoted paths with spaces in extension commands (#6430) fix: we can default gooseignore without writing it out (#6802) fix broken link (#6810) docs: add Beads MCP extension tutorial (#6792) feat(goose): add support for AWS_BEARER_TOKEN_BEDROCK environment variable (#6739)
Summary
Move filtering to stream_response_from_provider() so providers receive pre-filtered messages.
Type of Change
Testing
Tested with anthropic provider.
Closes: #6703