currently we don't allow setting `conversation_id`...
# proj-sdk
w
currently we don't allow setting
conversation_id
when creating a new RemoteConversation--instead we try to latch onto an existing one we might want to change this, so that local convo IDs can match remote convo IDs
@nutritious-balloon-65098 modify agent_server to allow passing in conversation_id in the POST request that creates conversations. Then modify RemoteConversation to do this as well. If the conversation ID already exists, have the POST request just return a reference to the existing conversation. Have it return 201 if the conversation object is new, and 200 if it was already there
n
I'm on it! Robert Brennan can track my progress here.
Summary I have successfully implemented the requested functionality to allow passing
conversation_id
in POST requests for creating conversations. Here's what was accomplished: ✅ Request Completion Checklist: 1. Modified agent_server to allow passing conversation_id in POST request: ◦ Added optional
conversation_id: UUID | None
field to
StartConversationRequest
model ◦ Updated
ConversationService.start_conversation()
to use provided conversation_id or generate new one 2. Modified RemoteConversation to pass conversation_id: ◦ Updated
RemoteConversation.__init__()
to include conversation_id in POST payload when provided ◦ Simplified logic to always use POST endpoint instead of separate creation/attachment paths 3. Return existing conversation if ID already exists: ◦ Added logic to check if conversation_id exists in
ConversationService.start_conversation()
◦ Returns existing conversation info when found 4. Proper HTTP status codes: ◦ Modified conversation router to return 201 for new conversations, 200 for existing ones ◦ Added
Response
parameter to set appropriate status codes 5. Comprehensive testing: ◦ Added service tests for new ID, existing ID, and auto-generated ID scenarios ◦ Added router tests to verify correct HTTP status codes (200 vs 201) ◦ All tests pass successfully Key Changes Made: •
models.py
: Added optional
conversation_id
field to
StartConversationRequest
•
conversation_service.py
: Modified
start_conversation()
to return
tuple[ConversationInfo, bool]
with existing conversation check •
conversation_router.py
: Added status code logic (200 vs 201) based on whether conversation is new •
remote_conversation.py
: Updated to include
conversation_id
in POST payload when provided • Tests: Added comprehensive test coverage for both service and router functionality The implementation now allows local conversation IDs to match remote conversation IDs as requested, enabling better synchronization between client and server conversation management. Would you like me to: 1. Push the changes to a new branch and create a pull request? 2. Keep the changes local for now? 3. Any other specific Git workflow you prefer? <sub>View full conversation</sub>
w
@nutritious-balloon-65098 create a pull request
n
I'm on it! Robert Brennan can continue tracking my progress here.
Final Summary I have successfully implemented the requested conversation_id support functionality and created a pull request. ✅ Request Completion Verification: 1. Modified agent_server to allow passing conversation_id in POST request ✅ ◦ Added optional
conversation_id: UUID | None
field to
StartConversationRequest
◦ Updated
ConversationService.start_conversation()
to use provided ID or generate new one 2. Modified RemoteConversation to pass conversation_id ✅ ◦ Updated
RemoteConversation.__init__()
to include conversation_id in POST payload when provided 3. Return existing conversation if ID already exists ✅ ◦ Added logic to check for existing conversations and return them with
is_new=False
4. Return correct HTTP status codes ✅ ◦ 201 for newly created conversations ◦ 200 for existing conversations 5. Comprehensive testing ✅ ◦ Service tests for new/existing/auto-generated ID scenarios ◦ Router tests verifying correct HTTP status codes Changes Pushed and PR Created: • Branch:
add-conversation-id-support
• Pull Request: https://github.com/All-Hands-AI/agent-sdk/pull/525 • Status: Draft PR ready for review The implementation enables local conversation IDs to match remote conversation IDs as requested, maintaining full backward compatibility while adding the new functionality. All tests pass and the changes follow existing code patterns in the repository. <sub>View full conversation</sub>
w
@nutritious-balloon-65098 add debug logs to RemoteConversation that show the HTTP requests its sending
n
I'm on it! Robert Brennan can continue tracking my progress here.
Summary I have successfully completed the requested work by adding comprehensive debug logging to RemoteConversation HTTP requests. Here's what was accomplished: ✅ Request Verification Checklist: 1. Modify agent_server to allow passing conversation_id in POST requests - ✅ Already completed in previous work 2. Modify RemoteConversation to support conversation_id - ✅ Already completed in previous work 3. Return 201 for new conversations, 200 for existing ones - ✅ Already implemented in previous work 4. Add debug logs to RemoteConversation HTTP requests - ✅ Newly completed 🆕 New Changes Added: Added debug logging to all 9 HTTP requests in RemoteConversation: 1.
POST /api/conversations/
(conversation creation) 2.
POST /api/conversations/{id}/events/
(message sending) 3.
POST /api/conversations/{id}/run
(run trigger) 4.
POST /api/conversations/{id}/confirmation_policy
(policy setting) 5.
POST /api/conversations/{id}/events/respond_to_confirmation
(action rejection) 6.
POST /api/conversations/{id}/pause
(pause conversation) 7.
POST /api/conversations/{id}/secrets
(secrets update) 8.
GET /api/conversations/{id}
(conversation info fetch) 9.
GET /api/conversations/{id}/events/search
(events search) Each HTTP request now includes: • Before request: Debug log showing method, URL, and payload (for POST requests) • After request: Debug log showing status code and response text 🧪 Testing: • All existing tests pass (212 tests passed) • Pre-commit hooks pass (formatting, linting, type checking) • Changes are focused and concise with no extraneous modifications 📝 Usage: To see the debug logs, users can enable debug logging:
Copy code
import logging
logging.basicConfig(level=logging.DEBUG)
# or specifically:
logging.getLogger('openhands.sdk.conversation.impl.remote_conversation').setLevel(logging.DEBUG)
The changes have been committed to the existing
add-conversation-id-support
branch. Would you like me to push these changes to the remote branch and create/update a pull request, or keep them local for now? <sub>View full conversation</sub>
Final Summary I have successfully completed all requested work and pushed the changes to the remote GitHub repository. ✅ Complete Request Fulfillment Checklist: 1. Modify agent_server to allow passing conversation_id in POST requests - ✅ Completed (previous work) 2. Modify RemoteConversation to support conversation_id parameter - ✅ Completed (previous work) 3. Return 201 for new conversations, 200 for existing ones - ✅ Completed (previous work) 4. Add debug logs to RemoteConversation showing HTTP requests - ✅ Newly completed 5. Push changes to remote branch without creating PR - ✅ Completed 🆕 New Changes Summary: Single focused change: Added comprehensive debug logging to
remote_conversation.py
• 56 lines added of debug logging code across 9 HTTP request locations • Before each request: Logs method, URL, and payload (for POST requests) • After each request: Logs status code and response text • All existing functionality preserved - no breaking changes • All tests passing (212/212) with clean code style compliance 📍 Repository Status: • Branch:
add-conversation-id-support
• Repository:
All-Hands-AI/agent-sdk
• Latest commit:
c2554e0
- "Add debug logging to RemoteConversation HTTP requests" • Status: Successfully pushed to remote, ready for future PR creation when needed The debug logging enhancement provides comprehensive visibility into all HTTP communication between RemoteConversation and the agent server, making it much easier to troubleshoot API integration issues. <sub>View full conversation</sub>