Skip to content

feat(search-experts): find who knows a topic from contributors across connected sources - #10565

Merged
waleedlatif1 merged 7 commits into
stagingfrom
feat/search-experts
Dec 1, 2026
Merged

waleedlatif1 merged 7 commits into
stagingfrom
feat/search-experts

Conversation

@waleedlatif1

@waleedlatif1 waleedlatif1 commented Dec 1, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Adds search_experts: find who in the organization knows a topic, ranked by what they did on matching items the caller can read.

  • Contributors. When a search asks for them, live providers report who worked on each item:
    • Jira: creator, reporter and assignee.
    • Confluence: author and last editor.
    • Google Drive: last modifier.
    • Also GitLab, GitHub and Linear people, and Slack authors.
    • Ordinary searches don't change: Atlassian fetches reporter, assignee and page history only for expert searches, and expert searches skip preview reads.
  • Ranking (lib/knowledge/experts/rank.ts): weighted by role, source, recency and rank within the account. Slack items per person are capped, people who appear across several sources get a bonus, and each person keeps up to 5 evidence links.
  • Use case (lib/knowledge/application/experts.ts, under knowledgeOperations.search):
    • Contributors are matched to the People directory by email, by Slack account, or by a name exactly one person in the directory has.
    • A caller who can't browse the directory (canLookUpPeople) gets contributors as their sources name them, without profiles.
    • Profiles come from the same personFacts as search_people.
    • Per-source statuses use the shared LiveSourceStatus; when a search reached no source, the note carries live search's guidance.
  • Surfaces:
    • Search MCP tool search_experts.
    • Assistant server tool search_experts, which adds citation IDs to evidence and tells the model how to cite and how to reconnect.
    • Organization Search block operation search_experts, which is now the sixth entry in ORGANIZATION_SEARCH_OPERATIONS. It runs as the person who started the run.
  • Contract: searchExpertsInputSchema reuses the 92-day activity window rule and the People field filters.
  • Optional fields: plain optional props are spelled ?: T | undefined for exactOptionalPropertyTypes.
  • No migration.

Mothership

  • Add search_experts to the Assistant's tool set with the catalog entry (already in tool-catalog-v1), and regenerate sim-assistant-tools.generated.ts from apps/sim/lib/api/contracts/mothership-assistant-tools.ts (bun run generate:cli-inventory in the worker).
  • The tool runs on the Sim side (route: 'sim'); nothing else is needed.

Type of Change

  • New feature

Testing

  • lib/mothership/tools/server/knowledge/experts.integration.ts runs the Assistant tool over a real directory and copilot delegation. It checks that the connected sources get only the projected query and that a secret filter never comes back in the answer. It also covers the Chat content-accounting fix, admitContent at the top of the use case; without it every Assistant call failed.
  • execute-tool.integration.ts: a secret-filled department is projected out of the returned profiles in a workflow run.
  • experts.integration.ts: an email two directory people share, or a Slack ID that two workspaces give different people, matches no one.
  • Each guard was reverted locally and its test went red.
  • lib/knowledge/application/experts.integration.ts, against a real database:
    • ranking across sources, with profiles and evidence
    • a name two directory people share stays out of the directory match
    • department and location filters
    • a caller without directory access gets no profiles
    • a Slack ID resolves through its identity
  • lib/internal/organization-search/execute-tool.integration.ts: search_experts in a workflow run with no connected source.
  • lib/sim-search/live/atlassian.test.ts: contributors are extracted, and contributor fields are requested only when asked for.
  • 7,945 related unit tests and 27 integration tests pass; bun run generate and lint; audits: test-types, boundaries, tool-effects, api-validation:strict, canvas-sentences, integration-catalog, organization-egress, comment-hygiene, explicit-any, source-conventions, unused-exports, tool-registry-boundary.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing (new tests pass the test-audit authoring gate)
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel

vercel Bot commented Dec 1, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
docs Skipped Skipped Dec 1, 2026 11:43am UTC

Request Review

@greptile-apps

greptile-apps Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5 · The PR appears safe to merge; no new blocking issue was found.RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no new blocking issue was found.

Summary

Adds search_experts across Search MCP, the Assistant, and workflows. It ranks contributors from readable source items and adds directory profiles only when allowed.

  • Searches rank people by the work they did on matching items.
  • Search MCP can return experts for a topic.
  • The Assistant can find experts and cite their work.
  • Organization Search workflows can find experts by topic.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  MCP[Search MCP] --> Experts[search_experts]
  Assistant[Assistant] --> Experts
  Workflow[Workflow] --> Experts
  Experts --> Live[Search caller-readable source items]
  Live --> Rank[Rank contributors]
  Experts --> Access{Directory access allowed?}
  Access -->|Yes| Profiles[Match directory profiles]
  Access -->|No| Names[Keep source-provided names only]
  Profiles --> Rank
  Names --> Rank
Loading

Reviews (7) · Last reviewed commit: "fix(search-experts): say when the filter..." · Reviewed by Greptile

Comment thread apps/sim/lib/sim-search/live/github.ts Resolved
Comment thread apps/sim/lib/knowledge/experts/rank.ts Resolved

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

1 issue found across 40 files

Confidence score: 3/5

  • In apps/sim/lib/internal/organization-search/search-experts.ts, this workflow can call searchExperts.execute without checking whether organization search is available. Add requireOrganizationSearchAvailable(call.principal.organizationId) before the call; the nested live-search gate does not cover this path.
Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="apps/sim/lib/internal/organization-search/search-experts.ts">

<violation number="1" location="apps/sim/lib/internal/organization-search/search-experts.ts:12">
P2: Gate this workflow handler with `requireOrganizationSearchAvailable(call.principal.organizationId)` before invoking `searchExperts.execute`; do not rely on the nested live-search gate.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Turn on auto-fix | Re-trigger cubic

Comment thread apps/sim/lib/sim-search/live/gitlab.ts Resolved
Comment thread apps/sim/lib/sim-search/live/github.ts Resolved
Comment thread apps/sim/lib/sim-search/live/slack.ts Resolved
Comment thread apps/sim/lib/sim-search/live/linear.ts Resolved
Comment thread apps/sim/lib/knowledge/experts/rank.ts Resolved
Comment thread apps/sim/lib/sim-search/live/google.ts Resolved
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All reported issues were addressed across 42 files

Reply with feedback, questions, or to request a fix.

Turn on auto-fix | Re-trigger cubic

Comment thread apps/sim/lib/people/repository.ts Resolved
Comment thread apps/sim/lib/sim-search/live/gitlab.ts Resolved
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No issues found across 43 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Turn on auto-fix | Re-trigger cubic

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

… connected sources

Adds search_experts to the Search MCP, the Assistant and the Organization Search block. Live providers report each result's contributors when asked; the use case ranks them by role, source, recency and rank, matches them to the People directory by email, Slack account or an unambiguous name, and returns evidence links to the items.
…ence, keep self-declared emails out of identity

- Contributors resolve to their directory person before ranking, so an email in one source and a unique name in another add up.
- An item two connected accounts both return counts once.
- GitHub people are named by login; git commit emails and GitLab public emails no longer identify anyone; Slack file authors count.
- Linear emails and the Drive last editor are fetched only for expert searches.
- A Slack ID that two workspaces give different people resolves to no one, and Slack emails are folded.
- The Assistant's citation readers collect expert evidence; its summary mentions outside contributors.
- Without directory access, department and location filters no longer hide every contributor; the note says they were not applied.
- The workflow tool projects every filter a secret could fill, not only the query.
…ge when compacted, match only unshared emails

- The Assistant tool projects the query, department and location through the turn's secret registry and refuses protected content, as search_workspace does.
- Compacted expert results keep their partial-coverage marker.
- An email two directory people share resolves to neither, as names already did.
- GitLab results with only the singular assignee field keep that assignee.
…ent masking and shared-identity rules

- search_experts admits its content up front, as live search does; in Chat the nested search's accounting does not reach the outer operation, so every Assistant call failed as unaccounted content.
- The Assistant tool sends the connected sources only the projected query and never answers with a secret filter.
- The workflow tool projects a secret-filled department out of returned profiles.
- An email two directory people share, or a Slack ID that two workspaces give different people, matches no one.

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All reported issues were addressed across 44 files

Reply with feedback, questions, or to request a fix.

Turn on auto-fix | Re-trigger cubic

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

1 issue found across 45 files

Confidence score: 4/5

  • mothership-assistant-tools.ts accepts source strings that expert search cannot use, so a typo can silently return no results. Validate sources with liveSearchProviderSchema.
Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="apps/sim/lib/api/contracts/mothership-assistant-tools.ts">

<violation number="1" location="apps/sim/lib/api/contracts/mothership-assistant-tools.ts:586">
P2: This accepts arbitrary source strings even though expert search only targets live provider IDs. Reject invalid sources with `liveSearchProviderSchema` so a typo does not silently produce a no-results search.</violation>
</file>

You've manually re-run cubic several times on this PR. Each manual re-review checks the full PR again and counts toward your usage quota. To preserve your usage limits, we recommend letting cubic automatically review new commits.

Turn on auto-fix | Re-trigger cubic

Comment thread apps/sim/lib/people/repository.ts Resolved
…s on every surface

The Assistant answered with a directory department that matched a run secret; profiles and outside contributors are now projected through the result registry in the use case, and the Assistant test asserts on a returned expert so it cannot pass vacuously.
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All reported issues were addressed across 45 files

You've manually re-run cubic several times on this PR. Each manual re-review checks the full PR again and counts toward your usage quota. To preserve your usage limits, we recommend letting cubic automatically review new commits.

Turn on auto-fix | Re-trigger cubic

…rt; test a withheld member directory

When contributors were found but none matched the department or location filter, the note now says so instead of claiming no one worked on the topic. The directory-closed tests now also cover a plain member kept out by a withheld member directory, with People enabled.
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No issues found across 45 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

You've manually re-run cubic several times on this PR. Each manual re-review checks the full PR again and counts toward your usage quota. To preserve your usage limits, we recommend letting cubic automatically review new commits.

Turn on auto-fix | Re-trigger cubic

@waleedlatif1
waleedlatif1 merged commit d17c78f into staging Dec 1, 2026
85 checks passed
@waleedlatif1
waleedlatif1 deleted the feat/search-experts branch December 1, 2026 16:53

This branch was previously deployed

1 inactive deployment
Preview — 9581187b Deployed Dec 1, 2026 by vercel[bot]
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