fix(deriver): prevent cross-subject self-observations - #943
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (9)
🚧 Files skipped from review as they are similar to previous changes (8)
WalkthroughThe deriver prompt now applies explicit speaker and subject attribution rules, marks durable target-peer facts, and excludes non-durable observations during representation conversion. Tests and fixtures adopt the new prompt-specific observation model and validate filtering behavior. ChangesDurable target observations
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant Messages
participant DeriverPrompt
participant PromptRepresentation
participant Representation
Messages->>DeriverPrompt: provide speaker-labeled messages
DeriverPrompt->>PromptRepresentation: emit target-peer observations with durability flags
PromptRepresentation->>Representation: convert only durable target facts
Possibly related PRs
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/deriver/prompts.py (1)
69-87: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueWrap the changed prompt-source lines.
Lines 70, 72, 73, 77, and 87 exceed the repository’s 88-character limit. As per coding guidelines, Python code must keep lines within 88 characters to match Black-compatible formatting.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/deriver/prompts.py` around lines 69 - 87, Wrap the overlong prompt-source lines in the changed prompt text, specifically the lines corresponding to 70, 72, 73, 77, and 87, so each remains within the repository’s 88-character limit while preserving the exact prompt wording and behavior.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/deriver/prompts.py`:
- Around line 69-71: Make the prompt and structured-output schema consistently
accept durable facts about the target peer when directly supported by any
speaker’s message. In src/deriver/prompts.py lines 69-71, revise the
explicit-fact definition to use target-peer scope rather than speaker/user-only
scope; in lines 80-82, replace inferred or unanchored examples such as fixed
birthday, NYC residence, and education equivalence with directly supported
observations only. In src/utils/representation.py lines 130-133, update the
field description and inference guidance to match this any-speaker, target-peer
evidence contract.
---
Nitpick comments:
In `@src/deriver/prompts.py`:
- Around line 69-87: Wrap the overlong prompt-source lines in the changed prompt
text, specifically the lines corresponding to 70, 72, 73, 77, and 87, so each
remains within the repository’s 88-character limit while preserving the exact
prompt wording and behavior.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: f41a2a28-87c1-43da-9ba5-2dde31f0518b
📒 Files selected for processing (9)
src/deriver/prompts.pysrc/utils/representation.pytests/conftest.pytests/deriver/test_deriver_processing.pytests/deriver/test_prompts.pytests/deriver/test_representation_crud.pytests/integration/test_representation.pytests/integration/test_token_metrics.pytests/utils/test_length_finish_reason.py
1baed39 to
a0e725f
Compare
Summary
Fix deriver subject attribution without disabling peer self-observation or filtering stored messages.
Motivation
With self-observation enabled, an assistant reply such as
You play tennis on Tuesdayscan produce an AI self-conclusion such asassistant knows the user plays tennis on Tuesdays, or worse, misattribute the tennis schedule directly to the assistant. Disabling self-observation prevents the corruption but also removes useful AI identity, capability, and preference learning.This fixes the attribution boundary while preserving assistant messages, cross-peer observation, and genuine AI self-representation.
Implementation
The existing single deriver call now returns
is_durable_target_factfor each explicit conclusion. Only conclusions classified as durable facts about the target peer are converted into persistent observations. The prompt includes speaker/subject rules and paired positive and negative examples.This deliberately does not apply the SQL speaker filter proposed in #823. Interleaved messages remain available so another speaker can provide valid evidence about the target peer, matching the maintainer guidance on that PR.
End-to-end enqueue promotion for assistant-authored facts about the other participant is provided by the stacked follow-up #944.
Validation
Fixes #817.
Supersedes the attribution approach in #823 while preserving its reported reproduction and maintainer feedback.
Summary by CodeRabbit