Skip to content

fix(agent): add contacts domain to tool-RAG classifier#4178

Merged
pewdiepie-archdaemon merged 1 commit into
odysseus-dev:devfrom
holden093:fix/contacts-domain-classifier
Jun 15, 2026
Merged

fix(agent): add contacts domain to tool-RAG classifier#4178
pewdiepie-archdaemon merged 1 commit into
odysseus-dev:devfrom
holden093:fix/contacts-domain-classifier

Conversation

@holden093

@holden093 holden093 commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

Summary

Contact-lookup requests like "What is X's contact?" or "What's Y's phone number?" matched no domain in _classify_agent_request, were flagged low_signal=True, and had tool retrieval skipped entirely. The model only received ALWAYS_AVAILABLE (manage_memory, ask_user, update_plan) — never resolve_contact or manage_contact.

This is the exact same class of bug as #3606 (images), just for the contacts domain.

The keyword hints in tool_index.py already map {"contact", "address", "phone", "who is"} to {"resolve_contact", "manage_contact"}, but those hints are only evaluated as a fallback when _relevant_tools is empty — the low-signal gate sets it to ALWAYS_AVAILABLE (non-empty) before the fallback, so the hints are dead code for low-signal messages.

Target branch

  • This PR targets dev, not main. All PRs land in dev; main is curated by the maintainer at each release. If your PR is on main by accident, click "Edit" on this PR and change the base.

Linked Issue

Follows the pattern established in #3606 (same root cause, different domain). No issue filed yet — this is a regression discovered during use.

Type of Change

  • Bug fix (non-breaking — fixes a confirmed issue)
  • New feature (non-breaking — adds new behaviour)
  • Breaking change (changes or removes existing behaviour)
  • Refactor / cleanup (behaviour unchanged)
  • Documentation only
  • CI / tooling / configuration

Checklist

  • I searched open issues and open PRs — this is not a duplicate. The only related PR is fix(agent): add image domain to tool-RAG classifier #3606 (image domain, same root cause).
  • This PR targets dev
  • My changes are limited to the scope described above — no unrelated refactors or whitespace changes mixed in.
  • I actually ran the app and verified the change works end-to-end. Type-checks and unit tests are not enough.

How to Test

  1. Run the new test suite: python -m pytest tests/test_tool_rag_contacts_domain.py -v
  2. In a running instance, send a chat message like "What is John's contact?" or "What's Alice's phone number?" in agent mode
  3. Verify the log shows domains=["contacts"] and low_signal=False, and that resolve_contact is among the selected tools
  4. Confirm that a non-contact query like "what is the capital of France" does NOT match the contacts domain

Changes

Three additions, mirroring #3606 exactly:

  1. _DOMAIN_RULES — contacts rule pack directing the model to resolve_contact/manage_contact
  2. _DOMAIN_TOOL_MAP"contacts": {"resolve_contact", "manage_contact"}
  3. _classify_agent_request — domain detection: \b(contact|contacts|phone|phone number|address book|vcard)\b

Tests

tests/test_tool_rag_contacts_domain.py — 5 tests covering:

  • Contact lookup phrasings resolve to the contacts domain (not low-signal)
  • Contact management phrasings (add/update/delete/save) also resolve
  • _DOMAIN_TOOL_MAP seeds the correct tools
  • _DOMAIN_RULES entry exists and is picked up by _domain_rules_for_tools
  • Non-contact requests do NOT false-match

Visual / UI changes — REQUIRED if you touched anything that renders

  • Screenshot or short clip — N/A (no UI changes)
  • Style match — N/A
  • No new component patterns — N/A
  • I am not an LLM agent submitting a bulk PR. If you are, please open an issue describing the problem first — bulk auto-generated PRs that don't match the project's visual style are closed on sight, even when the underlying fix is correct.

Screenshots / clips

N/A (backend-only change, no UI touched)

Contact-lookup requests ('What is X's contact?', 'What is Y's phone
number?') matched no domain in the classifier, were flagged low_signal,
and had tool retrieval skipped entirely — the model only received
ALWAYS_AVAILABLE (manage_memory, ask_user, update_plan) and never
resolve_contact/manage_contact.

Add a 'contacts' domain with:
- _DOMAIN_RULES: directs the model to resolve_contact/manage_contact
- _DOMAIN_TOOL_MAP: seeds resolve_contact + manage_contact
- _classify_agent_request: matches contact/contacts/phone/phone
  number/address book/vcard keywords

Mirrors the pattern of the images domain fix (PR odysseus-dev#3606).
@github-actions github-actions Bot added needs work PR description incomplete — please update before review ready for review Description complete — ready for maintainer review and removed needs work PR description incomplete — please update before review labels Jun 13, 2026

@pewdiepie-archdaemon pewdiepie-archdaemon left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks good. Contact lookup and management prompts now deterministically seed resolve_contact/manage_contact instead of being treated as low-signal, and the focused classifier/rule-pack tests pass locally.

@pewdiepie-archdaemon
pewdiepie-archdaemon merged commit 96052c5 into odysseus-dev:dev Jun 15, 2026
5 of 6 checks passed
@holden093
holden093 deleted the fix/contacts-domain-classifier branch June 15, 2026 19:15
vdmkenny pushed a commit that referenced this pull request Jun 15, 2026
…contact has no email (#4327)

When a CardDAV contact matched the search query but had no email
address (only phone numbers), the tool silently dropped it and
returned 'No contacts found'.  Fall back to the contact's phone
number(s) so the caller still receives usable information.

Refs: #4178 (the contacts-domain classifier fix that made the model
actually call resolve_contact for contacts queries, surfacing this
pre-existing gap)
kootenayalex pushed a commit to kootenayalex/odysseus-mlx that referenced this pull request Jun 16, 2026
…contact has no email (odysseus-dev#4327)

When a CardDAV contact matched the search query but had no email
address (only phone numbers), the tool silently dropped it and
returned 'No contacts found'.  Fall back to the contact's phone
number(s) so the caller still receives usable information.

Refs: odysseus-dev#4178 (the contacts-domain classifier fix that made the model
actually call resolve_contact for contacts queries, surfacing this
pre-existing gap)
ToyVo pushed a commit to ToyVo/odysseus that referenced this pull request Jul 7, 2026
…contact has no email (odysseus-dev#4327)

When a CardDAV contact matched the search query but had no email
address (only phone numbers), the tool silently dropped it and
returned 'No contacts found'.  Fall back to the contact's phone
number(s) so the caller still receives usable information.

Refs: odysseus-dev#4178 (the contacts-domain classifier fix that made the model
actually call resolve_contact for contacts queries, surfacing this
pre-existing gap)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready for review Description complete — ready for maintainer review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants