Compare commits

...

1 Commits

Author SHA1 Message Date
Nathan
34c80a00cd Improves log reading and build diagnostics
nearly a month ago
2026-01-15 10:07:49 -07:00
2 changed files with 194 additions and 24 deletions

View File

@@ -60289,7 +60289,7 @@ Additional data:
"codeblockId": "7e8cbc30-2dff-4a64-9bdf-55df42a71e8c"
}
```
Status: **loading**
Status: **completed**
</details>
@@ -60298,14 +60298,30 @@ Status: **loading**
---
<tool-use data-tool-type="shell" data-tool-name="run_terminal_command_v2">
<details><summary>Tool use: **run_terminal_command_v2**</summary>
<details><summary>Tool use: **run_terminal_command_v2** • Run command: dotnet build --no-restore 2>&1 | Select-Object -First 40</summary>
```bash
dotnet build --no-restore 2>&1 | Select-Object -First 40
```
```
UnifiedFarmLauncher -&gt; C:\Users\Nathan\Desktop\UFL\bin\Debug\net8.0\UnifiedFarmLauncher.dll
Build succeeded.
0 Warning(s)
0 Error(s)
Time Elapsed 00:00:01.29
```
</details>
</tool-use>
---
Fixing the MaxWidth binding issue with a simpler approach:
---
@@ -60321,7 +60337,14 @@ Parameters:
"relativeWorkspacePath": "Views/ErrorDialog.axaml"
}
```
Status: **loading**
Additional data:
```json
{
"codeblockId": "56b37655-db87-442c-8122-9335e161141f"
}
```
Status: **completed**
</details>
@@ -60330,7 +60353,114 @@ Status: **loading**
---
<tool-use data-tool-type="shell" data-tool-name="run_terminal_command_v2">
<details><summary>Tool use: **run_terminal_command_v2**</summary>
<details><summary>Tool use: **run_terminal_command_v2** • Run command: dotnet build --no-restore 2>&1 | Select-Object -First 40</summary>
```bash
dotnet build --no-restore 2>&1 | Select-Object -First 40
```
```
UnifiedFarmLauncher -&gt; C:\Users\Nathan\Desktop\UFL\bin\Debug\net8.0\UnifiedFarmLauncher.dll
Build succeeded.
0 Warning(s)
0 Error(s)
Time Elapsed 00:00:01.31
```
</details>
</tool-use>
---
Made two fixes:
1. **Fixed horizontal scrolling**: Disabled horizontal scrolling and ensured text wraps vertically. The `TextBlock` with `TextWrapping="Wrap"` should now wrap long lines instead of scrolling horizontally.
2. **Enhanced log reading diagnostics**: The log reading now:
- Shows the log file size
- Attempts multiple reading methods (Get-Content, then raw bytes if needed)
- Provides more diagnostic information about why logs might be empty
- Shows the first 500 characters of raw content if Get-Content fails
When you try starting the worker again, you should see:
- **Vertical scrolling only** — long lines wrap instead of scrolling horizontally
- **Better log diagnostics** — if the log file exists but appears empty, it will show the file size and attempt to read raw bytes to see if there's actually content
The log file may be empty because the controller hasn't started writing to it yet, or there's an encoding issue. The enhanced diagnostics should help identify the cause.
---
_**User**_
---
_**Agent (model default, mode Agent)**_
The log section is still empty. The enhanced diagnostics should show file size and raw content attempts, but they aren't appearing. Checking if the diagnostics script is outputting correctly and ensuring the log reading code is being executed:
---
<tool-use data-tool-type="read" data-tool-name="read_file_v2">
<details><summary>Tool use: **read_file_v2** • Read file: Services/WorkerControllerService.cs</summary>
</details>
</tool-use>
---
<tool-use data-tool-type="unknown" data-tool-name="ripgrep_raw_search">
<details>
<summary>Tool use: **ripgrep_raw_search**</summary>
Parameters:
```json
{
"pattern": "Recent Log Entries",
"path": "Services/WorkerControllerService.cs",
"caseInsensitive": false
}
```
Result:
```json
{
"success": {
"pattern": "Recent Log Entries",
"path": "Services/WorkerControllerService.cs",
"outputMode": "content",
"workspaceResults": {
"c:\\Users\\Nathan\\Desktop\\UFL": {
"content": {
"matches": [
{
"file": "Services/WorkerControllerService.cs",
"matches": [
{
"lineNumber": 628,
"content": "Write-Host \"\"&#96;n=== Recent Log Entries (last 30 lines) ===\"\" -ForegroundColor Cyan"
}
]
}
],
"totalLines": 1,
"totalMatchedLines": 1
}
}
}
}
}
```
Status: **completed**
</details>
</tool-use>
@@ -60338,6 +60468,35 @@ Status: **loading**
---
The log section header appears, but no content follows. This suggests the script runs but produces no output. Fixing the log reading logic to handle empty files:
---
<tool-use data-tool-type="unknown" data-tool-name="edit_file_v2">
<details>
<summary>Tool use: **edit_file_v2**</summary>
Parameters:
```json
{
"relativeWorkspacePath": "Services/WorkerControllerService.cs"
}
```
Additional data:
```json
{
"codeblockId": "bb53d695-98ef-4fef-aabd-7fe79f19d870"
}
```
Status: **loading**
</details>
</tool-use>
---

View File

@@ -628,31 +628,42 @@ Write-Host ""Controller process: $controllerProcessInfo""
Write-Host ""`n=== Recent Log Entries (last 30 lines) ==="" -ForegroundColor Cyan
if (Test-Path $logPath) {{
try {{
$logFileInfo = Get-Item $logPath -ErrorAction SilentlyContinue
if ($logFileInfo) {{
Write-Host ""Log file size: $($logFileInfo.Length) bytes"" -ForegroundColor Gray
}}
$logFileInfo = Get-Item $logPath -ErrorAction Stop
$fileSize = $logFileInfo.Length
Write-Host ""Log file size: $fileSize bytes"" -ForegroundColor Gray
if ($fileSize -eq 0) {{
Write-Host ""Log file is empty (0 bytes) - controller may not have started writing yet"" -ForegroundColor Yellow
}} else {{
# Try Get-Content first
$logContent = Get-Content $logPath -ErrorAction SilentlyContinue
if ($logContent) {{
if ($null -ne $logContent -and $logContent.Count -gt 0) {{
$logLines = if ($logContent.Count -gt 30) {{ $logContent[-30..-1] }} else {{ $logContent }}
Write-Host ""Found $($logLines.Count) log lines (showing last $([Math]::Min(30, $logLines.Count)))""
$logLines | ForEach-Object {{ Write-Host $_ }}
foreach ($line in $logLines) {{
Write-Host $line
}}
}} else {{
Write-Host ""Log file exists but appears to be empty or unreadable"" -ForegroundColor Yellow
Write-Host ""Attempting to read raw bytes..."" -ForegroundColor Gray
Write-Host ""Get-Content returned no lines, attempting to read raw bytes..."" -ForegroundColor Yellow
try {{
$rawBytes = [IO.File]::ReadAllBytes($logPath)
Write-Host ""Log file contains $($rawBytes.Length) bytes""
Write-Host ""Read $($rawBytes.Length) bytes from log file""
if ($rawBytes.Length -gt 0) {{
$text = [System.Text.Encoding]::UTF8.GetString($rawBytes)
Write-Host ""Log content (first 500 chars):"" -ForegroundColor Cyan
Write-Host $text.Substring(0, [Math]::Min(500, $text.Length))
$lines = $text -split ""`r?`n""
Write-Host ""Parsed into $($lines.Count) lines""
$displayLines = if ($lines.Count -gt 30) {{ $lines[-30..-1] }} else {{ $lines }}
foreach ($line in $displayLines) {{
if ($line) {{ Write-Host $line }}
}}
}} else {{
Write-Host ""Log file is empty"" -ForegroundColor Yellow
}}
}} catch {{
Write-Host ""Could not read log file bytes: $($_.Exception.Message)"" -ForegroundColor Red
}}
}}
}}
}} catch {{
Write-Host ""Error reading log: $($_.Exception.Message)"" -ForegroundColor Red
Write-Host ""Stack trace: $($_.ScriptStackTrace)"" -ForegroundColor DarkRed