fix(core): preserve speaker names in prior dialogue context#7895
fix(core): preserve speaker names in prior dialogue context#7895RemilioNubilio wants to merge 2 commits into
Conversation
|
Additional trajectory evidence from the live Discord investigation: BeforeSource channel: Failing exchange:
Follow-up:
What the trajectories showed: the relevant text was present in the Stage 1 prompt, but structured history had been reduced to anonymous AfterSmoke channel: Live verification after restarting from local source:
Note: the live after smoke had the setup message in the connector-provided recent channel context, which already includes names. The new unit regression directly covers the lower-level |
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ 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 |
|
Follow-up pushed in What changed:
Evidence:
Validation:
|
Summary
prior_message:userblocks# Conversation Messagesprovider text still stays out of Stage 1 promptsWhy
A live Discord exchange showed Remilio/Nubilio losing speaker attribution after earlier chat context was converted into anonymous
prior_message:userblocks. The model saw prior text, but not who said it, so it failed follow-up questions like "look in the chat" / "her and botdick" even though the relevant messages were present.This patch is connector-agnostic: it reads the existing
metadata.sender/ entity-name fields already written by connectors and prefixes prior dialogue content with the sender name. Reply references already use this shape.Validation
origin/develop(fa83ddee6f) via fast-forward before patchingbun vitest run src/__tests__/message-runtime-stage1.test.ts src/features/basic-capabilities/providers/recentMessages.test.ts src/runtime/__tests__/planner-loop.test.tsfrompackages/core: 94 tests passedbun run typecheckfrompackages/core: passedbun run buildfrompackages/core: passed150767441155208405915076744229397504741507674432225939507tj-224f2528525703gpt-oss-120bGreptile Summary
This PR fixes speaker attribution in prior-dialogue context by prefixing each
prior_message:userblock with the sender's name drawn frommetadata.sender/ entity-name fields, and adds acore.contextual_identity_lookup_requires_recallevaluator that reroutes short, locally-scoped "who is X?" questions through memory/messaging rather than letting the simple shortcut guess.priorDialogueSpeakerName+priorDialogueContent): reads connector-supplied sender metadata and prepends\"name: text\"to prior-dialogue segments, preserving existing dedup behaviour for provider text.extractContextualIdentityLookupSubject+isShortContextualLookupSubject): detects single-turn questions about short, local-looking handles and injects anidentity_lookup_policycontext slice, routing the planner toward recall before answering.Confidence Score: 4/5
Safe to merge for the speaker-attribution fix; the identity-lookup evaluator has a case-sensitivity inconsistency that causes it to silently skip capitalized chat handles.
The speaker-attribution change is narrow and well-tested. The identity-lookup evaluator's isShortContextualLookupSubject tests the third looksLikeLocalName condition against the original-case subject instead of the lowercased normalized, so a Discord display name like Shebotdick (capital S) would not trigger recall routing while the lowercase spelling would, quietly reverting to the guessing path the feature is meant to prevent.
packages/core/src/services/message.ts — specifically the isShortContextualLookupSubject function and its looksLikeLocalName regex.
Important Files Changed
Reviews (2): Last reviewed commit: "fix(core): route local identity lookups ..." | Re-trigger Greptile