intake(lote-B): import upstream PR #1842#8
Open
nsalvacao wants to merge 10 commits intobaseline/develop-sync-2026-02-17from
Open
intake(lote-B): import upstream PR #1842#8nsalvacao wants to merge 10 commits intobaseline/develop-sync-2026-02-17from
nsalvacao wants to merge 10 commits intobaseline/develop-sync-2026-02-17from
Conversation
…k90#1805) The FileWatcher was always watching the main project's spec directory for implementation_plan.json changes. When tasks run in a worktree, the backend writes the plan file to the worktree directory instead, so the watcher never detected changes and subtask progress was never sent to the UI. Changes: - Add getSpecDirForWatcher() helper that checks worktree path first - Update all 3 file watcher setup locations (TASK_START, TASK_UPDATE_STATUS auto-start, TASK_RECOVER_STUCK auto-restart) to use worktree-aware paths - Add re-watch logic in execution-progress handler: when a worktree appears after task start, automatically switch the watcher to the worktree path - Add worktree fallback in exit handler for reading final plan state - Add getWatchedSpecDir() method to FileWatcher for path comparison Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…dling (AndyMik90#1805) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…rror handling - Add pendingWatches guard in FileWatcher.watch() to prevent overlapping async calls from creating duplicate watchers (CodeRabbit critical finding) - Add .catch() to all three fire-and-forget fileWatcher.watch() calls in execution-handlers.ts to prevent unhandled promise rejections - Remove shadowed specsBaseDir re-declaration in autoRestart block, reusing the outer variable from the same TASK_RECOVER_STUCK handler scope
…variable shadowing - Change pendingWatches from Set<string> to Map<string, string> (taskId->specDir) so re-watch calls with a different specDir are allowed through instead of silently dropped - Add cancelledWatches Set to coordinate unwatch() with in-flight watch() calls, preventing watcher leaks when unwatch() runs during watch()'s await points - Add .catch() handler to fileWatcher.unwatch() call in agent-events-handlers exit handler, consistent with the .catch() pattern used for all watch() calls - Remove shadowed const mainSpecDir re-declaration inside autoRestart block in execution-handlers.ts, using the outer variable from the enclosing try block instead Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ions - Add supersession check in watch() after awaiting existing watcher close to prevent a later concurrent call from having its watcher overwritten - Return early in unwatch() when a watch() is in-flight to prevent double-closing the same FSWatcher - Cancel in-flight watch() calls in unwatchAll() by marking their taskIds in cancelledWatches before closing existing watchers - Add .catch() to fileWatcher.unwatch() calls in TASK_STOP and TASK_RECOVER_STUCK handlers to surface errors instead of silently dropping them Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Make finally block conditional so superseding watch() calls are not wiped out by the superseded call cleaning up pendingWatches - Delete watcher from map before awaiting close() to prevent concurrent calls from double-closing the same FSWatcher reference - Make cancelledWatches cleanup conditional on the call still owning the pendingWatches entry, preventing premature flag removal for concurrent calls - Fix misleading comment about mainSpecDir declaration scope Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ards, and test coverage - Remove dead code in finally block: after delete(), has() is always false so the inner if was always true; simplify to a single delete + cancelledWatches.delete call (Finding 1) - Add implementation_plan.json existence check in getSpecDirForWatcher before preferring the worktree path, so the watcher is started in the correct directory even when the plan file hasn't been written yet (Finding 2) - Clear pendingWatches in unwatchAll() so in-flight watch() calls can no longer register new watchers after a full teardown (Finding 3) - Also clear cancelledWatches in unwatchAll() since in-flight calls bail via the supersession check and won't clean up the flags themselves - Add comprehensive concurrency tests for FileWatcher covering deduplication, supersession, cancellation, and unwatchAll behaviour (Finding 4) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…bility Replace hardcoded forward-slash strings in getWatchedSpecDir assertions with path.join() so expected values match on Windows (backslash) and Unix (forward slash) alike. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ake/lote-B-pr-1842
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
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.
Upstream intake PR for isolated review.
intake/lote-B-pr-1842baseline/develop-sync-2026-02-17Checklist: