Skip to content

Commit b1119cc

Browse files
fix: cleanup from second agent review pass
- Remove dead MakeCacheOptions() method from ResponseIdValidationService - Add comment explaining why user_question prompt is intentionally not XML-sanitized (C# generics like List<T> must not be corrupted)
1 parent f4bcfab commit b1119cc

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

EssentialCSharp.Chat.Shared/Services/AIChatService.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,10 @@ private async Task<string> EnrichPromptWithContext(string prompt, bool enableCon
158158

159159
contextualInfo.AppendLine("</retrieved_context>");
160160
contextualInfo.AppendLine("<user_question>");
161+
// The user's prompt is intentionally NOT passed through SanitizeForXmlContext:
162+
// the user controls their own question (including C# generics like List<T>), and
163+
// replacing '<'/'>' would corrupt code syntax in their query. The retrieved_context
164+
// boundary above is protected; this tag is informational only.
161165
contextualInfo.AppendLine(prompt);
162166
contextualInfo.AppendLine("</user_question>");
163167

EssentialCSharp.Web/Services/ResponseIdValidationService.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@ public sealed class ResponseIdValidationService(IMemoryCache cache)
1616
{
1717
private const int MaxTrackedIdsPerUser = 500;
1818

19-
private static MemoryCacheEntryOptions MakeCacheOptions() =>
20-
new MemoryCacheEntryOptions().SetSlidingExpiration(TimeSpan.FromHours(2));
21-
2219
/// <summary>
2320
/// Records a newly issued response ID as belonging to the specified user.
2421
/// </summary>

0 commit comments

Comments
 (0)