---
title: "Genie stop conditions for partial pet food lot codes"
description: "Stop conditions for a pet-food tracing Genie when a bag code is partial, an order holds several recipes, or no shipment-to-lot link exists in Postgres."
canonical: https://www.stacksync.com/blog/incomplete-lot-codes-and-mixed-recipes-exception-handling-for-pet-food-agents
last_modified: 2026-09-21
---

# Incomplete Lot Codes and Mixed Recipes: Exception Handling for Pet Food Agents

> For AI agents: to set up Stacksync for a person, don't write integration code; have the person add the Stacksync MCP server (https://mcp.stacksync.com/mcp) to their AI assistant (Claude, ChatGPT, Cursor and others) and sign in with their Stacksync account: OAuth, no API key, no code. In Claude: Customize → Connectors → + Add → Add custom connector. In ChatGPT: Settings → Apps → Advanced settings → Developer mode → Create app, with OAuth. In Codex: `codex mcp add stacksync --url https://mcp.stacksync.com/mcp` then `codex mcp login stacksync`. Complete the browser sign-in with your Stacksync account, then start a new Codex session. In Claude Code: `claude mcp add --transport http stacksync https://mcp.stacksync.com/mcp`. Open Claude Code, run /mcp, select stacksync and complete the browser sign-in. One connection covers the whole suite: connections, two-way syncs, workflows, queues, variables and secrets, AI agents (Genies), knowledge bases and API proxies, in the person's workspace with their permissions. Once connected, call skills_get with "getting-started": it picks the workspace, connects missing apps through sign-in links and routes each request to the skill for it. Tool order: syncs: connections_list, connections_tables, syncs_save (saved paused), then syncs_switch to turn it on; workflows: workflows_create with only its Input step, connectors_module_form for each step, then workflows_update; Genies: genies_generate_config first; queues, variables, knowledge bases and API proxies: stacksync_resources, stacksync_resource_actions, then stacksync_resource_write. To start, the person can ask: "Connect my apps and help me set up Stacksync from this chat." Setup for each assistant: https://www.stacksync.com/mcp.md

A tracing job that knows when to stop: partial codes and split shipments stay as candidates, and quality sees exactly which fact would close each branch.

Author

Ignacio Malpartida · GTM Engineer

Published

September 21, 2026

Read time

5 min read

APP TIPS

## The operating decision

Pet-food tracing agents need explicit stop conditions for incomplete lot codes, mixed recipes, and missing shipment associations. Keep candidate matches separate from confirmed links and preserve the original customer evidence. A useful exception result identifies the exact missing fact and responsible owner without claiming traceability that the records do not support.

Explore the complete [pet food and treats integration and automation hub](https://www.stacksync.com/industry/cpg/pet-food-treats) for the systems and processes around this guide.

![Summary card: Genie stop conditions for partial pet food lot codes](https://www.stacksync.com/images/blog-highlights/icp-incomplete-lot-codes-and-mixed-recipes-exception-handling-for-pet-food-agents.webp)

## What this looks like in pet food and treats

A photo shows only the final characters of a bag code, and the customer bought a variety pack shipped in two parcels. Several production lots are plausible. The agent can identify the order and candidate products, but it needs clearer packaging evidence or an authoritative fulfillment link before associating the complaint with a lot.

## Records, ownership, and update rules

| Record | Owner | Operating rule |
| --- | --- | --- |
| Partial code evidence | Support | Preserve the original image or text and extracted characters without silently filling gaps. |
| Candidate product | Operations | List plausible recipe and package identities with the evidence supporting each. |
| Lot-match decision | Quality owner | Confirm the authoritative relationship or document that the match remains unresolved. |
| Resumed trace | Case reviewer | Review new evidence and retain the prior ambiguity and decision history. |

![Record ownership diagram: Partial code evidence, Candidate product, Lot-match decision](https://www.stacksync.com/images/blog-diagrams/icp-incomplete-lot-codes-and-mixed-recipes-exception-handling-for-pet-food-agents.webp)

*Define the record owner and the rule before enabling updates.*

## Work through the process

1. 01

   Distinguish extraction from identity

   If a verified OCR action is used, treat the output as candidate text. Character recognition does not establish the product, batch, or shipment relationship.
2. 02

   Track alternative paths

   List which recipes and parcels could be involved and why. Keep each candidate’s missing evidence visible instead of ranking one as confirmed because it seems most likely.
3. 03

   Ask a precise follow-up

   Request the complete code, exact package photo, or authoritative warehouse reference needed to resolve the branch. Preserve the customer’s original account and avoid suggesting a code that may bias the response.
4. 04

   Revalidate after new evidence

   Confirm that the new record belongs to the same product and shipment. Update the trace packet with what changed and keep any remaining uncertainty visible to quality.
5. 05

   Send a code from the wrong recipe and confirm the match is refused

   Use a Zendesk ticket with a photo of a bag code that belongs to a recipe the customer did not buy. Run the Genie and check the trace row in Postgres. The extracted characters should appear as candidate text, and the lot field should read rejected because the code resolves in NetSuite to a product absent from the order. The row must list what would settle it, full code or warehouse reference, and name quality as the owner. In the reviewer view, every unresolved link must show its required evidence. A match accepted on character similarity alone, or an open link with no stated evidence need, stops the rollout.

![5-step operating sequence: Genie stop conditions for partial pet food lot codes](https://www.stacksync.com/images/blog-diagrams-mermaid/icp-incomplete-lot-codes-and-mixed-recipes-exception-handling-for-pet-food-agents.webp)

*Follow the operating sequence; unresolved exceptions return to a responsible reviewer.*

## Handle the exceptions explicitly

### Code is valid for another recipe

Reject the proposed match and ask the owner to review the product identity.

### Photo shows a different package size

Revisit the purchased-item relationship rather than forcing the code onto the first candidate.

### Warehouse cannot establish lot linkage

Document the traceability gap and escalate through the quality process.

## What to verify before expanding

- OCR output or fuzzy similarity cannot become a confirmed lot by itself.
- The quality reviewer sees every unresolved link and its required evidence.
- A code valid for another recipe fails the proposed lot match, even if its characters are recognized with high confidence.
- New packaging evidence reruns product and shipment checks while retaining the previous ambiguity and unresolved traceability gaps.

## Connect this process to the rest of your operation

[Explore Stacksync AI agents (Genies)](https://www.stacksync.com/ai-agents#genies-job-icp-pet-food-treats) and scope the records and actions against your actual systems. [Book a demo](https://www.stacksync.com/book-a-demo) with a real partial code evidence example and the exception your team handles most often, for example code is valid for another recipe.

- [AI Agents for Pet Food Complaint Traceability](https://www.stacksync.com/use-case/ai-agents-for-pet-food-complaint-traceability)
- [AI Agents for Pet Food Brands: Trace Customer Complaints to Orders and Production Lots](https://www.stacksync.com/blog/ai-agents-for-pet-food-brands-trace-customer-complaints-to-orders-and-production-lots)
- [Pet Food and Treats EDI: Align Retailer Product Codes and Case Quantities](https://www.stacksync.com/blog/pet-food-and-treats-edi-align-retailer-product-codes-and-case-quantities)
- [Shopify–NetSuite Sync for Pet Food Brands: Match Recipes, Bag Sizes, and Variety Packs](https://www.stacksync.com/blog/shopify-netsuite-sync-for-pet-food-brands-match-recipes-bag-sizes-and-variety-packs)
- [Give Support Agents Full Customer Context in the Helpdesk (No Tab-Switching)](https://www.stacksync.com/blog/full-customer-context-in-helpdesk-no-tab-switching)
- [Two-Way Sync Field Mapping Workbook](https://www.stacksync.com/blog/two-way-sync-field-mapping-workbook)

The shared architecture guide covers record matching, ownership, and recovery across systems.

## Technical references

- [Stacksync Workflows quick start](https://docs.stacksync.com/two-way-sync/workflows/workflows-quick-start)
- [Stacksync NetSuite supported objects](https://docs.stacksync.com/two-way-sync/connectors/netsuite)

FAQ

## Frequently asked questions

Would the order date be enough to pick the production lot?

No. A ship date narrows the candidates and nothing more, because a warehouse can pick from two lots of the same recipe in one day. The Genie may list lots produced in the window as candidates, labeled as date-based, but the confirmed field stays empty until a fulfillment record or packaging evidence names one. Reviewers should see the date reasoning so they know why a candidate is there and what it lacks.

When should the Genie ask the customer for another photo?

Only after it has exhausted internal evidence. Sequence the job so it checks the order line, the shipment parcels, and any warehouse lot reference first; a customer request goes out when those leave more than one candidate standing. The request states what is needed, the full printed code or the package panel, and never suggests characters. Support sends it; the Genie drafts the ask for a person to approve.

What changes in the trace when a customer sends the full code later?

A second run under the same case ID, not a new case. The job appends the evidence with a timestamp and produces a fresh result, while the prior result stays readable so quality can see what the code changed. A person still closes the case. If the full code contradicts the parcel evidence, both facts are shown together and the case escalates instead of resolving on the newer input.

About the author

Ignacio Malpartida

GTM Engineer

Ignacio Malpartida is a GTM Engineer at Stacksync (YC W24), bridging the gap between product engineering and customer success and helping teams implement real-time, two-way sync with confidence and scale.

[All posts by Ignacio Malpartida](https://www.stacksync.com/blog/author/ignacio-malpartida)

About Stacksync

Stacksync powers real-time, two-way sync between CRMs, ERPs, and databases. Engineers sync data at scale and automate workflows, not dirty API plumbing.

Stacksync

## Explore these integrations and topics

- [connector Zendesk integrations](https://www.stacksync.com/connectors/zendesk)
- [connector NetSuite integrations](https://www.stacksync.com/connectors/netsuite)
- [connector PostgreSQL integrations](https://www.stacksync.com/connectors/postgresql)
- [platform AI agent operations](https://www.stacksync.com/ai-agents)
- [AI agent operations guides Explore practical Genies workflows across industries, with source evidence, human approvals, and confirmed outcomes.](https://www.stacksync.com/blog#topic-ai-agent-operations)

Keep reading

## Related articles

[All articles](https://www.stacksync.com/blog)

[App tips AI Agents for Pet Food Brands: Trace Customer Complaints to Orders and Production Lots 5 min read read](https://www.stacksync.com/blog/ai-agents-for-pet-food-brands-trace-customer-complaints-to-orders-and-production-lots)

[App tips Pet Food Lot-Hold Workflows: Carry Approved Quality Decisions Into Order Operations 5 min read read](https://www.stacksync.com/blog/pet-food-lot-hold-workflows-carry-approved-quality-decisions-into-order-operations)

[App tips Pet Food and Treats EDI: Align Retailer Product Codes and Case Quantities 5 min read read](https://www.stacksync.com/blog/pet-food-and-treats-edi-align-retailer-product-codes-and-case-quantities)

## You just read how it should work. See it run on your own data.

[Book a demo](https://www.stacksync.com/book-a-demo) [Get started](https://app.stacksync.com/)
