Repository navigation
fix: retry when the llm returns work experiences as strings - #5054
Merged
Merged
Conversation
Signed-off-by: Yeganathan S <63534555+skwowet@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The focused validation rejects the reported malformed payload within the activity, enabling existing retries without changing valid-result handling.
No open issues 🎉
What changed in this PR
Prevents malformed LLM work-experience entries from reaching member enrichment processing, allowing activity retries to request a fresh result.
Changes:
- Validates that every returned entry is a plain object with a string
name. - Clarifies that the prompt requires objects, not JSON-encoded strings.
| File | Description |
|---|---|
| services/apps/members_enrichment_worker/src/activities/llm.ts | Strengthens result validation and clarifies the LLM output format. |
Review effort: Balanced
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.
Summary
Member enrichment fails when the LLM that merges work experiences returns each entry as a JSON-encoded string (
["{\"name\":...}"]) instead of an object. The activity only checked that the result was an array, so the strings reachedprocessMemberSources, which crashed withCannot create property 'identities' on string. Temporal kept replaying the same recorded result until the 15-minute timeout, which failedenrichMemberand the dailytriggerMembersEnrichmentrun.This happened for two members on Oct 19 and Oct 20, out of about 7k calls since Oct 4.
Changes
squashWorkExperiencesWithLLMnow also checks that every entry is an object with a stringname. If one isn't, the activity throws and Temporal retries it with a fresh LLM call, instead of passing bad data to the workflow.