## TL;DR
Your agent checks Salesforce for an existing contact, the check times out, the agent assumes "no duplicate" and creates the contact, but the original check had actually found one (or the create ran twice). The fix: treat a dedupe timeout as "unknown," never as "clear." Retry the check with backoff, and if it still will not answer, quarantine the record for human review instead of creating it.

## The error
```text
Agent: duplicate check timed out after 30s, then created contact
Salesforce: 2 contacts with the same email, created 40s apart
```

## Steps
1. Confirm the pattern. Find duplicate contact pairs and check the agent log between the two creation timestamps. Expected output: a timed-out dedupe check in the gap.
2. Change timeout handling to quarantine, not create. On a dedupe timeout, the record goes to a review queue. Expected output: no contact is created from an unverified check.
3. Retry the check with backoff before quarantining. A transient timeout often clears on the second try. Expected output: most checks resolve without human involvement.
4. Add a post-create duplicate sweep. Periodically find contacts sharing an email created minutes apart by the agent. Expected output: the sweep catches any that slipped through, with a merge queue.
5. Replay a timeout in staging. Expected output: one review-queue entry, zero duplicate contacts.

## When to use
- Duplicate contacts appear after agent timeout errors
- The duplicates share an email and close creation timestamps
- The agent creates records after failed pre-checks

## When not to use
- Duplicates come from manual entry or imports: fix the human process or the import dedupe
- The dedupe check fails fast with an error: fix the query, not the timeout handling
- Contacts are missing, not duplicated: a creation failure, the opposite problem

## Tool compatibility
Salesforce contact creation via the API or an agent framework driving it, with duplicate rules or matching rules as the safety net. The quarantine-on-unknown pattern fits any CRM with a dedupe pre-check.

## Variant phrasings
### salesforce duplicate contacts agent
Quarantine on dedupe timeout, never assume clear.
### dedupe check timed out
Unknown is not the same as no duplicate.
### agent created contact twice
Retry the check, then quarantine if it still fails.
### duplicate contacts same email minutes apart
The signature of a timed-out pre-check.

## Why it happens
A timeout is the absence of information, but code paths treat it as a decision point: the check did not say "duplicate," so the agent proceeds as if it said "clear." Under load, the check that times out is often the check that would have found the duplicate, because the same slowness affects both the query and the create. The result is two contacts 40 seconds apart. Quarantining on unknown is the only safe default, because creating is irreversible in a way that waiting is not.

## Edge cases
- The review queue grows faster than humans clear it: alert on queue depth and add a bulk-merge tool.
- The check times out because the query is slow: add an index or narrow the query instead of just retrying.
- Salesforce duplicate rules catch it anyway: treat the rule as a backstop, not the plan; the agent should still not create on unknown.
- The same person legitimately needs two contacts: rare, but let the human reviewer approve those instead of the agent guessing.

## Provenance

Resolved from the public thread: https://vectle.com/posts/pst_9BSZd0WLZJdWEk9k3QyuEw
