Fix corrupted and drifting logger output during parallel execution#1
Fix corrupted and drifting logger output during parallel execution#1Copilot wants to merge 3 commits into
Conversation
|
@copilot can you run the test sevreal times and check whether the race condition was hit at least once without the fix? |
Yes, I verified the race condition is highly reproducible. I ran the tests 10 times each: Without the mutex fix: 10/10 iterations detected data races (100% reproduction rate)
With the mutex fix: 0/10 iterations detected data races
The race detector reliably catches the issue on every run without the fix, confirming the mutex solution effectively resolves the race condition. |
|
@copilot please check this manual on how to remove bad content from the repo https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/removing-sensitive-data-from-a-repository |
I've successfully used ✅ Removed the 26MB However, I cannot complete the force push due to authentication restrictions in my environment. The local repository is ready with cleaned history at commit To complete the cleanup, you'll need to run: git push --force origin copilot/fix-colored-console-outputThis will update the remote branch with the cleaned history (commits b719f73 and 0ccc396). |
|
@copilot try to remove the offending commits via this more simple strategy:
You must know which commit(s) added or modified the file in question.
|
Successfully used interactive rebase to remove both commits containing the binary: ✅ Dropped commit 0e73d31 (added 26MB binary) Local branch at 206e49c is ready. As instructed, no push was performed. |
|
@copilot rebase this onto main |
Rebased locally onto |
Co-authored-by: libor-m <1497769+libor-m@users.noreply.github.com>
8921916 to
30137d2
Compare
|
@copilot check this out - the coloring seems better, but after some time the console output still fails, seems like it does not rewind to the beginning of line when printing. try figure out what's wrong and suggest a patch |
Agent-Logs-Url: https://github.com/libor-m/task/sessions/d035ff33-7a74-40a1-a87c-592f1424e75e Co-authored-by: libor-m <1497769+libor-m@users.noreply.github.com>
Agent-Logs-Url: https://github.com/libor-m/task/sessions/d035ff33-7a74-40a1-a87c-592f1424e75e Co-authored-by: libor-m <1497769+libor-m@users.noreply.github.com>
I tracked this down to Task’s own informational stderr lines, not task command output. With I pushed a narrower patch in
That should cover messages like |

Description
When running tasks in parallel (
task -p), console output could still become unreadable in two ways:fatih/colorcould interleave across goroutines, causing output to appear in the wrong colors.output: interleaved, making messages appear shifted to the right over time.This PR fixes both issues in the logger path used by Task's own status output.
Changes
sync.MutextoLoggerstructErrf()output to prepend\rfor newline-terminated informational lines when stderr is an actual terminal-racedetectorImplementation
The mutex ensures each colored write completes atomically, preventing interleaved escape sequences like:
The additional terminal-only
\rhandling ensures Task's own informational stderr lines, such astask: Task "..." is up to date, rewind to the beginning of the current line before printing, which prevents horizontal drift when the cursor was left mid-line.Original prompt
This pull request was created from Copilot chat.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.