Skip to content

feat: Phase 7b - LockGuardedToolExecutor for write tool lock integration#12352

Closed
roomote-v0[bot] wants to merge 1 commit into
feature/phase-7a-file-lock-managerfrom
feature/phase-7b-lock-guarded-tools
Closed

feat: Phase 7b - LockGuardedToolExecutor for write tool lock integration#12352
roomote-v0[bot] wants to merge 1 commit into
feature/phase-7a-file-lock-managerfrom
feature/phase-7b-lock-guarded-tools

Conversation

@roomote-v0
Copy link
Copy Markdown
Contributor

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

This PR attempts to address Issue #12330 by implementing Phase 7b -- integrating the FileLockManager (Phase 7a) into the tool execution layer.

What it includes

  • LockGuardedToolExecutor class that wraps write tool execution with advisory file lock acquisition/release
  • extractWriteTargetPaths() utility to extract target file paths from each write tool's parameters (write_to_file, apply_diff, apply_patch, edit_file, search_replace, search_and_replace)
  • All-or-nothing lock semantics: if any file in a multi-file operation (e.g., apply_patch) cannot be locked, all acquired locks are rolled back
  • Deadlock prevention: lock acquisition order is sorted by path
  • Conflict error formatting: formatLockConflictError() produces LLM-friendly messages explaining why a write was blocked
  • 26 unit tests covering path extraction, lock acquisition, conflict detection, rollback, and error formatting

Stacked branching

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

Design decisions

  • Non-invasive: The executor is a standalone class that the tool execution layer calls before/after write tools. No modifications to existing tool classes.
  • Advisory locking: Consistent with Phase 7a's design -- locks are checked programmatically, not at the OS level.
  • Re-entrant: Same task can re-acquire locks it already holds (useful for retry scenarios).

Next steps

Integration into the actual tool dispatch flow (wiring LockGuardedToolExecutor into the tool runner that calls BaseTool.execute()).

Feedback and guidance are welcome.

Interactively review PR in Roo Code Cloud

@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