mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-03-06 16:31:12 +08:00
fix(orchestrator): resolve high-priority issues from code review
1. Race condition fix: Removed frontend direct lockSession call in useOrchestratorExecution.ts - session locking now handled purely via backend WebSocket broadcast (CLI_SESSION_LOCKED) 2. WebSocket handlers: Added handleSessionLockedMessage and handleSessionUnlockedMessage to sessionManagerStore.ts 3. useWebSocket integration: Added case handlers for CLI_SESSION_LOCKED and CLI_SESSION_UNLOCKED messages 4. API input validation: Added validation for sessionConfig, stepTimeout, and errorStrategy in execute-in-session endpoint 5. Fixed wsBroadcast reference: Changed to broadcastToClients from context
This commit is contained in:
@@ -9,6 +9,10 @@ import { useExecutionStore } from '@/stores/executionStore';
|
||||
import { useFlowStore } from '@/stores';
|
||||
import { useCliStreamStore } from '@/stores/cliStreamStore';
|
||||
import { useCliSessionStore } from '@/stores/cliSessionStore';
|
||||
import {
|
||||
handleSessionLockedMessage,
|
||||
handleSessionUnlockedMessage,
|
||||
} from '@/stores/sessionManagerStore';
|
||||
import {
|
||||
OrchestratorMessageSchema,
|
||||
type OrchestratorWebSocketMessage,
|
||||
@@ -212,6 +216,30 @@ export function useWebSocket(options: UseWebSocketOptions = {}): UseWebSocketRet
|
||||
break;
|
||||
}
|
||||
|
||||
case 'CLI_SESSION_LOCKED': {
|
||||
const { sessionKey, reason, executionId, timestamp } = data.payload ?? {};
|
||||
if (typeof sessionKey === 'string') {
|
||||
handleSessionLockedMessage({
|
||||
sessionKey,
|
||||
reason: reason ?? 'Workflow execution',
|
||||
executionId,
|
||||
timestamp: timestamp ?? new Date().toISOString(),
|
||||
});
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case 'CLI_SESSION_UNLOCKED': {
|
||||
const { sessionKey, timestamp } = data.payload ?? {};
|
||||
if (typeof sessionKey === 'string') {
|
||||
handleSessionUnlockedMessage({
|
||||
sessionKey,
|
||||
timestamp: timestamp ?? new Date().toISOString(),
|
||||
});
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case 'CLI_OUTPUT': {
|
||||
const { executionId, chunkType, data: outputData, unit } = data.payload;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user