📚 docs: add background task management guidelines#732
Open
Conversation
Add critical warning about never using tail -f to monitor background tasks, which leaves processes running indefinitely. Document correct approach using TaskOutput tool. Fixes #731
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds critical guidelines to CLAUDE.md about background task management, specifically addressing the problem of using tail -f to monitor background tasks, which leaves processes running indefinitely.
Changes:
- Added new "Background Task Management" section with clear warnings and best practices
- Documented correct approach using TaskOutput tool with block=true
- Provided concrete examples of wrong vs. correct patterns
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.
You can also share your feedback on Copilot code review. Take the survey.
Comment on lines
+65
to
+66
| cargo nextest run --workspace # This runs in background automatically | ||
| # Then use TaskOutput tool with block=true to wait for completion |
Comment on lines
+69
to
+73
| **Rules:** | ||
| - Use `TaskOutput` tool with `block=true` to wait for background command completion | ||
| - NEVER use `tail -f` - it runs until manually killed | ||
| - If you accidentally start `tail -f`, immediately use `KillShell` to stop it | ||
| - Background tasks from Bash tool are automatically monitored - don't add extra monitoring |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds critical guidelines about background task management to CLAUDE.md, specifically warning against using
tail -fto monitor background tasks.Problem
tail -fwas used twice to monitor background task output, leaving processes running indefinitely that required manual cleanup with KillShell.Solution
Added new section to CLAUDE.md with:
tail -fto monitor background taskstail -fis accidentally startedChanges
Related Issues
Fixes #731
🤖 Generated with Claude Code
Note
Low Risk
Low risk documentation-only change that doesn’t affect runtime behavior. Main risk is minor: guidance could be misapplied if the described tooling behavior differs from reality.
Overview
Adds a new Background Task Management section to
CLAUDE.mdthat explicitly forbids usingtail -fto monitor background jobs.Documents the preferred pattern for waiting on background work via
TaskOutputwithblock=true, and adds cleanup rules (useKillShelliftail -fis started) to avoid leaving long-running processes behind.Written by Cursor Bugbot for commit f213634. This will update automatically on new commits. Configure here.