You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Based on GPT-5.5 and Claude Opus 4.6 review of the initial implementation:
- fix(streaming): ExecuteFunctionCallAsync on rejected tool now streams a
recovery response ('tool not available') back to the model instead of
yield break, preventing silent stream truncation and OpenAI protocol
violations (both agents flagged as blocker)
- fix(allowlist): AllowedMcpTools changes from fail-open (empty=allow all)
to fail-secure (empty=deny all). Added AllowAllMcpTools bool for explicit
dev override. Converted _AllowedMcpTools to FrozenSet<string> at ctor
time for O(1) lookup and immutability. Added IsMcpToolAllowed() helper
to centralize the check across all three call sites.
- fix(rag): Sanitize XML angle brackets in Heading and ChunkText using
typographic alternatives (U+2039/U+203A) before inserting into
<retrieved_context> block, preventing boundary-escape attacks
- fix(cache): ResponseIdValidationService.RecordResponseId sets sliding
expiry inside the GetOrCreate factory (not in a separate Set call)
eliminating the TOCTOU race between GetOrCreate and cache.Set. Added
500-ID cap per user to prevent unbounded HashSet growth.
- fix(docs): Corrected endUserId param comment to say 'reserved for
forwarding' rather than claiming it is already forwarded
Copy file name to clipboardExpand all lines: EssentialCSharp.Chat.Shared/Services/AIChatService.cs
+54-12Lines changed: 54 additions & 12 deletions
Original file line number
Diff line number
Diff line change
@@ -4,6 +4,7 @@
4
4
usingModelContextProtocol.Client;
5
5
usingModelContextProtocol.Protocol;
6
6
usingOpenAI.Responses;
7
+
usingSystem.Collections.Frozen;
7
8
8
9
namespaceEssentialCSharp.Chat.Common.Services;
9
10
@@ -19,12 +20,14 @@ public partial class AIChatService
19
20
#pragma warning restore OPENAI001// Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
// Feed a benign error back to the model so it can recover gracefully,
243
+
// mirroring what GetChatCompletionCore does on the non-streaming path.
244
+
#pragma warning disable OPENAI001// Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
245
+
varerrorItems=newList<ResponseItem>
246
+
{
247
+
functionCallItem,
248
+
newFunctionCallOutputResponseItem(
249
+
functionCallItem.CallId,
250
+
$"Tool '{functionCallItem.FunctionName}' is not available.")
251
+
};
252
+
#pragma warning restore OPENAI001// Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
0 commit comments