Fix settings log tail reads
PR and Push Build/Test / build-and-test (push) Failing after 12m50s

This commit is contained in:
2026-05-30 14:25:35 +02:00
parent 0342cff64f
commit fd8c33f1ea
3 changed files with 35 additions and 8 deletions
+25 -1
View File
@@ -189,7 +189,7 @@ internal static class AgentFileToolContent
var limit = Math.Clamp(maxMatches, 1, 1000);
foreach (var source in sources)
{
var lines = File.ReadAllLines(source.Path);
var lines = ReadAllLinesShared(source.Path);
for (var index = 0; index < lines.Length; index++)
{
if (regex.IsMatch(lines[index]))
@@ -211,6 +211,30 @@ internal static class AgentFileToolContent
return "";
}
}
public static async Task<string> ReadAllTextSharedAsync(string path)
{
await using var stream = new FileStream(
path,
FileMode.Open,
FileAccess.Read,
FileShare.ReadWrite | FileShare.Delete,
bufferSize: 4096,
useAsync: true);
using var reader = new StreamReader(stream);
return await reader.ReadToEndAsync();
}
private static string[] ReadAllLinesShared(string path)
{
using var stream = new FileStream(
path,
FileMode.Open,
FileAccess.Read,
FileShare.ReadWrite | FileShare.Delete);
using var reader = new StreamReader(stream);
return SplitLines(reader.ReadToEnd()).ToArray();
}
}
internal sealed record AgentFileSearchSource(string Path, string DisplayPath);
@@ -166,7 +166,7 @@ public sealed class WorkflowRulesEditorTools
return $"Log file was not found: {logFile ?? MeetingAssistantLogFiles.CurrentLogFileName}";
}
var content = await File.ReadAllTextAsync(path);
var content = await AgentFileToolContent.ReadAllTextSharedAsync(path);
if (from.HasValue || to.HasValue)
{
return AgentFileToolContent.ReadLines(content, from, to);