Skip to content

馃Ч fix: Close Native Scratch Directory Streams - #240

Merged
danny-avila merged 1 commit into
mainfrom
danny-avila/fix-native-scratch-descriptor-cleanup
Sep 20, 2026
Merged

danny-avila merged 1 commit into
mainfrom
danny-avila/fix-native-scratch-descriptor-cleanup

Conversation

@danny-avila

Copy link
Copy Markdown
Collaborator

Summary

I made native scratch recovery close every directory stream deterministically and updated the remote bridge lifecycle documentation for negotiated worker concurrency.

  • Replace async directory iteration with explicit bounded reads and an unconditional close, including traversal-limit and inspection failures.
  • Preserve descriptor-relative recovery, traversal limits, and existing symlink-race protections.
  • Document bounded worker lease slots, same-isolation-key serialization, and concurrent conversation worktrees.

Change Type

  • Bug fix (non-breaking change which fixes an issue)
  • Documentation update

Testing

  • npm run build in packages/code
  • node --trace-warnings --test dist/native-sandbox.test.js (61 passing; no FileHandle garbage-collection warnings)
  • Local three-process canary using current LibreChat dev, local Code API, and a native worker with two lease slots and conversation worktrees:
    • Derived two independent workspace instance IDs from separate LibreChat conversation IDs.
    • Ran two four-second commands concurrently in 5.16 seconds total.
    • Verified distinct generated worktree paths and isolated persisted contents.
    • Verified the source repository remained unchanged.

Test Configuration:

  • macOS
  • Node.js 24.16.0
  • Redis 8.4.0
  • Code API local mode with two negotiated workspace slots
  • Native SRT worker with conversation-scoped Git worktrees

Checklist

  • My code adheres to this project's style guidelines
  • I have performed a self-review of my own code
  • I have commented in any complex areas of my code
  • I have made pertinent documentation changes
  • My changes do not introduce new warnings
  • Existing focused tests demonstrate that my changes are effective
  • Local unit tests pass with my changes

@danny-avila
danny-avila merged commit c8b3e14 into main Sep 20, 2026
10 checks passed
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