Repository navigation
fix(enrich): stop the contact batch at the first quota 429 - #295
Open
posthog-eu[bot] wants to merge 3 commits into
Open
posthog-eu[bot] wants to merge 3 commits into
posthog-eu[bot] wants to merge 3 commits into
Conversation
The enrichment quota is per account, not per contact. After a 429, the generic QUOTA_EXCEEDED hint only said "wait, then retry", so an agent that enriched a list moved on to the next contact and each call failed the same way. leadbay_enrich_contacts now puts a stop-the-batch hint in front of the generic hint on a 429 from either enrich path. The code, the generic hint and the 429 metadata stay the same. The tool description also says that one 429 ends the whole batch. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Generated-By: PostHog Desktop Task-Id: 24c048cd-ccb9-4d68-bd91-ffacb0b7bb7d
Remove the nested try, the test-only export and the duplicate assertions. The behavior does not change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Generated-By: PostHog Desktop Task-Id: 24c048cd-ccb9-4d68-bd91-ffacb0b7bb7d
Author
|
The |
…fixmcp-investigate-contact-enrichment-f1a6fc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
leadbay_enrich_contactscall fails the same way until the window resets.QUOTA_EXCEEDEDhint says only "wait, then retry". It does not say that the quota is shared. So the agent moved on to the next contact, about one call per second, until the list ended.retry_after. The client did not retry. Each failure was a new call from the agent.Origin
signals-scout-generalChanges
leadbay_enrich_contactsputs an enrich-specific sentence in front of the generic hint when either enrich path (paid or org fallback) returnsQUOTA_EXCEEDED. The sentence tells the agent that the quota is shared, to stop the batch, not to retry in a loop, and to tell the user which contacts are done and which remain.{{commerce}}split), and_meta(http_status,retry_after) do not change. Telemetry still records the terminal reason asQUOTA_EXCEEDED/ 429.enrich-contacts.md.tmplnow says "One 429 ends the whole batch", so the agent knows before the first 429. The description is about 6.3k chars, far under the 17k cap.enrich-contacts-quota-stops-batch.test.tscovers the paid path, the org fallback path, and a non-quota error.retry_afteris passed through when the backend sends it. It was absent in this spike, so the hint points toleadbay_account_statusfor the window.Note
This is guidance to the agent, not a server-side block. The hosted server is stateless per request, so it cannot remember a 429 across calls without new shared state. If the pattern comes back, a per-token short-circuit is the next step.
Checks
pnpm build,pnpm -r typecheck,pnpm test(components, core, promptforge, mcp): all pass.Agent context
ai_creditscounts credits consumed, not credits remaining.Created with PostHog Desktop from this inbox report.
🤖 Generated with Claude Code