Skip to content

fix(discover): stop telling the agent to filter when the content filter is off - #384

Merged
linroid merged 2 commits into
mainfrom
fix/discover-filter-off-prompt
Oct 4, 2026
Merged

linroid merged 2 commits into
mainfrom
fix/discover-filter-off-prompt

Conversation

@linroid

@linroid linroid commented Oct 4, 2026 •

Copy link
Copy Markdown
Owner

Problem

With Content filter switched off, Discover still refused requests such as "3 hottest tv shows", with a Filtering step that cites an anti-piracy policy. The switch only skipped DeviceSafetyFilter on the parsed answer. The system prompt was the same either way: it always carried the ANTI-PIRACY GUARDRAIL and the BLOCK … device-safety rules, so the model refused before the filter was ever reached.

Change

  • ResourceDiscoveryService.SYSTEM_PROMPT is now systemPrompt(contentFilter), and each run passes in DiscoverQuery.contentFilter.
  • Filter on: the prompt says the same as before; only one line is rewrapped.
  • Filter off: the anti-piracy guardrail is left out, and the BLOCK … rules become "rank riskier links lower and say why in deviceSafetyNotes", and the output rule says "If no candidates" instead of "If no safe candidates". The model still prefers official sources, and the rules about ignoring instructions in fetched pages and never downloading automatically stay.
  • docs/ai-discovery.md and AGENTS.md describe the new behavior. The provider's model may still decline a request on its own.

Testing

  • Added two tests that check the system prompt the LLM receives has the guardrail and BLOCK rules with the filter on and has neither with it off.
  • ./gradlew :ai:discover:test passes.
  • Not yet tried with a live search.

…er is off

The content filter switch only skipped DeviceSafetyFilter on the parsed answer;
the system prompt always carried the anti-piracy guardrail and BLOCK rules, so
the model refused before the filter was ever reached. The prompt now follows
DiscoverQuery.contentFilter: with it off, the guardrail is left out and risky
links are ranked lower and explained instead of dropped.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 4, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-04T12:00:33.809521Z a5706a1 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a5706a1a05

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@github-actions

github-actions Bot commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

Test Results

 1 353 files  +  378   1 380 suites  +378   9m 46s ⏱️ + 2m 55s
 8 962 tests +4 077   8 742 ✅ +3 857  220 💤 +220  0 ❌ ±0 
10 301 runs  +4 080  10 081 ✅ +3 860  220 💤 +220  0 ❌ ±0 

Results for commit 389a9b3. ± Comparison against base commit e9a7914.

♻️ This comment has been updated with latest results.

@linroid
linroid merged commit 701f631 into main Oct 4, 2026
15 checks passed
@linroid
linroid deleted the fix/discover-filter-off-prompt branch October 4, 2026 13:00
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