Skip to content

feat: Add command queuing for disconnection resilience#100

Merged
CoderGamester merged 1 commit intoCoderGamester:mainfrom
PhilipLudington:feature/command-queuing
Jan 13, 2026
Merged

feat: Add command queuing for disconnection resilience#100
CoderGamester merged 1 commit intoCoderGamester:mainfrom
PhilipLudington:feature/command-queuing

Conversation

@PhilipLudington
Copy link
Copy Markdown
Contributor

Summary

  • Add CommandQueue class with configurable size (100 commands) and timeout (60s) for storing commands when Unity is disconnected
  • Integrate queue with McpUnity for automatic queuing during reconnection states
  • Add per-request queueIfDisconnected option in SendRequestOptions for opt-in queuing behavior
  • Auto-cleanup expired commands with periodic timer and replay queued commands on connection restore

Changes

  • Server~/src/unity/commandQueue.ts - New CommandQueue class implementation
  • Server~/src/unity/mcpUnity.ts - Integration with connection state management
  • Server~/src/__tests__/commandQueue.test.ts - 21 Jest tests for comprehensive coverage

Test plan

  • All 21 Jest tests pass for CommandQueue functionality
  • Tests cover: enqueue/drain, queue limits, timeout handling, statistics, cleanup
  • Manual testing with Unity disconnection/reconnection scenario

🤖 Generated with Claude Code

Implements command queue that stores commands when Unity connection is
unavailable (reconnecting/connecting) and replays them when connection
is restored.

- Add CommandQueue class with configurable size (100) and timeout (60s)
- Integrate queue with McpUnity for automatic queuing during reconnection
- Add per-request queueIfDisconnected option in SendRequestOptions
- Auto-cleanup expired commands with periodic timer
- Replay queued commands on connection restore
- Add 14 Jest tests for CommandQueue

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jan 10, 2026

Important

Review skipped

Auto reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Owner

@CoderGamester CoderGamester left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work @PhilipLudington
This is a very good solution for the annoying connection losses for the domain reload problems with Unity.

Thank you very much

@CoderGamester CoderGamester merged commit f26a139 into CoderGamester:main Jan 13, 2026
1 check passed
@PhilipLudington
Copy link
Copy Markdown
Contributor Author

@CoderGamester Thank you, love a good solution to a problem!

@PhilipLudington PhilipLudington deleted the feature/command-queuing branch January 13, 2026 21:18
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.

2 participants