From 55a8d23b658164c01c0f179854bf82171ed65761 Mon Sep 17 00:00:00 2001 From: team 1 Date: Wed, 6 May 2026 12:14:23 +0200 Subject: [PATCH] fix p48 --- ...NTIAL_SHOP_ANCHOR_FALLBACK_GUARD_README.md | 97 +++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 patch_history/RETRIEX_PATCH_48_REFERENTIAL_SHOP_ANCHOR_FALLBACK_GUARD_README.md diff --git a/patch_history/RETRIEX_PATCH_48_REFERENTIAL_SHOP_ANCHOR_FALLBACK_GUARD_README.md b/patch_history/RETRIEX_PATCH_48_REFERENTIAL_SHOP_ANCHOR_FALLBACK_GUARD_README.md new file mode 100644 index 0000000..9a2d789 --- /dev/null +++ b/patch_history/RETRIEX_PATCH_48_REFERENTIAL_SHOP_ANCHOR_FALLBACK_GUARD_README.md @@ -0,0 +1,97 @@ +# RetrieX Patch 48 - Referential Shop Anchor Fallback Guard + +## Goal + +Prevent rare first-run or optimizer-fallback shop-query regressions where a referential price request such as: + +```text +was kostet der indikator im shop +``` + +falls back to a generic shop query like: + +```text +indikator +``` + +although the recent conversation already resolved a concrete anchor such as: + +```text +Indikatortyp 300 +``` + +A generic indicator query can surface unrelated TH indicators or other reagent products. The fallback must retain the concrete history anchor when the current prompt is clearly referential. + +## Scope + +This patch intentionally does not change retrieval, scoring, Shopware ranking, product matching, YAML vocabulary consolidation, or the LLM shop-query optimizer prompt. + +It adds a small runtime guard in `AgentRunner` after the final standalone shop-query cleanup and before RAG-anchor enrichment. + +## Behavior + +When all of the following are true: + +- shop-query context-anchor enrichment is enabled, +- commerce history is available for the current prompt, +- the current prompt/query is referential and contains a configured anchor trigger such as `indikator`, +- recent history contains a configured concrete anchor such as `Indikatortyp 300`, +- the resolved shop query does not already contain that anchor, + +RetrieX rewrites the fallback query with the existing configured template: + +```text +{anchor} {query} +``` + +Example: + +```text +was kostet der indikator im shop +``` + +with recent history containing `Indikatortyp 300` becomes: + +```text +indikatortyp 300 indikator +``` + +## Why this is safe + +- Uses existing configured trigger terms and anchor patterns from `agent.yaml` / vocabulary views. +- No Testomat-808-specific logic. +- No Indikatortyp-300-specific logic. +- Does not enrich standalone/new-topic queries because it requires active commerce history usage. +- Does not change queries that already contain the concrete anchor. +- Does not change the successful normal optimizer path; it only guards the fallback path. + +## Changed files + +- `src/Agent/AgentRunner.php` +- `patch_history/RETRIEX_PATCH_48_REFERENTIAL_SHOP_ANCHOR_FALLBACK_GUARD_README.md` + +## Suggested regression flow + +```text +Was ist der niedrigste Grenzwert für die Wasserhärte, welcher mit einem Testomaten überwacht werden kann? +mit welchem indikator wird der wert gemessen +was kostet der indikator im shop +``` + +Expected: + +- The shop query must retain the concrete indicator anchor, e.g. `indikatortyp 300 indikator`. +- The answer must not include unrelated TH indicators when `Indikatortyp 300` is known from the prior turn. +- The existing Testomat-808 / Indikatortyp-300 regression remains green. + +## Checks + +Run after applying: + +```bash +bin/console cache:clear +bin/console mto:agent:config:validate +bin/console mto:agent:regression:test +bin/console mto:agent:config:audit-source --details +bin/console mto:agent:config:audit-patterns --details +```