feat: Add AI E-Commerce Cart Recovery Agent kit - #285
Conversation
|
Warning Review limit reached
Next review available in: 59 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Repository UI (base), Organization UI (inherited) Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
WalkthroughChangesThe pull request adds a complete cart-recovery agent kit. It includes bundle configuration, RAG runtime flow, eight ingestion pipelines, metadata scripts, prompts, safety rules, environment setup, and documentation. Cart Recovery Agent Kit
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
JoduVyshnavi17
left a comment
There was a problem hiding this comment.
Ai E-Commerce Cart Recovery Agent was built
:robot_face: AgentKit Structural ValidationNew Contributions Detected
Check Results
|
|
@JoduVyshnavi17 please resolve the comment above |
There was a problem hiding this comment.
Actionable comments posted: 31
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@kits/ai-ecommerce-cart-recovery-agent/agent.md`:
- Around line 107-110: Update the RAG prompt references in the flow
documentation near Chat Widget and RAGNode to use cart-recovery-system.md for
assistant behavior and grounding, and cart-recovery-user.md for injecting the
user query. Remove the nonexistent knowledge-chatbot_* filenames without
changing the documented flow.
In `@kits/ai-ecommerce-cart-recovery-agent/flows/cart-recovery.ts`:
- Around line 49-90: Define a complete cart-recovery input contract in
kits/ai-ecommerce-cart-recovery-agent/flows/cart-recovery.ts:49-90 by adding the
customer and cart fields required by the prompt, then map and pass those fields
with chatMessage in the RAG request at
kits/ai-ecommerce-cart-recovery-agent/flows/cart-recovery.ts:160-162. Update
kits/ai-ecommerce-cart-recovery-agent/prompts/cart-recovery-user.md:1-17 to
reference only fields guaranteed by this trigger/input schema.
In `@kits/ai-ecommerce-cart-recovery-agent/flows/crawling-indexation.ts`:
- Around line 8-10: Update the references to the downstream “Knowledge Chatbot”
flow in the crawling-indexation documentation to use the actual shipped flow
symbol, cart-recovery.ts, so operators can locate it within this kit. Preserve
the existing ingestion and retrieval-stage descriptions.
- Around line 419-430: Update the Index node configuration so primaryKeys uses
the unique per-chunk identifier produced by the crawling metadata transform
instead of title alone. Keep duplicateOperation set to overwrite, ensuring
chunks from the same page remain distinct while true duplicates are replaced.
- Around line 243-262: Update the Firecrawl configuration in the node
represented by the “values” object to align with the actual subpage-discovery
mapping: inspect the Firecrawl node schema and either remove the unused
crawlSubPages option or replace it with the supported option controlling subpage
discovery, such as the mapped allowSubdomains, allowExternalLinks, or sitemap
setting. Preserve the intended maxDiscoveryDepth limit.
In `@kits/ai-ecommerce-cart-recovery-agent/flows/gdrive.ts`:
- Around line 354-369: Replace the hardcoded Google Drive folder URL in the
Variables node’s mapping.source default with a neutral placeholder value. Keep
mapping.source exposed as a useCaseInput and leave the title mapping unchanged.
- Around line 319-339: The IndexNode configurations expose a hardcoded public
test webhook. In kits/ai-ecommerce-cart-recovery-agent/flows/gdrive.ts lines
319-339, update IndexNode_343 to remove the webhookURL or replace it with a
configurable/blank value; make the same change to IndexNode_824 in
kits/ai-ecommerce-cart-recovery-agent/flows/gsheet.ts lines 294-315.
- Around line 114-126: Trim the trailing space from the meta.name value in
kits/ai-ecommerce-cart-recovery-agent/flows/gdrive.ts lines 114-126, changing it
to “GDrive”. Apply the same change in
kits/ai-ecommerce-cart-recovery-agent/flows/gsheet.ts lines 114-126, changing
the value to “GSheet”.
In `@kits/ai-ecommerce-cart-recovery-agent/flows/postgres.ts`:
- Around line 283-303: Remove the hardcoded webhookURL from the IndexNode_824
configuration, including any dependent debug-only behavior, so the production
flow cannot send indexed vectors or metadata to the public webhook.site
endpoint. Preserve the remaining indexing settings such as primaryKeys,
vectorsField, metadataField, and duplicateOperation.
In `@kits/ai-ecommerce-cart-recovery-agent/flows/scraping-indexation.ts`:
- Around line 126-130: Update the testInput.urls sample in the
scraping-indexation flow to use a representative e-commerce store or
documentation URL relevant to the cart-recovery kit, replacing the unrelated
third-party site. Keep the existing input structure unchanged.
- Around line 418-429: Update the Index configuration’s primaryKeys and
duplicateOperation so chunk records use a unique, stable key derived from the
page identity and chunk identity rather than the repeated title, and preserve
all chunks instead of overwriting collisions. Align the change with the metadata
generated by scraping-indexation_transform-metadata.ts and keep vectorsField and
metadataField unchanged.
- Around line 8-10: Replace the phantom “Knowledge Chatbot” references in the
scraping-indexation documentation, including the descriptions near the flow
overview and downstream references, with the actual consumer flow symbol
`flows/cart-recovery.ts`; preserve the existing ingestion and vector-store
behavior descriptions.
In `@kits/ai-ecommerce-cart-recovery-agent/lamatic.config.ts`:
- Around line 49-51: Update links.github in lamatic.config.ts to reference the
ai-ecommerce-cart-recovery-agent kit path instead of sample-chatbot. Also update
the canonical repository link in agent.md to use the same kit-specific path;
apply both listed locations consistently.
- Around line 41-47: Align the mandatory step ID in the configuration with the
shipped flow by changing `knowledge-chatbot` to `cart-recovery`, ensuring it
matches `flows/cart-recovery.ts` and the kebab-case naming contract. Update any
dependent documentation or references to use `cart-recovery`.
In `@kits/ai-ecommerce-cart-recovery-agent/prompts/cart-recovery-system.md`:
- Around line 7-11: Update the system instructions around “Recommend discounts
only if necessary” to prohibit invented coupons and require using only supplied,
approved eligibility and discount-limit data. Also update the user prompt at
kits/ai-ecommerce-cart-recovery-agent/prompts/cart-recovery-user.md lines 21-24
to request coupons exclusively from the approved offer data passed to the model.
In `@kits/ai-ecommerce-cart-recovery-agent/prompts/cart-recovery-user.md`:
- Around line 4-5: Remove the unused Customer Email field and its
{{customer_email}} interpolation from the cart recovery prompt. Retain customer
email only if a downstream action explicitly requires it, and document that
data-handling purpose within the prompt.
In `@kits/ai-ecommerce-cart-recovery-agent/README.md`:
- Line 70: Restore exactly one trailing newline at the end of README.md after
the “Generated on 11/11/2025” line, without changing any other content.
- Around line 1-7: Move the cart-recovery kit’s top-level heading above the HTML
deployment badge in the README, ensuring the heading is the first document
content so markdownlint recognizes it.
- Around line 7-19: Replace the copied Knowledge Chatbot documentation with Cart
Recovery Agent-specific content. In
kits/ai-ecommerce-cart-recovery-agent/README.md lines 7-19, describe
cart-recovery behavior, all eight configured data-source options, and the actual
TypeScript/Markdown files present. In agent.md lines 1-13, update the identity
and capabilities to cart recovery; in agent.md lines 107-110, reference
cart-recovery-system.md and cart-recovery-user.md.
In
`@kits/ai-ecommerce-cart-recovery-agent/scripts/crawling-indexation_extract-chunks.ts`:
- Around line 1-5: Replace the top-level return with the kit’s output assignment
convention in crawling-indexation_extract-chunks.ts lines 1-5 and
scraping-indexation_extract-chunks.ts lines 1-5: assign outputDocs to output
after mapping the documents, preserving the existing extraction logic.
In
`@kits/ai-ecommerce-cart-recovery-agent/scripts/crawling-indexation_transform-metadata.ts`:
- Around line 1-3: Update the initialization and processing flow around vectors,
metadataProps, and texts to validate that vectors and texts are non-null arrays
with matching, non-zero lengths before iterating. Reject or return an empty
result for invalid or empty inputs, and preserve index alignment so each emitted
content value corresponds to the embedding at the same index.
- Around line 5-12: Chunk records currently share the page title as their
overwrite key, so add a per-chunk unique chunk_id derived from source and idx in
kits/ai-ecommerce-cart-recovery-agent/scripts/crawling-indexation_transform-metadata.ts
lines 5-12 and
kits/ai-ecommerce-cart-recovery-agent/scripts/scraping-indexation_transform-metadata.ts
lines 1-14. Update the primaryKeys configuration from title to chunk_id in
kits/ai-ecommerce-cart-recovery-agent/flows/crawling-indexation.ts lines 419-430
and kits/ai-ecommerce-cart-recovery-agent/flows/scraping-indexation.ts lines
418-429, preserving overwrite behavior for genuinely identical chunk IDs.
In `@kits/ai-ecommerce-cart-recovery-agent/scripts/gsheet_transform-metadata.ts`:
- Around line 1-12: Update the metadata construction in the script to iterate
over every entry in vectors, creating one metadata record per vector. Preserve
the shared title and source fields, but assign each record’s content from the
corresponding element of codeNode_331.output rather than always using index 0,
so metadataProps and vectors remain aligned for batched rows.
In `@kits/ai-ecommerce-cart-recovery-agent/scripts/onedrive_get-chunks.ts`:
- Line 4: Remove the raw debug logging from both scripts: delete
console.log(outputDocs) in
kits/ai-ecommerce-cart-recovery-agent/scripts/onedrive_get-chunks.ts at line 4
and delete the console.log("finaldata:", ...) statement in
kits/ai-ecommerce-cart-recovery-agent/scripts/gsheet_transform-metadata.ts at
line 11. Preserve the document extraction and metadata transformation behavior
without logging customer content, metadata, or vectors.
In
`@kits/ai-ecommerce-cart-recovery-agent/scripts/onedrive_transform-metadata.ts`:
- Around line 1-15: Replace the for...in loop over vectors with an index-safe
array transformation such as map, preserving the vector/text pairing by using
each element’s index to read texts and construct the same metadata fields. Keep
the resulting metadataProps and output structure unchanged.
In `@kits/ai-ecommerce-cart-recovery-agent/scripts/postgres_row-chunking.ts`:
- Around line 1-7: Update the row-chunking script around objectToString and the
output assignment to process each Postgres row independently through a
length-capped text splitter, preserving row content while dividing oversized
serialized payloads into bounded chunks. Return the complete flattened array of
chunks to the Vectorize node instead of wrapping the entire trigger payload in a
single-element array.
In
`@kits/ai-ecommerce-cart-recovery-agent/scripts/postgres_transform-metadata.ts`:
- Line 11: Remove the leftover content-bearing debug logs from both connector
scripts: delete the console.log of finaldata in
kits/ai-ecommerce-cart-recovery-agent/scripts/postgres_transform-metadata.ts at
lines 11-11 and delete the console.log of outputDocs in
kits/ai-ecommerce-cart-recovery-agent/scripts/s3_get-chunks.ts at lines 4-4,
leaving the surrounding transformation and chunk-processing logic unchanged.
- Around line 4-9: Update the metadata construction flow to iterate over every
vector produced by the upstream chunking output, creating and pushing one
metadata object per vector instead of a single shared object with content index
[0]. Preserve the shared title and source values while assigning each metadata
entry the corresponding vector content, following the per-vector pattern in
onedrive_transform-metadata.ts.
In `@kits/ai-ecommerce-cart-recovery-agent/scripts/s3_extract-text.ts`:
- Line 1: Guard the extraction result before assigning output: validate that the
files collection contains an item and that its data collection contains a value,
and skip the current item when either is empty. Preserve the existing output
assignment for non-empty results so indexation continues without throwing.
In `@kits/ai-ecommerce-cart-recovery-agent/scripts/sharepoint_get-chunks.ts`:
- Line 4: Remove the debug console.log(outputDocs) statement from the SharePoint
chunk-processing flow so document contents are not emitted to runtime logs;
leave the outputDocs processing behavior unchanged.
In
`@kits/ai-ecommerce-cart-recovery-agent/scripts/sharepoint_transform-metadata.ts`:
- Around line 5-13: Update the metadata-building loop around vectors to validate
that texts and vectors have equal lengths before pairing, and add a stable
per-chunk identifier to each metadata object rather than relying only on title,
source, and last_modified. Ensure the identifier is unique and deterministic for
each chunk so downstream title-keyed overwrite handling in sharepoint flows does
not collapse chunks.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI (base), Organization UI (inherited)
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 9403ec17-774e-4a0a-b550-a4c51bd7576c
📒 Files selected for processing (37)
.gitignorekits/ai-ecommerce-cart-recovery-agent/.env.examplekits/ai-ecommerce-cart-recovery-agent/.gitignorekits/ai-ecommerce-cart-recovery-agent/README.mdkits/ai-ecommerce-cart-recovery-agent/agent.mdkits/ai-ecommerce-cart-recovery-agent/constitutions/default.mdkits/ai-ecommerce-cart-recovery-agent/flows/cart-recovery.tskits/ai-ecommerce-cart-recovery-agent/flows/crawling-indexation.tskits/ai-ecommerce-cart-recovery-agent/flows/gdrive.tskits/ai-ecommerce-cart-recovery-agent/flows/gsheet.tskits/ai-ecommerce-cart-recovery-agent/flows/onedrive.tskits/ai-ecommerce-cart-recovery-agent/flows/postgres.tskits/ai-ecommerce-cart-recovery-agent/flows/s3.tskits/ai-ecommerce-cart-recovery-agent/flows/scraping-indexation.tskits/ai-ecommerce-cart-recovery-agent/flows/sharepoint.tskits/ai-ecommerce-cart-recovery-agent/lamatic.config.tskits/ai-ecommerce-cart-recovery-agent/model-configs/cart-recovery.tskits/ai-ecommerce-cart-recovery-agent/prompts/cart-recovery-system.mdkits/ai-ecommerce-cart-recovery-agent/prompts/cart-recovery-user.mdkits/ai-ecommerce-cart-recovery-agent/scripts/crawling-indexation_extract-chunks.tskits/ai-ecommerce-cart-recovery-agent/scripts/crawling-indexation_transform-metadata.tskits/ai-ecommerce-cart-recovery-agent/scripts/gdrive_extract-chunked-text.tskits/ai-ecommerce-cart-recovery-agent/scripts/gdrive_transform-metadata.tskits/ai-ecommerce-cart-recovery-agent/scripts/gsheet_row-chunking.tskits/ai-ecommerce-cart-recovery-agent/scripts/gsheet_transform-metadata.tskits/ai-ecommerce-cart-recovery-agent/scripts/onedrive_get-chunks.tskits/ai-ecommerce-cart-recovery-agent/scripts/onedrive_transform-metadata.tskits/ai-ecommerce-cart-recovery-agent/scripts/postgres_row-chunking.tskits/ai-ecommerce-cart-recovery-agent/scripts/postgres_transform-metadata.tskits/ai-ecommerce-cart-recovery-agent/scripts/s3_extract-text.tskits/ai-ecommerce-cart-recovery-agent/scripts/s3_get-chunks.tskits/ai-ecommerce-cart-recovery-agent/scripts/s3_transform-metadata.tskits/ai-ecommerce-cart-recovery-agent/scripts/scraping-indexation_extract-chunks.tskits/ai-ecommerce-cart-recovery-agent/scripts/scraping-indexation_transform-metadata.tskits/ai-ecommerce-cart-recovery-agent/scripts/sharepoint_get-chunks.tskits/ai-ecommerce-cart-recovery-agent/scripts/sharepoint_transform-metadata.tskits/ai-ecommerce-cart-recovery-agent/triggers/widgets/cart-recovery-chat-widget.ts
| * The outcome of the flow is a populated or updated knowledge base derived from web pages. That matters because the chatbot flow in this kit depends on a searchable vector index rather than raw URLs. Without this indexing step, website content remains inaccessible to retrieval and cannot be grounded into answers during runtime. | ||
| * | ||
| * Within the broader bundle, this is an entry-point ingestion flow in the indexation stage of the pipeline. In the overall plan-retrieve-synthesize pattern described by the parent agent, this flow sits firmly in the preparation and retrieval-enablement layer: it does not answer user questions itself, but produces the vectorized corpus that the downstream `Knowledge Chatbot` flow queries when synthesizing grounded responses. |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Your mission, should you choose to accept it: rename the phantom flow. The docs repeatedly name a downstream Knowledge Chatbot flow (Lines 8, 10, 24, 59, 123, 127), but this kit ships flows/cart-recovery.ts. Operators following this briefing will hunt for a flow that does not exist in this bundle.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@kits/ai-ecommerce-cart-recovery-agent/flows/crawling-indexation.ts` around
lines 8 - 10, Update the references to the downstream “Knowledge Chatbot” flow
in the crawling-indexation documentation to use the actual shipped flow symbol,
cart-recovery.ts, so operators can locate it within this kit. Preserve the
existing ingestion and retrieval-stage descriptions.
|
Hi @akshatvirmani, I’ve addressed the requested improvements and pushed the fixes in the latest commit. The structural validation is passing, and I’ve also addressed the CodeRabbit findings. Please review when convenient. Thank you! |
There was a problem hiding this comment.
Actionable comments posted: 7
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (6)
kits/ai-ecommerce-cart-recovery-agent/flows/crawling-indexation.ts (2)
131-131: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick winKeep both flow documents aligned with the new
chunk_idcontract.The runtime now indexes by
chunk_id, but both notes still describetitleas the overwrite key.
kits/ai-ecommerce-cart-recovery-agent/flows/crawling-indexation.ts#L131-L131: describechunk_id, nottitle, as the primary key.kits/ai-ecommerce-cart-recovery-agent/flows/scraping-indexation.ts#L114-L114: update the same stale primary-key statement.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@kits/ai-ecommerce-cart-recovery-agent/flows/crawling-indexation.ts` at line 131, The flow documentation still identifies title as the overwrite primary key; update the corresponding statements in kits/ai-ecommerce-cart-recovery-agent/flows/crawling-indexation.ts lines 131-131 and kits/ai-ecommerce-cart-recovery-agent/flows/scraping-indexation.ts lines 114-114 to describe chunk_id as the primary key, while preserving the surrounding duplicate-handling guidance.
243-277: 🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy liftMission control: align Firecrawl mode with the batch URL input.
syncBatchScrapeis the sibling flow setting for{{triggerNode_1.output.urls}};syncis a singular-seed crawl mode. Keep the crawl as a single seed by droppingurls, or changemode/trigger docs to batch scrape withurlsand nourlseed.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@kits/ai-ecommerce-cart-recovery-agent/flows/crawling-indexation.ts` around lines 243 - 277, The Firecrawl configuration uses singular crawl mode with a batch URL input, so align the fields in the node values. Preserve single-seed crawling by removing the urls binding and retaining url with mode sync, or consistently switch to batch scraping by removing url and updating mode and trigger documentation.kits/ai-ecommerce-cart-recovery-agent/flows/scraping-indexation.ts (1)
243-277: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winRemove crawl-only options from batch scraping.
Batch-scrape targets the
urlslist, so discovery fields likecrawlDepth,crawlLimit,sitemapOnly,crawlSubPages,maxDiscoveryDepth, andignoreSitemapare inappropriate here. Either switch this node to Firecrawl crawl mode if discovery is intended, or drop those options to keep the scrape flow configuration aligned with its documented behavior.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@kits/ai-ecommerce-cart-recovery-agent/flows/scraping-indexation.ts` around lines 243 - 277, Remove the crawl-only options from the Firecrawl node configured with mode "syncBatchScrape", including crawlDepth, crawlLimit, sitemapOnly, crawlSubPages, maxDiscoveryDepth, and ignoreSitemap; retain the batch scrape mode and its urls-based configuration unchanged.kits/ai-ecommerce-cart-recovery-agent/scripts/postgres_row-chunking.ts (1)
1-4: 🔒 Security & Privacy | 🟠 Major | 🏗️ Heavy liftMission: do not index every database column by default.
Object.entries(obj)serializes all row fields before embedding. For ecommerce data, this can propagate customer PII, secrets, and internal fields to the model provider and vector database. Require an explicit allowlist of indexable columns and redact sensitive fields before serialization.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@kits/ai-ecommerce-cart-recovery-agent/scripts/postgres_row-chunking.ts` around lines 1 - 4, Update objectToString to accept and enforce an explicit allowlist of indexable column names, serializing only allowed fields and excluding sensitive values before embedding or storage; do not default to Object.entries(obj) over the entire database row.kits/ai-ecommerce-cart-recovery-agent/flows/gdrive.ts (1)
3-10: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick winMission: align the flow guides with the Cart Recovery Agent kit. These copied descriptions direct operators to a “Knowledge Chatbot” bundle and flow, which is not the kit introduced by this PR.
kits/ai-ecommerce-cart-recovery-agent/flows/gdrive.ts#L3-L10: replace Knowledge Chatbot references with the actual cart-recovery runtime and retrieval contract.kits/ai-ecommerce-cart-recovery-agent/flows/gsheet.ts#L3-L10: replace Knowledge Chatbot references with the actual cart-recovery runtime and retrieval contract.kits/ai-ecommerce-cart-recovery-agent/flows/sharepoint.ts#L3-L10: replace Knowledge Chatbot references with the actual cart-recovery runtime and retrieval contract.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@kits/ai-ecommerce-cart-recovery-agent/flows/gdrive.ts` around lines 3 - 10, Replace the copied Knowledge Chatbot descriptions with documentation for the cart-recovery runtime and its retrieval contract in the flow guides at kits/ai-ecommerce-cart-recovery-agent/flows/gdrive.ts lines 3-10, kits/ai-ecommerce-cart-recovery-agent/flows/gsheet.ts lines 3-10, and kits/ai-ecommerce-cart-recovery-agent/flows/sharepoint.ts lines 3-10. Update the purpose, pipeline, and downstream flow references so operators are directed to the actual Cart Recovery Agent kit rather than the unrelated Knowledge Chatbot bundle.kits/ai-ecommerce-cart-recovery-agent/flows/cart-recovery.ts (1)
194-221: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick winMission: wire the RAG node’s deployment selections.
RAGNode_711declaresvectorDB,embeddingModelName, andgenerativeModelNameas required private inputs, but the node values still pass@model-configs/cart-recovery.tsfor the models and omitvectorDBentirely.model-configs/cart-recovery.tsonly exports blank model names, so the flow won’t use deployment workspace selections. Bind these fields to{{RAGNode_711.input.*}}or remove the duplicated inputs and keep model-config as the single source.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@kits/ai-ecommerce-cart-recovery-agent/flows/cart-recovery.ts` around lines 194 - 221, Update the RAG node values in the flow configuration to correctly wire its required private deployment inputs: provide vectorDB and bind embeddingModelName and generativeModelName to the corresponding RAGNode_711.input fields instead of the model-config reference. Alternatively, remove these duplicated inputs and consistently use model-config as the single source, ensuring deployment workspace selections are preserved.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@kits/ai-ecommerce-cart-recovery-agent/flows/cart-recovery.ts`:
- Around line 125-141: Make approved_offer and discount_limit private,
server-controlled inputs rather than public chat-widget parameters. Update their
configuration in the flow definition and ensure the RAG prompt receives only
values loaded or validated from a trusted backend, preserving blank/default
behavior when no authorized offer exists.
In `@kits/ai-ecommerce-cart-recovery-agent/flows/gdrive.ts`:
- Around line 330-335: Update the IndexNode_343 and corresponding index
configuration near the later duplicate block so primaryKeys include a stable
per-chunk identity in addition to title, preventing overwrite collisions between
chunks. In gdrive_transform-metadata.ts, emit that same deterministic chunk key
for every metadata entry, using the existing chunk index or content-hash
approach consistently between indexing and metadata generation.
In `@kits/ai-ecommerce-cart-recovery-agent/prompts/cart-recovery-system.md`:
- Around line 7-26: Update the cart-recovery system prompt to explicitly treat
retrieved business context, customer-provided content, and customer questions as
untrusted data rather than instructions. State that instruction-like directives
in those inputs must not override this prompt’s grounding, offer-eligibility,
discount-limit, or anti-invention rules, while preserving the existing response
requirements.
In `@kits/ai-ecommerce-cart-recovery-agent/README.md`:
- Around line 13-19: Normalize the corrupted workflow arrows in
kits/ai-ecommerce-cart-recovery-agent/README.md lines 13-19 by replacing all
three mojibake sequences with valid UTF-8 arrows or ASCII markers. Apply the
same documentation-only correction to all seven architecture arrows in
kits/ai-ecommerce-cart-recovery-agent/agent.md lines 60-74, preserving the
diagram structure.
In
`@kits/ai-ecommerce-cart-recovery-agent/scripts/crawling-indexation_transform-metadata.ts`:
- Around line 9-27: Reject invalid vector/text inputs before metadata
construction in crawling-indexation_transform-metadata.ts (lines 9-27),
scraping-indexation_transform-metadata.ts (lines 9-27), and
sharepoint_transform-metadata.ts (lines 9-22): throw when either value is not an
array or their lengths differ, and return matching empty vectors and metadata
arrays only for genuine empty input. Preserve metadata generation for valid
equal-length inputs and ensure invalid cases never emit the original vectors.
In `@kits/ai-ecommerce-cart-recovery-agent/scripts/gsheet_transform-metadata.ts`:
- Around line 1-4: Update the template bindings at the top of the script to
reference the node IDs defined in flows/gsheet.ts: use vectorizeNode_177 for
vectors and variablesNode_305 for title and source. Replace the unresolved
codeNode_331 binding with the appropriate existing text-output node from the
flow, preserving the script’s expected vectors, texts, title, and source inputs.
In `@kits/ai-ecommerce-cart-recovery-agent/scripts/s3_extract-text.ts`:
- Around line 10-12: Update the fallback assignment in the S3 extraction flow to
use an empty string instead of null when content is missing, ensuring output
passed as chunkField remains compatible with downstream chunking behavior.
---
Outside diff comments:
In `@kits/ai-ecommerce-cart-recovery-agent/flows/cart-recovery.ts`:
- Around line 194-221: Update the RAG node values in the flow configuration to
correctly wire its required private deployment inputs: provide vectorDB and bind
embeddingModelName and generativeModelName to the corresponding
RAGNode_711.input fields instead of the model-config reference. Alternatively,
remove these duplicated inputs and consistently use model-config as the single
source, ensuring deployment workspace selections are preserved.
In `@kits/ai-ecommerce-cart-recovery-agent/flows/crawling-indexation.ts`:
- Line 131: The flow documentation still identifies title as the overwrite
primary key; update the corresponding statements in
kits/ai-ecommerce-cart-recovery-agent/flows/crawling-indexation.ts lines 131-131
and kits/ai-ecommerce-cart-recovery-agent/flows/scraping-indexation.ts lines
114-114 to describe chunk_id as the primary key, while preserving the
surrounding duplicate-handling guidance.
- Around line 243-277: The Firecrawl configuration uses singular crawl mode with
a batch URL input, so align the fields in the node values. Preserve single-seed
crawling by removing the urls binding and retaining url with mode sync, or
consistently switch to batch scraping by removing url and updating mode and
trigger documentation.
In `@kits/ai-ecommerce-cart-recovery-agent/flows/gdrive.ts`:
- Around line 3-10: Replace the copied Knowledge Chatbot descriptions with
documentation for the cart-recovery runtime and its retrieval contract in the
flow guides at kits/ai-ecommerce-cart-recovery-agent/flows/gdrive.ts lines 3-10,
kits/ai-ecommerce-cart-recovery-agent/flows/gsheet.ts lines 3-10, and
kits/ai-ecommerce-cart-recovery-agent/flows/sharepoint.ts lines 3-10. Update the
purpose, pipeline, and downstream flow references so operators are directed to
the actual Cart Recovery Agent kit rather than the unrelated Knowledge Chatbot
bundle.
In `@kits/ai-ecommerce-cart-recovery-agent/flows/scraping-indexation.ts`:
- Around line 243-277: Remove the crawl-only options from the Firecrawl node
configured with mode "syncBatchScrape", including crawlDepth, crawlLimit,
sitemapOnly, crawlSubPages, maxDiscoveryDepth, and ignoreSitemap; retain the
batch scrape mode and its urls-based configuration unchanged.
In `@kits/ai-ecommerce-cart-recovery-agent/scripts/postgres_row-chunking.ts`:
- Around line 1-4: Update objectToString to accept and enforce an explicit
allowlist of indexable column names, serializing only allowed fields and
excluding sensitive values before embedding or storage; do not default to
Object.entries(obj) over the entire database row.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI (base), Organization UI (inherited)
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 6fe1b435-6f0a-4e6b-b122-81f822e04603
📒 Files selected for processing (26)
kits/ai-ecommerce-cart-recovery-agent/README.mdkits/ai-ecommerce-cart-recovery-agent/agent.mdkits/ai-ecommerce-cart-recovery-agent/flows/cart-recovery.tskits/ai-ecommerce-cart-recovery-agent/flows/crawling-indexation.tskits/ai-ecommerce-cart-recovery-agent/flows/gdrive.tskits/ai-ecommerce-cart-recovery-agent/flows/gsheet.tskits/ai-ecommerce-cart-recovery-agent/flows/postgres.tskits/ai-ecommerce-cart-recovery-agent/flows/scraping-indexation.tskits/ai-ecommerce-cart-recovery-agent/flows/sharepoint.tskits/ai-ecommerce-cart-recovery-agent/lamatic.config.tskits/ai-ecommerce-cart-recovery-agent/prompts/cart-recovery-system.mdkits/ai-ecommerce-cart-recovery-agent/prompts/cart-recovery-user.mdkits/ai-ecommerce-cart-recovery-agent/scripts/crawling-indexation_extract-chunks.tskits/ai-ecommerce-cart-recovery-agent/scripts/crawling-indexation_transform-metadata.tskits/ai-ecommerce-cart-recovery-agent/scripts/gsheet_transform-metadata.tskits/ai-ecommerce-cart-recovery-agent/scripts/onedrive_get-chunks.tskits/ai-ecommerce-cart-recovery-agent/scripts/onedrive_transform-metadata.tskits/ai-ecommerce-cart-recovery-agent/scripts/postgres_row-chunking.tskits/ai-ecommerce-cart-recovery-agent/scripts/postgres_transform-metadata.tskits/ai-ecommerce-cart-recovery-agent/scripts/s3_extract-text.tskits/ai-ecommerce-cart-recovery-agent/scripts/s3_get-chunks.tskits/ai-ecommerce-cart-recovery-agent/scripts/scraping-indexation_extract-chunks.tskits/ai-ecommerce-cart-recovery-agent/scripts/scraping-indexation_transform-metadata.tskits/ai-ecommerce-cart-recovery-agent/scripts/sharepoint_get-chunks.tskits/ai-ecommerce-cart-recovery-agent/scripts/sharepoint_transform-metadata.tskits/ai-ecommerce-cart-recovery-agent/triggers/widgets/cart-recovery-chat-widget.ts
💤 Files with no reviewable changes (4)
- kits/ai-ecommerce-cart-recovery-agent/scripts/sharepoint_get-chunks.ts
- kits/ai-ecommerce-cart-recovery-agent/scripts/s3_get-chunks.ts
- kits/ai-ecommerce-cart-recovery-agent/scripts/onedrive_get-chunks.ts
- kits/ai-ecommerce-cart-recovery-agent/flows/postgres.ts
| let vectors = {{ vectorizeNode_919.output }}; | ||
| let texts = {{ codeNode_331.output }}; | ||
| let title = {{ variablesNode_849.output.title }}; | ||
| let source = {{ variablesNode_849.output.source }}; |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
Mission: repair the GSheet template bindings.
These node IDs do not exist in flows/gsheet.ts: the flow defines vectorizeNode_177 and variablesNode_305. The unresolved templates prevent the indexation script from receiving vectors, title, or source.
Proposed fix
-let vectors = {{ vectorizeNode_919.output }};
+let vectors = {{ vectorizeNode_177.output.vectors }};
let texts = {{ codeNode_331.output }};
-let title = {{ variablesNode_849.output.title }};
-let source = {{ variablesNode_849.output.source }};
+let title = {{ variablesNode_305.output.title }};
+let source = {{ variablesNode_305.output.source }};📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| let vectors = {{ vectorizeNode_919.output }}; | |
| let texts = {{ codeNode_331.output }}; | |
| let title = {{ variablesNode_849.output.title }}; | |
| let source = {{ variablesNode_849.output.source }}; | |
| let vectors = {{ vectorizeNode_177.output.vectors }}; | |
| let texts = {{ codeNode_331.output }}; | |
| let title = {{ variablesNode_305.output.title }}; | |
| let source = {{ variablesNode_305.output.source }}; |
🧰 Tools
🪛 Biome (2.5.3)
[error] 1-1: Expected a property, a shorthand property, a getter, a setter, or a method but instead found '{ vectorizeNode_919.output'.
(parse)
[error] 1-1: Expected a statement but instead found '}'.
(parse)
[error] 2-2: Expected a property, a shorthand property, a getter, a setter, or a method but instead found '{ codeNode_331.output'.
(parse)
[error] 2-2: Expected a statement but instead found '}'.
(parse)
[error] 3-3: Expected a property, a shorthand property, a getter, a setter, or a method but instead found '{ variablesNode_849.output.title'.
(parse)
[error] 3-3: Expected a statement but instead found '}'.
(parse)
[error] 4-4: Expected a property, a shorthand property, a getter, a setter, or a method but instead found '{ variablesNode_849.output.source'.
(parse)
[error] 4-4: Expected a statement but instead found '}'.
(parse)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@kits/ai-ecommerce-cart-recovery-agent/scripts/gsheet_transform-metadata.ts`
around lines 1 - 4, Update the template bindings at the top of the script to
reference the node IDs defined in flows/gsheet.ts: use vectorizeNode_177 for
vectors and variablesNode_305 for title and source. Replace the unresolved
codeNode_331 binding with the appropriate existing text-output node from the
flow, preserving the script’s expected vectors, texts, title, and source inputs.
|
@JoduVyshnavi17 the structural checks are not passing... https://github.com/Lamatic/AgentKit/actions/runs/30339916443 2 things to work on:
|
|
Hi @JoduVyshnavi17! 👋 Before this PR can be reviewed by maintainers, please resolve all comments and requested changes from the CodeRabbit automated review. Steps to follow:
This helps keep the review process efficient for everyone. Thank you! 🙏 |
There was a problem hiding this comment.
Actionable comments posted: 5
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
kits/ai-ecommerce-cart-recovery-agent/flows/gdrive.ts (1)
3-107: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick winUpdate the flow documentation to match the current configuration.
The documentation still describes a Knowledge Chatbot bundle, a hardcoded Drive source URL, a
titleprimary key, a trailing space inmeta.name, and an indexing webhook. The current flow is a Cart Recovery kit flow, useschunk_id, has an emptysourcevalue, usesGDrive, and has no webhook configuration.Update these statements before release. Incorrect setup guidance can cause operator misconfiguration.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@kits/ai-ecommerce-cart-recovery-agent/flows/gdrive.ts` around lines 3 - 107, Update the flow documentation to reflect the current Cart Recovery kit configuration: replace Knowledge Chatbot references with Cart Recovery, describe the metadata source as empty rather than a hardcoded Drive URL, document `chunk_id` instead of `title` as the primary key, use `GDrive` without a trailing space in the flow name, and remove all claims about an indexing webhook. Revise the affected Inputs, Outputs, Dependencies, Node Walkthrough, Error Scenarios, and Notes sections consistently.kits/ai-ecommerce-cart-recovery-agent/flows/cart-recovery.ts (1)
28-32: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winAlign the documented outputs with the actual flow output.
The flow returns only
RAGNode_711.output.modelResponse. It does not expose separate purchase probability, suggested discount, or next recommended action fields. Remove these claims or add explicit output mappings before publishing the kit.Minimal documentation fix
* - Recovery message - * - Purchase probability - * - Suggested discount - * - Next recommended action🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@kits/ai-ecommerce-cart-recovery-agent/flows/cart-recovery.ts` around lines 28 - 32, Update the Outputs documentation for the cart recovery flow to match the actual return value, which is only RAGNode_711.output.modelResponse. Remove the unsupported purchase probability, suggested discount, and next recommended action entries unless the flow explicitly adds mappings for those fields.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@kits/ai-ecommerce-cart-recovery-agent/prompts/cart-recovery-system.md`:
- Line 72: Add exactly one trailing newline after the final line of the
cart-recovery system prompt, without changing the existing content.
- Line 1: Remove the cosmetic “AI E-Commerce Cart Recovery Agent” Markdown
heading from the system prompt file, leaving the actual prompt instructions
unchanged and starting the content directly with those instructions.
- Around line 60-68: Update the cart-recovery system prompt rules around
approved offers and discount limits to explicitly prohibit exposing internal
discount limits, eligibility rules, authorization metadata, or other private
offer controls in customer-facing responses. Instruct the agent to use
approved_offer and discount_limit only to determine whether an approved offer
can be mentioned, without revealing the underlying control values or rules.
In
`@kits/ai-ecommerce-cart-recovery-agent/scripts/crawling-indexation_transform-metadata.ts`:
- Around line 8-27: Require a non-empty source before metadata mapping, then
derive each chunk_id solely from the validated source and chunk index: update
kits/ai-ecommerce-cart-recovery-agent/scripts/crawling-indexation_transform-metadata.ts#L8-L27
and
kits/ai-ecommerce-cart-recovery-agent/scripts/scraping-indexation_transform-metadata.ts#L9-L29
to remove title and literal fallbacks. In
kits/ai-ecommerce-cart-recovery-agent/flows/scraping-indexation.ts#L114-L114,
state that the flow rejects records without a stable source identifier.
In `@kits/ai-ecommerce-cart-recovery-agent/scripts/gdrive_transform-metadata.ts`:
- Around line 8-20: Update the validation in the metadata transformation flow
before the output assignment so invalid vectors/text payloads throw an error
instead of producing empty metadata. In the existing vectors/texts length-check
block, reject non-array inputs and mismatched lengths, preserving the current
metadata mapping only for valid paired payloads and ensuring output is assigned
only after validation succeeds.
---
Outside diff comments:
In `@kits/ai-ecommerce-cart-recovery-agent/flows/cart-recovery.ts`:
- Around line 28-32: Update the Outputs documentation for the cart recovery flow
to match the actual return value, which is only
RAGNode_711.output.modelResponse. Remove the unsupported purchase probability,
suggested discount, and next recommended action entries unless the flow
explicitly adds mappings for those fields.
In `@kits/ai-ecommerce-cart-recovery-agent/flows/gdrive.ts`:
- Around line 3-107: Update the flow documentation to reflect the current Cart
Recovery kit configuration: replace Knowledge Chatbot references with Cart
Recovery, describe the metadata source as empty rather than a hardcoded Drive
URL, document `chunk_id` instead of `title` as the primary key, use `GDrive`
without a trailing space in the flow name, and remove all claims about an
indexing webhook. Revise the affected Inputs, Outputs, Dependencies, Node
Walkthrough, Error Scenarios, and Notes sections consistently.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI (base), Organization UI (inherited)
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: a9edc535-da6e-4d74-9fdc-032f84fdf125
📒 Files selected for processing (10)
kits/ai-ecommerce-cart-recovery-agent/flows/cart-recovery.tskits/ai-ecommerce-cart-recovery-agent/flows/gdrive.tskits/ai-ecommerce-cart-recovery-agent/flows/scraping-indexation.tskits/ai-ecommerce-cart-recovery-agent/prompts/cart-recovery-system.mdkits/ai-ecommerce-cart-recovery-agent/scripts/crawling-indexation_transform-metadata.tskits/ai-ecommerce-cart-recovery-agent/scripts/gdrive_transform-metadata.tskits/ai-ecommerce-cart-recovery-agent/scripts/gsheet_transform-metadata.tskits/ai-ecommerce-cart-recovery-agent/scripts/s3_extract-text.tskits/ai-ecommerce-cart-recovery-agent/scripts/scraping-indexation_transform-metadata.tskits/ai-ecommerce-cart-recovery-agent/scripts/sharepoint_transform-metadata.ts
|
|
||
|
|
||
|
|
||
| Always optimize for customer trust and successful purchase completion. No newline at end of file |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Add the required trailing newline.
markdownlint-cli2 reports MD047 at Line 72. End the file with exactly one newline.
🧰 Tools
🪛 markdownlint-cli2 (0.23.1)
[warning] 72-72: Files should end with a single newline character
(MD047, single-trailing-newline)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@kits/ai-ecommerce-cart-recovery-agent/prompts/cart-recovery-system.md` at
line 72, Add exactly one trailing newline after the final line of the
cart-recovery system prompt, without changing the existing content.
Source: Linters/SAST tools
| if (!Array.isArray(vectors)) { | ||
| throw new Error("Expected vectors to be an array."); | ||
| } | ||
|
|
||
| if (!Array.isArray(texts)) { | ||
| throw new Error("Expected texts to be an array."); | ||
| } | ||
|
|
||
| if (vectors.length !== texts.length) { | ||
| throw new Error( | ||
| `Vector count (${vectors.length}) does not match text count (${texts.length}).` | ||
| ); | ||
| } | ||
|
|
||
| metadataProps = vectors.map((vector, idx) => ({ | ||
| title: title, | ||
| source: source, | ||
| content: texts[idx], | ||
| chunk_id: `${source || title || "gsheet"}-${idx}` | ||
| })); |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
Mission: Require a source-derived chunk key.
The title and literal fallbacks can generate identical chunk_id values for separate pages that lack metadata.url. The Index node overwrites duplicate keys, so one page can replace another page’s chunks. Reject a missing or empty source, then derive chunk_id only from the validated source and chunk index.
kits/ai-ecommerce-cart-recovery-agent/scripts/crawling-indexation_transform-metadata.ts#L8-L27: validatesourcebefore mapping metadata and remove thetitleand"gsheet"fallbacks.kits/ai-ecommerce-cart-recovery-agent/scripts/scraping-indexation_transform-metadata.ts#L9-L29: validatesourcebefore mapping metadata and remove thetitleand"scraping"fallbacks.kits/ai-ecommerce-cart-recovery-agent/flows/scraping-indexation.ts#L114-L114: state that the flow rejects records without a stable source identifier.
Proposed fix
+if (typeof source !== "string" || source.trim() === "") {
+ throw new Error("Expected each scraped page to have a unique source URL.");
+}
+
metadataProps = vectors.map((vector, idx) => ({
- chunk_id: `${source || title || "scraping"}-${idx}`
+ chunk_id: `${source.trim()}-${idx}`
}));📍 Affects 3 files
kits/ai-ecommerce-cart-recovery-agent/scripts/crawling-indexation_transform-metadata.ts#L8-L27(this comment)kits/ai-ecommerce-cart-recovery-agent/scripts/scraping-indexation_transform-metadata.ts#L9-L29kits/ai-ecommerce-cart-recovery-agent/flows/scraping-indexation.ts#L114-L114
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In
`@kits/ai-ecommerce-cart-recovery-agent/scripts/crawling-indexation_transform-metadata.ts`
around lines 8 - 27, Require a non-empty source before metadata mapping, then
derive each chunk_id solely from the validated source and chunk index: update
kits/ai-ecommerce-cart-recovery-agent/scripts/crawling-indexation_transform-metadata.ts#L8-L27
and
kits/ai-ecommerce-cart-recovery-agent/scripts/scraping-indexation_transform-metadata.ts#L9-L29
to remove title and literal fallbacks. In
kits/ai-ecommerce-cart-recovery-agent/flows/scraping-indexation.ts#L114-L114,
state that the flow rejects records without a stable source identifier.
|
@JoduVyshnavi17 |
|
@coderabbitai review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
Actionable comments posted: 5
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (3)
kits/ai-ecommerce-cart-recovery-agent/flows/gdrive.ts (1)
327-333: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick winMission failed: stale chunk records can persist.
This flow uses
incremental_append, generateschunk_idfrom${source}-${idx}, and writes byprimaryKeys: ["chunk_id"]withduplicateOperation: "overwrite". No delete/reconciliation action is configured for the index node. If a changed document is rewritten with fewer chunks or shifts chunk indexes, olderchunk_idrecords can remain in the vector database. Add stale-chunk cleanup or use a rebuild approach for this incrementally synced index.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@kits/ai-ecommerce-cart-recovery-agent/flows/gdrive.ts` around lines 327 - 333, Update the index configuration around the vector database write using primary key “chunk_id” to prevent stale chunks from remaining after documents shrink or chunk positions change. Add the flow’s supported delete/reconciliation step for removed chunk IDs, or replace the incremental_append strategy with a rebuild approach that fully replaces the index on each sync.kits/ai-ecommerce-cart-recovery-agent/flows/gsheet.ts (1)
84-85: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick winYour mission, should you choose to accept it: correct the index-key documentation.
The documentation says that
titleandcontentare primary keys. Lines 305-310 configurechunk_idas the only primary key. Update the walkthrough, error scenario, and notes to describechunk_id.Also applies to: 97-97, 105-105
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@kits/ai-ecommerce-cart-recovery-agent/flows/gsheet.ts` around lines 84 - 85, Update the walkthrough documentation, error scenario, and notes around the Index to DB flow to identify chunk_id as the sole primary key instead of title and content. Keep the duplicateOperation overwrite behavior description accurate for records matching chunk_id, including all referenced documentation sections.kits/ai-ecommerce-cart-recovery-agent/flows/crawling-indexation.ts (1)
424-429: 🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy liftYour mission, should you choose to accept it: reconcile chunks removed from a source.
overwriteupdates only chunk IDs emitted in the current run. If a page becomes shorter, changes chunk boundaries, or disappears from a successful ingest scope, prior chunks are never sent toIndexand remain searchable.Add a successful-run reconciliation process. Mark current records by ingest generation, then remove records absent from the completed source scope. Do not remove existing records before the ingest scope completes successfully.
kits/ai-ecommerce-cart-recovery-agent/flows/crawling-indexation.ts#L424-L429: add source-scoped stale-record reconciliation around theIndexwrite.kits/ai-ecommerce-cart-recovery-agent/flows/scraping-indexation.ts#L425-L430: add the same reconciliation behavior for batch-scraped sources.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@kits/ai-ecommerce-cart-recovery-agent/flows/crawling-indexation.ts` around lines 424 - 429, The Index writes in kits/ai-ecommerce-cart-recovery-agent/flows/crawling-indexation.ts lines 424-429 and kits/ai-ecommerce-cart-recovery-agent/flows/scraping-indexation.ts lines 425-430 need source-scoped stale-record reconciliation. In both flows, mark emitted records with the current ingest generation, complete the source ingest successfully, then remove records in that source scope whose generation is absent from the completed run; never delete existing records before successful scope completion. Apply the same behavior around each flow’s Index operation while preserving the existing overwrite configuration.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@kits/ai-ecommerce-cart-recovery-agent/flows/gdrive.ts`:
- Line 80: Update the `Index to DB` (`IndexNode`) documentation to identify
`chunk_id` as the configured primary key, matching `IndexNode_343` and the
metadata output. Revise the duplicate-handling text to state that records with
the same `chunk_id` are overwritten rather than duplicated.
In `@kits/ai-ecommerce-cart-recovery-agent/flows/gsheet.ts`:
- Around line 305-307: Update the Google Sheets row-processing flow and
scripts/gsheet_transform-metadata.ts to preserve each row’s stable identity
through chunking and metadata transformation instead of relying on the
batch-local array index. Ensure the metadata source includes the spreadsheet ID,
sheet name, and row identifier, and build chunk_id from those values plus the
chunk index so incremental_append batches cannot collide.
In `@kits/ai-ecommerce-cart-recovery-agent/README.md`:
- Around line 15-23: Add the text language label to the fenced code blocks
containing the diagrams near the documented cart recovery flow and the
corresponding diagram later in the README, while preserving their existing
diagram content.
- Line 176: Restore the missing final newline in
kits/ai-ecommerce-cart-recovery-agent/README.md at lines 176-176 and
kits/ai-ecommerce-cart-recovery-agent/prompts/cart-recovery-user.md at lines
39-39, ensuring each Markdown file ends with exactly one newline.
In `@kits/ai-ecommerce-cart-recovery-agent/scripts/gdrive_transform-metadata.ts`:
- Around line 10-15: Update chunk_id generation in
kits/ai-ecommerce-cart-recovery-agent/scripts/gdrive_transform-metadata.ts lines
10-15 to prioritize the stable document identity, then fall back to title or
source without allowing shared source values to be the primary key. Apply the
corresponding change in
kits/ai-ecommerce-cart-recovery-agent/scripts/onedrive_transform-metadata.ts
lines 21-27 so its per-document title identity is used before source, preventing
chunks from keying only on “onedrive” or a shared URL.
---
Outside diff comments:
In `@kits/ai-ecommerce-cart-recovery-agent/flows/crawling-indexation.ts`:
- Around line 424-429: The Index writes in
kits/ai-ecommerce-cart-recovery-agent/flows/crawling-indexation.ts lines 424-429
and kits/ai-ecommerce-cart-recovery-agent/flows/scraping-indexation.ts lines
425-430 need source-scoped stale-record reconciliation. In both flows, mark
emitted records with the current ingest generation, complete the source ingest
successfully, then remove records in that source scope whose generation is
absent from the completed run; never delete existing records before successful
scope completion. Apply the same behavior around each flow’s Index operation
while preserving the existing overwrite configuration.
In `@kits/ai-ecommerce-cart-recovery-agent/flows/gdrive.ts`:
- Around line 327-333: Update the index configuration around the vector database
write using primary key “chunk_id” to prevent stale chunks from remaining after
documents shrink or chunk positions change. Add the flow’s supported
delete/reconciliation step for removed chunk IDs, or replace the
incremental_append strategy with a rebuild approach that fully replaces the
index on each sync.
In `@kits/ai-ecommerce-cart-recovery-agent/flows/gsheet.ts`:
- Around line 84-85: Update the walkthrough documentation, error scenario, and
notes around the Index to DB flow to identify chunk_id as the sole primary key
instead of title and content. Keep the duplicateOperation overwrite behavior
description accurate for records matching chunk_id, including all referenced
documentation sections.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI (base), Organization UI (inherited)
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: ad32d3e7-cfc8-4bda-91bb-d4c851a0efac
📒 Files selected for processing (14)
kits/ai-ecommerce-cart-recovery-agent/README.mdkits/ai-ecommerce-cart-recovery-agent/agent.mdkits/ai-ecommerce-cart-recovery-agent/flows/crawling-indexation.tskits/ai-ecommerce-cart-recovery-agent/flows/gdrive.tskits/ai-ecommerce-cart-recovery-agent/flows/gsheet.tskits/ai-ecommerce-cart-recovery-agent/flows/scraping-indexation.tskits/ai-ecommerce-cart-recovery-agent/prompts/cart-recovery-system.mdkits/ai-ecommerce-cart-recovery-agent/prompts/cart-recovery-user.mdkits/ai-ecommerce-cart-recovery-agent/scripts/crawling-indexation_transform-metadata.tskits/ai-ecommerce-cart-recovery-agent/scripts/gdrive_transform-metadata.tskits/ai-ecommerce-cart-recovery-agent/scripts/onedrive_transform-metadata.tskits/ai-ecommerce-cart-recovery-agent/scripts/postgres_transform-metadata.tskits/ai-ecommerce-cart-recovery-agent/scripts/scraping-indexation_transform-metadata.tskits/ai-ecommerce-cart-recovery-agent/scripts/sharepoint_transform-metadata.ts
| "primaryKeys": [ | ||
| "chunk_id" | ||
| ], |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift
Your mission, should you choose to accept it: make each Google Sheets row identity stable.
Line 355 assigns the same spreadsheet URL to every row. scripts/gsheet_transform-metadata.ts builds chunk_id from that source and a local array index. The index restarts for each incremental_append batch, so a later row can overwrite an unrelated earlier row.
Carry a stable row identifier through row chunking and metadata transformation. Build chunk_id from spreadsheet ID, sheet name, row identity, and chunk index.
Also applies to: 355-355
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@kits/ai-ecommerce-cart-recovery-agent/flows/gsheet.ts` around lines 305 -
307, Update the Google Sheets row-processing flow and
scripts/gsheet_transform-metadata.ts to preserve each row’s stable identity
through chunking and metadata transformation instead of relying on the
batch-local array index. Ensure the metadata source includes the spreadsheet ID,
sheet name, and row identifier, and build chunk_id from those values plus the
chunk index so incremental_append batches cannot collide.
| ``` | ||
| Customer Cart / Chat Input | ||
| ↓ | ||
| Cart Recovery RAG Flow | ||
| ↓ | ||
| Retrieve Relevant Business Knowledge | ||
| ↓ | ||
| Generate Personalized Recovery Response | ||
| ``` |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Mission check: label both documentation fences.
markdownlint-cli2 reports MD040 at Line 15 and Line 69. Add text to both fenced diagrams. This preserves the diagrams and satisfies the Markdown lint rule.
Also applies to: 69-82
🧰 Tools
🪛 markdownlint-cli2 (0.23.1)
[warning] 15-15: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@kits/ai-ecommerce-cart-recovery-agent/README.md` around lines 15 - 23, Add
the text language label to the fenced code blocks containing the diagrams near
the documented cart recovery flow and the corresponding diagram later in the
README, while preserving their existing diagram content.
Source: Linters/SAST tools
|
|
||
| --- | ||
|
|
||
| *AI E-Commerce Cart Recovery Agent for Lamatic AgentKit* No newline at end of file |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Restore the final newline in both Markdown files.
markdownlint-cli2 reports MD047 for both files. End each file with exactly one newline.
kits/ai-ecommerce-cart-recovery-agent/README.md#L176-L176: append exactly one final newline.kits/ai-ecommerce-cart-recovery-agent/prompts/cart-recovery-user.md#L39-L39: append exactly one final newline.
🧰 Tools
🪛 markdownlint-cli2 (0.23.1)
[warning] 176-176: Files should end with a single newline character
(MD047, single-trailing-newline)
📍 Affects 2 files
kits/ai-ecommerce-cart-recovery-agent/README.md#L176-L176(this comment)kits/ai-ecommerce-cart-recovery-agent/prompts/cart-recovery-user.md#L39-L39
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@kits/ai-ecommerce-cart-recovery-agent/README.md` at line 176, Restore the
missing final newline in kits/ai-ecommerce-cart-recovery-agent/README.md at
lines 176-176 and
kits/ai-ecommerce-cart-recovery-agent/prompts/cart-recovery-user.md at lines
39-39, ensuring each Markdown file ends with exactly one newline.
Source: Linters/SAST tools
| let metadataProps = vectors.map((vector, idx) => ({ | ||
| title: title, | ||
| content: texts[idx], | ||
| source: source, | ||
| chunk_id: `${source || title || "gdrive"}-${idx}` | ||
| })); |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "== locate relevant files =="
git ls-files | rg 'kits/ai-ecommerce-cart-recovery-agent/(scripts|flows)/|chunk_id|metadataProps|vector:'
echo
echo "== target script excerpts =="
for f in \
"kits/ai-ecommerce-cart-recovery-agent/scripts/gdrive_transform-metadata.ts" \
"kits/ai-ecommerce-cart-recovery-agent/scripts/onedrive_transform-metadata.ts" \
"kits/ai-ecommerce-cart-recovery-agent/flows/gdrive.ts"
do
if [ -f "$f" ]; then
echo "--- $f"
wc -l "$f"
ast-grep outline "$f" --view expanded | sed -n '1,220p' || true
echo "--- relevant lines"
if [[ "$f" == *"gdrive.ts" ]]; then
sed -n '1,220p' "$f"
else
sed -n '1,180p' "$f"
fi
fi
done
echo
echo "== related transform files =="
fd -i 'transform|metadata' kits/ai-ecommerce-cart-recovery-agent -t fRepository: Lamatic/AgentKit
Length of output: 21969
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "== gdrive_transform-metadata line count and raw =="
wc -l kits/ai-ecommerce-cart-recovery-agent/scripts/gdrive_transform-metadata.ts
cat -n kits/ai-ecommerce-cart-recovery-agent/scripts/gdrive_transform-metadata.ts
echo
echo "== onedrive_transform-metadata line count and relevant lines =="
wc -l kits/ai-ecommerce-cart-recovery-agent/scripts/onedrive_transform-metadata.ts
sed -n '1,70p' kits/ai-ecommerce-cart-recovery-agent/scripts/onedrive_transform-metadata.tsRepository: Lamatic/AgentKit
Length of output: 1991
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "== locate OneDrive flow details =="
wc -l kits/ai-ecommerce-cart-recovery-agent/flows/onedrive.ts
sed -n '1,180p' kits/ai-ecommerce-cart-recovery-agent/flows/onedrive.ts
echo
echo "== search oneDrive/onedrive document/source/title usages =="
rg -n "onedrive|OneDrive|document_key|mapping\.source|variablesNode|source:" kits/ai-ecommerce-cart-recovery-agent/flows kits/ai-ecommerce-cart-recovery-agent/scripts -g '*.ts'Repository: Lamatic/AgentKit
Length of output: 42410
🏁 Script executed:
#!/bin/bash
set -euo pipefail
python3 - <<'PY'
from pathlib import Path
import re
targets = [
Path("kits/ai-ecommerce-cart-recovery-agent/scripts/gdrive_transform-metadata.ts"),
Path("kits/ai-ecommerce-cart-recovery-agent/scripts/onedrive_transform-metadata.ts"),
]
for p in targets:
text = p.read_text()
ids = re.findall(r"chunk_id:\s*`([^`]*)`", text, re.S)
print(p, ids)
for idtemplate in ids:
if r"source || title ||" in "".join(idtemplate.split("\n")):
print(" first_nonfallback_operand=", re.match(r"\$\{([^|\"]+)", idtemplate).group(1))
flows = [
Path("kits/ai-ecommerce-cart-recovery-agent/flows/gdrive.ts"),
Path("kits/ai-ecommerce-cart-recovery-agent/flows/onedrive.ts"),
]
for p in flows:
text = p.read_text()
m = re.search(r'"variableMapping":"([^"]+)".*?(?:"name":\s*"variables"|$)', text, re.S)
print(f"flow {p} has variableMapping:", bool(m))
if m:
print("variableMapping excerpt:", m.group(1)[:200])
for p in targets:
for var in ("source", "title"):
print(f"{p} reads {var}: ", f"let {var} = {" in p.read_text())
PYRepository: Lamatic/AgentKit
Length of output: 335
🏁 Script executed:
#!/bin/bash
set -euo pipefail
python3 - <<'PY'
from pathlib import Path
import re
targets = [
Path("kits/ai-ecommerce-cart-recovery-agent/scripts/gdrive_transform-metadata.ts"),
Path("kits/ai-ecommerce-cart-recovery-agent/scripts/onedrive_transform-metadata.ts"),
]
for p in targets:
text = p.read_text()
ids = re.findall(r"chunk_id:\s*`([^`]*)`", text, re.S)
print(p, ids)
for idtemplate in ids:
if r"source || title ||" in "".join(idtemplate.split("\n")):
m = re.match(r"\$\{([^|\"]+)", idtemplate)
print(" first_nonfallback_operand=", m.group(1) if m else None)
flows = [
Path("kits/ai-ecommerce-cart-recovery-agent/flows/gdrive.ts"),
Path("kits/ai-ecommerce-cart-recovery-agent/flows/onedrive.ts"),
]
for p in flows:
text = p.read_text()
m = re.search(r'"variableMapping":"([^"]+)".*?(?:"name":\s*"variables"|$)', text, re.S)
print(f"flow {p} has variableMapping:", bool(m))
if m:
print("variableMapping excerpt:", m.group(1)[:200])
for p in targets:
text = p.read_text()
for var in ("source", "title"):
print(f"{p} reads {var}: {'let ' + var + ' =' in text}")
PYRepository: Lamatic/AgentKit
Length of output: 1018
Make chunk_id use document identity before source-based values.
As a first step, build chunk_id from the stable document key before falling back to title or shared source values. The GDrive transform keeps a separate title from source, and the GDrive mapping can leave source empty so two Drive files in the same configured folder can share chunk IDs by index. The OneDrive script also falls back to title, even though the flow maps title per document and source per file URL; replace the loose fallback so chunks never key only on onedrive or a shared source.
📍 Affects 2 files
kits/ai-ecommerce-cart-recovery-agent/scripts/gdrive_transform-metadata.ts#L10-L15(this comment)kits/ai-ecommerce-cart-recovery-agent/scripts/onedrive_transform-metadata.ts#L21-L27
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@kits/ai-ecommerce-cart-recovery-agent/scripts/gdrive_transform-metadata.ts`
around lines 10 - 15, Update chunk_id generation in
kits/ai-ecommerce-cart-recovery-agent/scripts/gdrive_transform-metadata.ts lines
10-15 to prioritize the stable document identity, then fall back to title or
source without allowing shared source values to be the primary key. Apply the
corresponding change in
kits/ai-ecommerce-cart-recovery-agent/scripts/onedrive_transform-metadata.ts
lines 21-27 so its per-document title identity is used before source, preventing
chunks from keying only on “onedrive” or a shared URL.
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
kits/ai-ecommerce-cart-recovery-agent/flows/gdrive.ts (1)
63-64: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick winMission update: refresh the flow notes to match the exported configuration.
- Lines 63-64 and Line 104 say
IndexNode_343has a webhook URL, but itsvaluesobject has nowebhookURL.- Line 94 says
mapping.sourcecontains a fixed folder URL, butvariablesNode_272.mapping.sourceis"".- Line 103 says
meta.namecontains a trailing space, but Line 112 is"GDrive".Remove or correct these statements. Stale operational notes can cause incorrect deployment and troubleshooting decisions.
Also applies to: 94-94, 103-104
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@kits/ai-ecommerce-cart-recovery-agent/flows/gdrive.ts` around lines 63 - 64, Update the flow notes near IndexNode_343 and variablesNode_272 to match the exported configuration: remove the claim that IndexNode_343 has a webhook URL, state that variablesNode_272.mapping.source is empty rather than a fixed folder URL, and correct the meta.name description to match "GDrive".
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@kits/ai-ecommerce-cart-recovery-agent/scripts/gdrive_transform-metadata.ts`:
- Around line 1-5: Update the transform bindings to use GDrive producers
vectorizeNode_623, codeNode_539, and variablesNode_272 so codeNode_560 receives
the correct vectors, texts, title, and source. Remove the lastModified binding
because variablesNode_272 does not provide last_modified, and change the
document identity handling to reject missing title/source values rather than
falling back to "onedrive".
---
Outside diff comments:
In `@kits/ai-ecommerce-cart-recovery-agent/flows/gdrive.ts`:
- Around line 63-64: Update the flow notes near IndexNode_343 and
variablesNode_272 to match the exported configuration: remove the claim that
IndexNode_343 has a webhook URL, state that variablesNode_272.mapping.source is
empty rather than a fixed folder URL, and correct the meta.name description to
match "GDrive".
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI (base), Organization UI (inherited)
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: a592ab3f-fa82-4b77-a2d8-e2811a8ee45c
📒 Files selected for processing (2)
kits/ai-ecommerce-cart-recovery-agent/flows/gdrive.tskits/ai-ecommerce-cart-recovery-agent/scripts/gdrive_transform-metadata.ts
|
@coderabbitai review |
|
PR Checklist
1. Select Contribution Type
kits/<category>/<kit-name>/)bundles/<bundle-name>/)templates/<template-name>/)2. General Requirements
kebab-caseand matches the flow IDREADME.md(purpose, setup, usage)3. File Structure (Check what applies)
config.jsonpresent with valid metadata (name, description, tags, steps, author, env keys)flows/<flow-name>/(where applicable) include:config.json(Lamatic flow export)inputs.jsonmeta.jsonREADME.md.env.examplewith placeholder values only (kits only)config.jsonnode graphs (changes via Lamatic Studio export)4. Validation
npm install && npm run devworks locally (kits: UI runs; bundles/templates: flows are valid)[kit] Add <name> for <use case>)cart-recoveryflow and Chat Widget trigger.triggerNode,dynamicNode,responseEdge, and direct response wiring.crawling-indexation.tsscraping-indexation.tsgdrive.tsgsheet.tsonedrive.tspostgres.tss3.tssharepoint.tstriggerNode,dynamicNode,forLoopNode,forLoopEndNode,addNode,defaultEdge,conditionEdge,loopEdge, andresponseEdge.cart-recoverystep..gitignoreto exclude Python artifacts and local environment files.