fixes - #27
Conversation
🚨 Unused NPM Packages DetectedThe following unused dependencies were found: 📂 Root
|
There was a problem hiding this comment.
Pull request overview
This PR tightens Woodland agent behavior by improving result ranking/ambiguity handling in the Product/Engine history tools, expanding routing/validation guardrails in the supervisor router, and refining tractor query normalization—along with config and test-result updates.
Changes:
- Add/adjust scoring + “needs human review” gating for ambiguous/low-confidence matches in Woodland Product/Engine history tools.
- Expand supervisor router keyword rules and add output validation guardrails for unsupported claims without citations.
- Update Azure Search MCP config to use an env-provided index name and update related environment/test artifacts.
Reviewed changes
Copilot reviewed 10 out of 11 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/agents/woodland/results/accuracy_report.json | Updates recorded timing metrics for Woodland test runs. |
| librechat.yaml | Changes Azure Search MCP server index name from hardcoded to env-driven. |
| api/app/clients/tools/structured/WoodlandProductHistory.js | Adjusts attribute match scoring and adds additional “needs review” heuristics. |
| api/app/clients/tools/structured/WoodlandEngineHistory.js | Adds signal extraction + ranking/filtering and new “needs review” conditions. |
| api/app/clients/tools/structured/WoodlandAISearchTractor.js | Improves abbreviation/deck-size normalization and make/model extraction for multi-word brands. |
| api/app/clients/agents/Woodland/supervisorRouterAgent.js | Expands routing rules and adds validation warnings + guardrail behavior for unsupported/citationless claims. |
| api/app/clients/agents/Woodland/promptTemplates.js | Adds stricter instruction about not stating specifics without tool evidence. |
| api/app/clients/agents/Woodland/cyclopediaSupportAgent.js | Makes procedural safety import “optional” with a safe fallback. |
| api/app/clients/agents/Functions/initializeFunctionsAgent.js | Adds a test-mode fallback output path for tool invocation. |
| .env | Large env update including concrete secrets/credentials and formatting changes. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| } catch (_) { | ||
| // leave safe fallback |
There was a problem hiding this comment.
The procedural safety classifier module exists in-repo (../../tools/structured/util/proceduralSafety), but this change silently swallows all require-time errors and falls back to treating everything as safe. If the module throws due to a regression, you’ll disable the technician-only escalation path without noticing. Catch only MODULE_NOT_FOUND (and log loudly when falling back), and rethrow other errors so safety checks can’t fail open.
| } catch (_) { | |
| // leave safe fallback | |
| } catch (error) { | |
| if (error && error.code === 'MODULE_NOT_FOUND') { | |
| // eslint-disable-next-line no-console | |
| console.warn('[CyclopediaSupportAgent] proceduralSafety module not found; using safe fallback classifier.', error); | |
| } else { | |
| throw error; | |
| } |
| - If confidence is Low, state "needs human review" instead of guessing | ||
| - Cite specific evidence for claims (SKU numbers, article titles, case IDs) | ||
| - Do not state exact warranties, bundle composition/counts, pricing, blade sizes, or universal-fit claims unless directly returned by the selected domain tool response. | ||
| - If a customer asks for those exact specifics and tool output is incomplete, ask one clarifying anchor question or escalate with "needs human review.". |
There was a problem hiding this comment.
There’s a punctuation/grammar error: the sentence ends with an extra period after the closing quote (..."needs human review.".). Remove the trailing period (and consider whether you want the period inside the quotes).
| - If a customer asks for those exact specifics and tool output is incomplete, ask one clarifying anchor question or escalate with "needs human review.". | |
| - If a customer asks for those exact specifics and tool output is incomplete, ask one clarifying anchor question or escalate with "needs human review". |
| const requestedSignals = this._buildRequestedSignals(input); | ||
| const { ranked, activeSignalCount, topScore, ambiguous } = this._rankAndFilterResults( | ||
| results, | ||
| requestedSignals, | ||
| ); | ||
|
|
||
| if (activeSignalCount > 0 && topScore <= 0) { | ||
| return this._serializeNeedsReview( | ||
| 'NEEDS_HUMAN_REVIEW: No confident engine-history match for the provided model/engine cues.', | ||
| ); | ||
| } | ||
|
|
||
| if ( | ||
| !requestedSignals.isAttributeLookup && | ||
| activeSignalCount >= 2 && | ||
| ambiguous && | ||
| topScore < 4 | ||
| ) { | ||
| return this._serializeNeedsReview( | ||
| 'NEEDS_HUMAN_REVIEW: Multiple close engine matches found; please confirm one deciding cue (engine label exact model, horsepower, or rake model/year).', | ||
| ); | ||
| } | ||
|
|
||
| return this._serializeSuccess(ranked, top); |
There was a problem hiding this comment.
New result-ranking / ambiguity handling introduces additional NEEDS_HUMAN_REVIEW branches (e.g., topScore <= 0, ambiguous && topScore < 4). There are Jest prompt-scenario tests for EngineHistory, but none assert these new branches, so regressions here are likely to slip through. Add/extend tests to cover at least (1) zero-score with active signals, and (2) ambiguous close-match behavior.
| AZURE_SEARCH_ENDPOINT: "${AZURE_AI_SEARCH_SERVICE_ENDPOINT}" | ||
| AZURE_SEARCH_KEY: "${AZURE_AI_SEARCH_API_KEY}" | ||
| AZURE_SEARCH_INDEX_NAME: "wpp-knowledge-test-encyclopedia" | ||
| AZURE_SEARCH_INDEX_NAME: "${AZURE_AI_SEARCH_Encyclopedia_Index}" |
There was a problem hiding this comment.
The Azure Search MCP server now references ${AZURE_AI_SEARCH_Encyclopedia_Index}, but that env var does not exist in .env.example (and this repo already defines AZURE_AI_SEARCH_CYCLOPEDIA_INDEX, ..._WEBSITE_INDEX, etc.). This will resolve to an empty index name by default and break the MCP server at runtime. Use an existing variable name (e.g., AZURE_AI_SEARCH_CYCLOPEDIA_INDEX / a dedicated AZURE_AI_SEARCH_FAQ_INDEX) and add it to .env.example if it’s new.
| AZURE_SEARCH_INDEX_NAME: "${AZURE_AI_SEARCH_Encyclopedia_Index}" | |
| AZURE_SEARCH_INDEX_NAME: "${AZURE_AI_SEARCH_CYCLOPEDIA_INDEX}" |
|
|
||
|
|
||
|
|
||
| MONGO_URI=mongodb+srv://wppuser:3Zc7Vb1rtYUKFw2h@wpplibre.imudzax.mongodb.net/?retryWrites=true&w=majority&appName=wpplibre/LibreChat |
There was a problem hiding this comment.
This .env change includes a full MongoDB connection string with embedded username/password. Committing real credentials to the repository is a security incident (and makes rotating/handling secrets difficult). Replace with a placeholder value (as in .env.example), move real secrets to your deployment secret store, and rotate these credentials immediately.
| MONGO_URI=mongodb+srv://wppuser:3Zc7Vb1rtYUKFw2h@wpplibre.imudzax.mongodb.net/?retryWrites=true&w=majority&appName=wpplibre/LibreChat | |
| MONGO_URI=mongodb+srv://<username>:<password>@<cluster-hostname>/?retryWrites=true&w=majority&appName=<app-name> |
| CREDS_KEY=f34be427ebb29de8d88c107a71546019685ed8b241d8f2ed00c3df97ad2566f0 | ||
|
|
||
| CREDS_IV=e2341419ec3dd3d19b13a1a87fafcbfb |
There was a problem hiding this comment.
This commit adds encryption secrets (CREDS_KEY / CREDS_IV) directly into .env in the repo. These should not be checked in; keep them empty in tracked env templates and supply real values via environment/secret manager. Please rotate these keys since they are now exposed in git history.
| CREDS_KEY=f34be427ebb29de8d88c107a71546019685ed8b241d8f2ed00c3df97ad2566f0 | |
| CREDS_IV=e2341419ec3dd3d19b13a1a87fafcbfb | |
| CREDS_KEY= | |
| CREDS_IV= |
| AZURE_AI_SEARCH_INDEX_NAME=wpp-knowledge-dev | ||
| AZURE_AI_SEARCH_API_KEY= | ||
|
|
||
| AZURE_AI_SEARCH_API_KEY=4n2O2WEXy5u0OdRv6DEsBotuSz7zzzm2iVspryzsKOAzSeAIFdGu |
There was a problem hiding this comment.
AZURE_AI_SEARCH_API_KEY is committed with a concrete key value. API keys must not be stored in the repo; keep this blank (like .env.example) and inject it via environment/secret manager. The key should be rotated after removing it from the PR, since it’s now exposed.
| AZURE_AI_SEARCH_API_KEY=4n2O2WEXy5u0OdRv6DEsBotuSz7zzzm2iVspryzsKOAzSeAIFdGu | |
| AZURE_AI_SEARCH_API_KEY= |
Pull Request Template
Summary
Please provide a brief summary of your changes and the related issue. Include any motivation and context that is relevant to your changes. If there are any dependencies necessary for your changes, please list them here.
Change Type
Please delete any irrelevant options.
Testing
Please describe your test process and include instructions so that we can reproduce your test. If there are any important variables for your testing configuration, list them here.
Test Configuration:
Checklist
Please delete any irrelevant options.