Refactor bridge config and runtime status#52
Conversation
There was a problem hiding this comment.
Code Review
This pull request refactors Claude channel server registration and status reporting by introducing a dedicated registration module and expanding the bridge status interfaces with detailed delivery modes. The runtime logic is updated to utilize these enhanced status fields, and configuration building is consolidated. Feedback was provided to improve the robustness of new tests by parsing JSON output instead of using string-based assertions.
| const status = toolText(result.stdout, 1); | ||
| expect(status).toContain('"claudeBridgeMode": "mcp-config"'); | ||
| expect(status).toContain('"claudeChannelServer": "loop-bridge-7"'); | ||
| expect(status).toContain('"codexDeliveryMode": "app-server"'); | ||
| expect(status).toContain('"hasCodexRemote": true'); | ||
| expect(status).toContain('"hasLiveTmuxSession": false'); |
There was a problem hiding this comment.
The test assertions on the status string are brittle as they rely on specific string formatting. Since agent CLIs in paired tmux runtimes should use newline-delimited JSON on stdout, it is more robust to parse the JSON and assert on the properties using toMatchObject. This prevents the test from failing due to unrelated formatting changes and aligns with the requirement for NDJSON communication.
| const status = toolText(result.stdout, 1); | |
| expect(status).toContain('"claudeBridgeMode": "mcp-config"'); | |
| expect(status).toContain('"claudeChannelServer": "loop-bridge-7"'); | |
| expect(status).toContain('"codexDeliveryMode": "app-server"'); | |
| expect(status).toContain('"hasCodexRemote": true'); | |
| expect(status).toContain('"hasLiveTmuxSession": false'); | |
| const statusJson = JSON.parse(toolText(result.stdout, 1)); | |
| expect(statusJson).toMatchObject({ | |
| claudeBridgeMode: "mcp-config", | |
| claudeChannelServer: "loop-bridge-7", | |
| codexDeliveryMode: "app-server", | |
| hasCodexRemote: true, | |
| hasLiveTmuxSession: false, | |
| }); |
References
- When communicating between agents in a paired tmux runtime, use newline-delimited JSON on stdout for agent CLIs, as Content-Length framing can break registration/connection.
Summary
Verification