Skip to content

feat(protocol): Add sync messaging protocol fields for turn-based coordination#239

Open
khaliqgant wants to merge 2 commits intomainfrom
feature/sync-messaging-protocol-483
Open

feat(protocol): Add sync messaging protocol fields for turn-based coordination#239
khaliqgant wants to merge 2 commits intomainfrom
feature/sync-messaging-protocol-483

Conversation

@khaliqgant
Copy link
Collaborator

Summary

  • Fix AckPayload.response type from boolean to string for richer status codes ('OK', 'ERROR', custom)
  • Add JSDoc documentation for correlationId, response, responseData fields in AckPayload
  • Update sendSyncAck() signature and call sites to use string response values
  • Add comprehensive unit tests for sync messaging types (16 new tests)

Changes

File Change
src/protocol/types.ts Fix response?: booleanresponse?: string, add JSDoc
src/wrapper/base-wrapper.ts Update sendSyncAck() parameter type
src/wrapper/tmux-wrapper.ts Use 'OK'/'ERROR' string values
src/wrapper/relay-pty-orchestrator.ts Use 'OK'/'ERROR' string values
src/daemon/server.test.ts Update test to use response: 'OK'
src/wrapper/client.test.ts Update test to use response: 'OK'
src/protocol/sync-messaging.test.ts NEW - 16 comprehensive unit tests

Design Decision

Changed AckPayload.response from boolean to string per design doc (SYNC_MESSAGING_PROTOCOL.md:81) to support richer response status codes like 'OK', 'ERROR', 'ACCEPTED', etc. This is backwards compatible as the field remains optional.

Test plan

  • TypeScript compilation passes
  • All 16 new sync messaging tests pass
  • Existing daemon and client tests updated and passing
  • Backwards compatible (all sync fields are optional)

Closes #483

🤖 Generated with Claude Code

@my-senior-dev-pr-review
Copy link

my-senior-dev-pr-review bot commented Jan 20, 2026

🤖 My Senior Dev — Analysis Complete

👤 For @khaliqgant

📁 Expert in src/bridge/ (14 edits) • ⚡ 95th PR this month

View your contributor analytics →


📊 8 files reviewed • 2 need attention

⚠️ Needs Attention:

  • src/protocol/types.ts — Modifications to protocol types which could affect messaging integrity and API compatibility.
  • src/protocol/types.ts — The added response fields in the AckPayload may require updates in all places where this interface is used.

🚀 Open Interactive Review →

The full interface unlocks features not available in GitHub:

  • 💬 AI Chat — Ask questions on any file, get context-aware answers
  • 🔍 Smart Hovers — See symbol definitions and usage without leaving the diff
  • 📚 Code Archeology — Understand how files evolved over time (/archeology)
  • 🎯 Learning Insights — See how this PR compares to similar changes

💬 Chat here: @my-senior-dev explain this change — or try @chaos-monkey @security-auditor @optimizer @skeptic @junior-dev

📖 View all 12 personas & slash commands

You can interact with me by mentioning @my-senior-dev in any comment:

In PR comments or on any line of code:

  • Ask questions about the code or PR
  • Request explanations of specific changes
  • Get suggestions for improvements

Slash commands:

  • /help — Show all available commands
  • /archeology — See the history and evolution of changed files
  • /profile — Performance analysis and suggestions
  • /expertise — Find who knows this code best
  • /personas — List all available AI personas

AI Personas (mention to get their perspective):

Persona Focus
@chaos-monkey 🐵 Edge cases & failure scenarios
@skeptic 🤨 Challenge assumptions
@optimizer Performance & efficiency
@security-auditor 🔒 Security vulnerabilities
@accessibility-advocate Inclusive design
@junior-dev 🌱 Simple explanations
@tech-debt-collector 💳 Code quality & shortcuts
@ux-champion 🎨 User experience
@devops-engineer 🚀 Deployment & scaling
@documentation-nazi 📚 Documentation gaps
@legacy-whisperer 🏛️ Working with existing code
@test-driven-purist Testing & TDD

For the best experience, view this PR on myseniordev.com — includes AI chat, file annotations, and interactive reviews.

…rdination

- Fix AckPayload.response type from boolean to string for richer status codes
- Add JSDoc documentation for correlationId, response, responseData fields
- Update sendSyncAck() signature and call sites to use 'OK'/'ERROR' strings
- Add comprehensive unit tests for sync messaging types (16 new tests)

This enables request-response patterns and blocking message semantics for
turn-based agent coordination scenarios (e.g., card games, workflows).

Closes #483

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@khaliqgant khaliqgant force-pushed the feature/sync-messaging-protocol-483 branch from d013d27 to e69d764 Compare January 20, 2026 07:31
Add 6 new test cases for daemon pending ACK tracking (agent-relay-484):
- Duplicate correlationId rejection with ERROR
- Missing correlationId in blocking SEND returns ERROR
- Connection cleanup clears pending ACKs
- ACK without correlationId is ignored (but still routed)
- ACK with unmatched correlationId doesn't resolve wrong pending
- Default timeout (30s) when timeoutMs not specified

Total: 8 tests for blocking SEND and ACK correlation logic.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
khaliqgant added a commit that referenced this pull request Jan 23, 2026
…240

Cherry-pick key improvements from stabilization PRs:

From #239 (sync messaging protocol):
- Change AckPayload.response from boolean to string for richer status codes
  ('OK', 'ERROR', 'ACCEPTED', etc.)
- Add JSDoc documentation for sync messaging fields
- Update all call sites to use string values

From #240 (model selection):
- Add model-mapping utility for mapping agent profile models to CLI variants
- Enable cost tracking and model selection per agent
- Integrate mapModelToCli() into spawner for automatic CLI variant selection

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
khaliqgant added a commit that referenced this pull request Jan 23, 2026
…239-240

feat: consolidate sync messaging and model-mapping from PRs #239 and #240
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