## TL;DR

Salesforce daily API caps reset at midnight, not when you feel like it. Once the cap is hit, every API call returns REQUEST_LIMIT_EXCEEDED and nothing you "send" through the API actually happens. Fix the agent to read the limit headers, hard-stop on the limit error, and reconcile its local log against Salesforce before claiming any send succeeded.

```
agent hit the Salesforce daily API cap at 11am and kept 'sending' - every send after that logged success locally but never reached anyone
```

## Steps

1. After the incident, pull the agent's local send log and query Salesforce for the same records (tasks, emails, or whatever the agent claimed to create) in the same time window.
   Expected: you find a gap starting at the cap hit; every "success" after it is a phantom.

2. Find the exact cap time: check the org's API usage under Setup, or find the first REQUEST_LIMIT_EXCEEDED in the agent's error log. Everything after that timestamp is unreconciled.
   Expected: one clean cutoff timestamp for the audit.

3. Add a pre-flight check to the agent's Salesforce client: read the Sforce-Limit-Info response header on every call and halt the run when remaining calls drop below a safety floor (e.g. 5 percent of the daily quota).
   Expected: the agent stops itself before the cap, not after.

4. Change the success-logging rule: a send is only logged as successful when the Salesforce response contains a real record id. No id, no success entry.
   Expected: phantom sends become impossible by construction.

5. Re-run the failed window once the quota resets: replay only the leads from the cutoff timestamp forward, then re-run the reconciliation from step 1 to confirm zero gaps.
   Expected: every claimed send now has a matching Salesforce record.

## Use this when

- Salesforce calls start failing with REQUEST_LIMIT_EXCEEDED
- Send counts look fine locally but Salesforce records are missing
- A long job died or went silent around midday

## Not for this skill when

- The error is INVALID_SESSION_ID or an auth problem (session refresh issue)
- Calls fail with validation errors like REQUIRED_FIELD_MISSING (payload problem)
- The cap is on HubSpot or Outreach (different limit model)
- Sends never went through Salesforce at all (pure email send path, check the mail provider instead)

## Variant phrasings

- "salesforce daily API cap hit mid-day, agent kept logging sends"
- "REQUEST_LIMIT_EXCEEDED during agent sequence run, phantom tasks"
- "Salesforce API usage maxed out and the SDR agent did not notice"

## Why it happens

Salesforce enforces a rolling 24-hour API request cap per org. Many agent HTTP clients only check for network errors and treat anything returned without an exception as success, so the REQUEST_LIMIT_EXCEEDED body never surfaces. The local log happily records "sent" while Salesforce discarded every request, and nobody notices until someone opens Salesforce.

## Edge cases

- The cap is org-wide, so another integration can burn quota the agent expected to have. Track consumption in the org, not just in the agent.
- Composite and bulk jobs consume differently from REST calls; estimate the run's call budget before starting, not during.
- A sandbox refreshed overnight points at a new org with its own (lower) limits. After any refresh, re-verify the quota before running.
- If the agent runs across midnight, quota resets mid-run. That is fine, but the pre-flight check should re-read headers continuously, not once at startup.

## Provenance

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