Skip to content

Comments

feat(daemon): Add pending ACK tracking for sync messaging (agent-relay-484)#244

Closed
khaliqgant wants to merge 5 commits intomainfrom
agent-relay-484-daemon
Closed

feat(daemon): Add pending ACK tracking for sync messaging (agent-relay-484)#244
khaliqgant wants to merge 5 commits intomainfrom
agent-relay-484-daemon

Conversation

@khaliqgant
Copy link
Collaborator

Summary

Implements pending ACK tracking in the daemon for request-response patterns with blocking message semantics.

Changes

  • Add PendingAck interface and pendingAcks Map to track blocking sends
  • Add handleAck() method to resolve pending ACKs with correlation
  • Add registerPendingAck() to track outgoing blocking sends
  • Add resolvePendingAck() to handle ACK receipt and forwarding
  • Auto-cleanup pending ACKs on connection close
  • Default 30s timeout with configurable override

Features

  • ACK correlation via correlationId field
  • Automatic timeout rejection after 30s (configurable)
  • Forward ACK back to requesting connection
  • Error on duplicate correlationId
  • Error on missing correlationId in blocking SEND
  • Connection cleanup prevents memory leaks

Tests

8 comprehensive test cases covering:

  • Duplicate correlationId rejection
  • Missing correlationId in blocking SEND
  • Connection cleanup clears pending ACKs
  • ACK without correlationId ignored
  • Unmatched correlationId doesn't resolve wrong pending
  • Default timeout (30s)

Closes #484

Agent Relay and others added 5 commits January 20, 2026 07:30
…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>
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>
…y-484)

Implement correlation-based tracking of blocking SEND requests in daemon.
When a SEND request has sync.blocking=true and sync.correlationId:
- Store promise in pendingAcks map with timeout handler
- Resolve when ACK with matching correlationId arrives
- Reject if timeout exceeded before ACK

Enables clients to send blocking messages that wait for specific responses.
@my-senior-dev-pr-review
Copy link

🤖 My Senior Dev — Analysis Complete

👤 For @khaliqgant

📁 Expert in src/bridge/ (17 edits) • ⚡ 101st PR this month

View your contributor analytics →


📊 55 files reviewed • 9 high risk • 9 need attention

🚨 High Risk:

  • src/daemon/server.ts — Core daemon operations logic has been changed, which could critically impact message handling.
  • src/daemon/connection.ts — Changes made around ACK handling are critical for asynchronous messaging reliability.
  • src/bridge/spawner.ts — Significant logic changes affecting the spawner's behavior could lead to improper commands being issued.
  • +2 more

⚠️ Needs Attention:

  • src/protocol/types.ts — Modified data structures could impact message interpretation.
  • src/wrapper/base-wrapper.ts — Changes in how Acks are communicated may affect wrapper interactions.

🚀 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.

@khaliqgant
Copy link
Collaborator Author

Closing as superseded. Pending ACK tracking in the daemon is already implemented in the new package structure at packages/daemon/src/server.ts (lines 67-89, 1036-1089). See #271 for the consolidated improvements from the stabilization PRs.

@khaliqgant khaliqgant closed this Jan 23, 2026
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