Handle Glama startup without a local Ableton bridge - #11
Conversation
|
Warning Review limit reached
More reviews will be available in 37 minutes and 50 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more credits in the billing tab to continue. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThis PR introduces a bridge runtime abstraction layer to decouple TCP connection management from the main entrypoint. The new module handles connection lifecycle, gracefully falls back to offline mode on failure, and is integrated into startup with conditional forwarder attachment and improved shutdown handling. ChangesBridge Runtime Abstraction & Integration
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/server/bridge-runtime.ts`:
- Around line 17-21: The offline bridge client currently throws a generic Error
in createOfflineBridgeClient's call method; change it to throw the
transport-specific JsonRpcTransportError (from your bridge transport contract)
so callers can classify transport failures properly—update the throw in
createOfflineBridgeClient (and ensure JsonRpcTransportError is
imported/available) to construct the JsonRpcTransportError with a descriptive
message including the detail string and any relevant metadata.
In `@tests/server-bridge-runtime.test.ts`:
- Around line 29-45: Add a test that covers the case where client.connect()
succeeds but handshake() throws: call createBridgeRuntime with a mock client
whose connect resolves and close is mocked, and a handshake mock that rejects;
assert the returned runtime.connected is false, runtime.detail indicates the
bridge is offline (e.g., "Ableton bridge offline"), runtime.client is still the
client, any runtime.bridge.call rejects or is not usable, and that
runtime.close() triggers client.close() exactly once; reference
createBridgeRuntime, client.connect, handshake, runtime.connected,
runtime.detail, runtime.bridge.call, client.close and runtime.close when adding
the test.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 77575b8f-c5c6-4d79-be50-f8c984f9260e
📒 Files selected for processing (3)
src/index.tssrc/server/bridge-runtime.tstests/server-bridge-runtime.test.ts
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Docker build
🧰 Additional context used
📓 Path-based instructions (1)
src/**/*.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
MCP server code must be written in TypeScript with Node 20+, using
@modelcontextprotocol/sdkand Zod validation
src/**/*.{ts,tsx}: In TypeScript/Node MCP server code, use@modelcontextprotocol/sdkfor implementing MCP protocol, Node 20+, and Zod for validation
TypeScript code must passnpm run typecheck,npm run lint, andnpm test
Files:
src/server/bridge-runtime.tssrc/index.ts
🔇 Additional comments (2)
src/server/bridge-runtime.ts (1)
25-53: LGTM!Also applies to: 55-61
src/index.ts (1)
56-67: LGTM!Also applies to: 81-85, 102-103
Summary
Testing
npm test -- tests/server-bridge-runtime.test.tsnpm run typechecknpm run lintnpm testnpm run buildnpm run build:dxt:checktools/listagainst the built image.Summary by CodeRabbit
New Features
Tests