Skip to content

feat: Phase 7b - Wire LockGuardedToolExecutor into tool runner#12353

Closed
roomote-v0[bot] wants to merge 1 commit into
feature/phase-7b-lock-guarded-toolsfrom
feature/phase-7b-tool-runner-integration
Closed

feat: Phase 7b - Wire LockGuardedToolExecutor into tool runner#12353
roomote-v0[bot] wants to merge 1 commit into
feature/phase-7b-lock-guarded-toolsfrom
feature/phase-7b-tool-runner-integration

Conversation

@roomote-v0
Copy link
Copy Markdown
Contributor

@roomote-v0 roomote-v0 Bot commented May 12, 2026

Related GitHub Issue

Closes: #12330

Description

This PR attempts to address Issue #12330 by completing the Phase 7b integration -- wiring the LockGuardedToolExecutor (from PR #12352) into the actual tool dispatch flow.

What it includes:

  1. Tool runner integration (presentAssistantMessage.ts):

    • Before each write tool executes, tryAcquireLocks() is called to acquire file locks
    • If a lock conflict is detected (another task holds the lock), an LLM-friendly error is returned via pushToolResult and the tool is skipped
    • Locks are released in a finally block after tool execution completes (success or failure)
    • Non-write tools (read_file, list_files, etc.) pass through without lock checks
  2. Task dispose cleanup (Task.ts):

    • releaseAllLocks(taskId) is called in Task.dispose() to release any stale locks when a task is aborted or disposed
    • Prevents orphaned locks from blocking other tasks indefinitely
  3. Singleton management (file-lock/index.ts):

    • getFileLockManager() and getLockGuardedToolExecutor() singleton getters for shared instances
    • resetFileLockSingletons() for test isolation
  4. 14 integration tests covering:

    • Singleton lifecycle and identity
    • Lock acquisition/release around write tools
    • Cross-task conflict blocking and resolution
    • releaseAllLocks cleanup on dispose
    • Path extraction for all write tool types (write_to_file, apply_patch, edit_file, search_replace)

Stacked branching: main -> Phase 1 -> Phase 2+3 -> Phase 4+5+6 -> Phase 7a -> Phase 7b -> Phase 7b integration (this PR)

Re: Phase 7c (UI surfacing): Lock conflicts are currently returned to the LLM only. UI surfacing in the Background Tasks panel is planned for Phase 7c.

Feedback and guidance are welcome.

Test Procedure

  • Run: cd src && npx vitest run services/file-lock/__tests__/
  • All 79 tests pass (24 FileLockManager + 26 LockGuardedToolExecutor + 14 integration + 15 existing)

Pre-Submission Checklist

  • Issue Linked: This PR is linked to an approved GitHub Issue.
  • Scope: Changes are focused on wiring the lock executor into the tool runner.
  • Self-Review: Performed thorough self-review.
  • Testing: 14 new integration tests added.
  • Contribution Guidelines: Read and agreed.

Interactively review PR in Roo Code Cloud

- Integrate file lock guards into presentAssistantMessage.ts tool dispatch
- Acquire locks before write tool execution, release in finally block
- Block concurrent writes with LLM-friendly conflict error messages
- Wire releaseAllLocks into Task.dispose() for stale lock cleanup
- Add singleton getters (getFileLockManager, getLockGuardedToolExecutor)
- Add 14 integration tests covering lifecycle, conflicts, and cleanup

Phase 7b tool runner integration for parallel agent file coordination.
@roomote-v0
Copy link
Copy Markdown
Contributor Author

roomote-v0 Bot commented May 12, 2026

Closing in favor of consolidated PR #12356 which merges all Phase 7 work into a single PR as requested.

@roomote-v0 roomote-v0 Bot closed this May 12, 2026
@github-project-automation github-project-automation Bot moved this from New to Done in Roo Code Roadmap May 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant