Skip to content

Conversation

@roomote
Copy link

@roomote roomote bot commented Oct 26, 2025

This PR attempts to address Issue #8842 where Roo Code was consistently generating mock/fallback data despite explicit user instructions not to do so.

Problem

Users reported that when they explicitly instructed Roo Code not to use mock data, fake data, simulations, or fallback data, the agent would still generate placeholder values instead of implementing real data connections.

Solution

This implementation adds multiple layers of protection against unwanted mock data generation:

1. System Prompt Enhancement

  • Added a CRITICAL DATA HANDLING RULE to the core system prompts that explicitly instructs the agent to respect user preferences about data handling
  • The rule clearly states what NOT to do (generate mock data) and what TO do instead (implement real connections or explain requirements)

2. User Instruction Detection

  • Implemented detectAntiMockDataInstructions() function that detects 18 different patterns users might use to express they don't want mock data
  • Patterns include variations like "no mock data", "real data only", "avoid simulations", etc.
  • Detection is case-insensitive for robustness

3. Prominent Warning Directive

  • When anti-mock patterns are detected, a prominent warning directive is added BEFORE other user instructions
  • This ensures high visibility and priority for the data handling preference

4. Comprehensive Testing

  • Added 7 new test cases covering various detection scenarios
  • Tests verify both positive detection and proper directive placement
  • All existing tests pass with updated snapshots

Technical Details

  • Modified files:
    • src/core/prompts/sections/rules.ts - Added data handling rule
    • src/core/prompts/sections/custom-instructions.ts - Added detection logic and directive insertion
    • src/core/prompts/sections/__tests__/custom-instructions.spec.ts - Added comprehensive tests
    • 8 snapshot files updated to include the new rule

Testing

  • All tests pass ✅
  • Linting passes ✅
  • Type checking passes ✅

Fixes #8842

Feedback and guidance are welcome!


Important

Enhances system prompts and adds detection for user instructions against mock data generation, with comprehensive testing.

  • Behavior:
    • Adds detectAntiMockDataInstructions() in custom-instructions.ts to detect user instructions against mock data.
    • Enhances system prompts in rules.ts with a critical data handling rule to respect user instructions against mock data.
    • Inserts a prominent warning directive when anti-mock patterns are detected.
  • Testing:
    • Adds tests in custom-instructions.spec.ts to verify detection of anti-mock instructions and proper directive placement.
    • Updates 8 snapshot files to include the new rule.
  • Misc:
    • Updates loadAgentRulesFile() in custom-instructions.ts to handle symlinks and read agent rules files.

This description was created by Ellipsis for b1f32d3. You can customize this summary. It will automatically update as commits are pushed.

- Add CRITICAL DATA HANDLING RULE to system prompts
- Implement detection for anti-mock data instructions in user preferences
- Add prominent directive when user requests no mock/fake/simulation data
- Include comprehensive test coverage for detection logic
- Update system prompt snapshots to include new rule

Fixes #8842
@roomote roomote bot requested review from cte, jr and mrubens as code owners October 26, 2025 12:19
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. bug Something isn't working labels Oct 26, 2025
@roomote
Copy link
Author

roomote bot commented Oct 26, 2025

Review Complete

No issues found

This PR looks good to merge. The implementation is well-structured with:

  • Clear system prompt rule instructing the agent to respect user preferences about data handling
  • Robust detection function with 18 pattern variations for comprehensive coverage
  • Proper test coverage with 7 test cases covering various scenarios
  • Correct directive placement before other user instructions for high visibility

The code is type-safe, follows project conventions, and all snapshots are properly updated.

Latest commit review: Snapshot updates correctly synchronized with the implementation.

Follow Along on Roo Code Cloud

Copy link
Author

@roomote roomote bot left a comment

Choose a reason for hiding this comment

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

No issues found.

Updated snapshots in add-custom-instructions.spec.ts to include the new
CRITICAL DATA HANDLING RULE that was added to the system prompts
@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Oct 26, 2025
Copy link
Author

@roomote roomote bot left a comment

Choose a reason for hiding this comment

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

No issues found.

@daniel-lxs
Copy link
Member

#8842 (comment)

@daniel-lxs daniel-lxs closed this Oct 29, 2025
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Oct 29, 2025
@github-project-automation github-project-automation bot moved this from Triage to Done in Roo Code Roadmap Oct 29, 2025
@daniel-lxs daniel-lxs deleted the fix/respect-no-mock-data-instructions branch October 29, 2025 19:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. size:L This PR changes 100-499 lines, ignoring generated files.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[BUG] Agent generates mock/fallback data despite explicit user instructions not to

4 participants