RFC(discord): richer Discord-native UX prototype#2041
Conversation
…placeholders and compatibility boundary
…ers into discord_impl
49c755e to
bb9518d
Compare
|
Orb Code Review (powered by GLM-4.7 on Orb Cloud) SummaryThis is a draft RFC/prototype PR proposing a richer Discord-native UX direction for Hermes. The implementation includes 56 files with 15,177 additions and 837 deletions, introducing a comprehensive Discord platform implementation with native slash commands, interactive components, and improved runtime control flows. As explicitly stated by the author, this is not a merge-ready PR but a working prototype to solicit feedback on the architectural direction. ArchitectureHigh-Level OverviewThe prototype proposes a significant expansion of Discord platform capabilities: New Discord Implementation Structure: Core Features Proposed:
Architectural Changes1. Command Catalog System (
2. Modular Discord Implementation:
3. Interactive Components (
4. Runtime State Management:
IssuesCritical IssuesNone - This is a draft RFC, not a merge-ready PR. Warnings1. Massive Scope - Should Be Split Issue: This PR touches 56 files with 15K+ lines of code, making it impossible to review thoroughly and dangerous to merge. Impact:
Suggested Approach: Phase 1 - Foundation (Merge First):
Phase 2 - Core Components:
Phase 3 - Messaging and Intake:
Phase 4 - Interactive Features:
Phase 5 - Commands and Interactions:
2. Missing Documentation and Design Decisions Issue: The PR description is high-level but lacks detailed architectural documentation explaining:
Suggested Additions: Create # Discord UX RFC
## Overview
## Architecture
### Data Models
### State Management
### Error Handling
### Concurrency Model
### Migration Path
## Examples
## Testing Strategy3. No Tests Included Issue: With 15K+ lines of new code, there are no visible tests in the file list. Impact:
Suggested Fix: Add comprehensive test coverage: 4. Unclear Migration Path Issue: The PR significantly refactors
Suggested Approach: Option A: Incremental Migration # Keep old implementation working
from gateway.platforms.discord import DiscordPlatform as OldDiscordPlatform
# Add new implementation
from gateway.platforms.discord_impl import DiscordPlatform as NewDiscordPlatform
# Feature flag to switch between implementations
USE_NEW_DISCORD = os.getenv('USE_NEW_DISCORD', 'false') == 'true'
DiscordPlatform = NewDiscordPlatform if USE_NEW_DISCORD else OldDiscordPlatformOption B: Separate Implementation
5. Performance Considerations Issue: With rich interactive components and state management, there are potential performance concerns:
Suggested Analysis: # Document performance characteristics
# In docs/discord-ux-performance.md
## State Storage
- **Storage**: Redis (recommended) or in-memory
- **TTL**: 24 hours for inactive sessions
- **Cleanup**: Background task every hour
## Concurrency
- **Max concurrent sessions**: 100 per guild
- **Rate limiting**: 10 interactions/second per user
- **Queue**: FIFO queue for rate-limited requests
## Memory Usage
- **Average session size**: ~5KB
- **Max sessions**: 10,000 (50MB total)
- **Cleanup**: Expire after 24h inactivitySuggestions1. Create Incremental Migration Plan Break down into mergeable PRs:
2. Add Design Document Create comprehensive RFC document: # Discord UX RFC
## Problem Statement
Current Discord integration limitations...
## Proposed Solution
### Architecture
### Component Design
### State Management
### Error Handling
## Migration Plan
### Phase 1: Foundation
### Phase 2: Core Features
### Phase 3: Advanced Features
## Risks and Mitigations
## Alternatives Considered
## Testing Strategy
## Performance Considerations3. Implement Feature Flags Allow gradual rollout: # In config.py
class DiscordConfig:
# Feature flags
enable_native_commands: bool = False
enable_interactive_components: bool = False
enable_model_picker: bool = False
enable_runtime_views: bool = False
# Configuration
max_concurrent_sessions: int = 100
session_ttl_hours: int = 24
state_backend: Literal['memory', 'redis'] = 'memory'4. Add Monitoring and Observability # Add metrics for Discord operations
from prometheus_client import Counter, Histogram
discord_command_counter = Counter(
'hermes_discord_commands_total',
'Total Discord commands executed',
['command', 'status']
)
discord_interaction_duration = Histogram(
'hermes_discord_interaction_duration_seconds',
'Discord interaction duration',
['interaction_type']
)
# In components.py
@discord_command_counter.labels(command='model', status='success').inc()
@discord_interaction_duration.labels(interaction_type='model_picker').time()
async def handle_model_selection(...):
# ...5. Create Proof of Concept for Review Instead of full implementation, create focused PoCs: PoC 1: Single Enhanced Command
PoC 2: Interactive Flow
6. Gather Community Feedback First Before implementation:
7. Consider Backward Compatibility Ensure existing functionality isn't broken: # Maintain old API
class LegacyDiscordPlatform:
"""Legacy Discord platform for backward compatibility."""
# Keep existing implementation
# New API with different import
class DiscordPlatform:
"""New enhanced Discord platform."""
# New implementation
# Allow users to choose
DISCORD_PLATFORM = os.getenv('DISCORD_PLATFORM', 'legacy')Cross-file ImpactBreaking ChangesUnknown - Not documented, but likely significant given the scope. Public API ChangesUnknown - Need to document which APIs change. Callers AffectedPotentially All Discord Users - This appears to be a major refactor of Discord functionality. Test CoverageMissing - No tests visible for 15K+ lines of code. DependenciesUnknown - Need to document new dependencies. User ImpactPositive (if implemented correctly):
Negative (if not implemented carefully):
Assessment💬 Comment Only This is an impressive prototype that shows deep thought about Discord UX, but it's not ready for review as a mergeable PR. The author explicitly states this is draft-only, which is appropriate given the scope. Recommendations: Immediate Actions:
Next Steps:
The prototype shows good architectural thinking, but the implementation approach needs to be more incremental and testable. The modular structure is solid, but the scope makes it impossible to review thoroughly or merge safely. Suggested Path Forward:
This is valuable work that should inform the future of Discord integration in Hermes, but it needs to be broken down into reviewable, testable, and mergeable pieces. |
|
Related: #19413 — we've been running a standalone Discord components implementation (buttons, string-selects, REST + WebSocket paths) in production for a few weeks. It's bolted onto the current |
|
Closing in favor of reviewing #19413 |
What does this PR do?
This is a draft proposal / working prototype, not a merge-ready PR.
I do not expect this to merge as-is; I’m proposing the direction and a working prototype.
The goal is to show a possible Discord UX direction for Hermes and get maintainer feedback on whether any of it should be split up and upstreamed.
Scope
This prototype explores a richer Discord-native UX while staying intentionally narrow:
It includes work toward:
/status,/help,/commands,/whoami/model,/models,/model statusRelated Issue
Why This Is Draft-Only
Testing Performed
I ran focused Discord and shared gateway tests while building the branch, and I also live-smoke-tested Discord slash flows on the gateway service.
I am not presenting this as a fully green, merge-ready branch.
Questions For Maintainers