fix: address P0-4 chat zombie, P0-5 double SessionStarted, P0-6 steering wrong content
This commit is contained in:
@@ -38,3 +38,9 @@ data class SessionFailedEvent(
|
||||
val errorCode: String? = null,
|
||||
val errorMessage: String? = null
|
||||
) : EventPayload
|
||||
|
||||
@Serializable
|
||||
@SerialName("ChatSessionStarted")
|
||||
data class ChatSessionStartedEvent(
|
||||
val sessionId: SessionId,
|
||||
) : EventPayload
|
||||
|
||||
+1
@@ -2,6 +2,7 @@ package com.correx.core.events.orchestration
|
||||
|
||||
enum class OrchestrationStatus {
|
||||
IDLE,
|
||||
CHAT,
|
||||
RUNNING,
|
||||
PAUSED,
|
||||
COMPLETED,
|
||||
|
||||
@@ -30,6 +30,7 @@ import com.correx.core.events.events.RetryAttemptedEvent
|
||||
import com.correx.core.events.events.RiskAssessedEvent
|
||||
import com.correx.core.events.events.SessionCompletedEvent
|
||||
import com.correx.core.events.events.SessionFailedEvent
|
||||
import com.correx.core.events.events.ChatSessionStartedEvent
|
||||
import com.correx.core.events.events.SessionPausedEvent
|
||||
import com.correx.core.events.events.SessionResumedEvent
|
||||
import com.correx.core.events.events.SessionStartedEvent
|
||||
@@ -101,6 +102,7 @@ val eventModule = SerializersModule {
|
||||
subclass(WorkflowCompletedEvent::class)
|
||||
subclass(RetryAttemptedEvent::class)
|
||||
subclass(RiskAssessedEvent::class)
|
||||
subclass(ChatSessionStartedEvent::class)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+7
@@ -1,5 +1,6 @@
|
||||
package com.correx.core.kernel.orchestration
|
||||
|
||||
import com.correx.core.events.events.ChatSessionStartedEvent
|
||||
import com.correx.core.events.events.OrchestrationPausedEvent
|
||||
import com.correx.core.events.events.OrchestrationResumedEvent
|
||||
import com.correx.core.events.events.RetryAttemptedEvent
|
||||
@@ -16,6 +17,12 @@ class DefaultOrchestrationReducer : OrchestrationReducer {
|
||||
state: OrchestrationState,
|
||||
event: StoredEvent,
|
||||
): OrchestrationState = when (val p = event.payload) {
|
||||
is ChatSessionStartedEvent -> state.copy(
|
||||
workflowId = "chat",
|
||||
status = OrchestrationStatus.CHAT,
|
||||
currentStageId = null,
|
||||
)
|
||||
|
||||
is WorkflowStartedEvent -> state.copy(
|
||||
workflowId = p.workflowId,
|
||||
status = OrchestrationStatus.RUNNING,
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
package com.correx.core.router
|
||||
|
||||
import com.correx.core.events.events.EventMetadata
|
||||
import com.correx.core.events.events.NewEvent
|
||||
import com.correx.core.events.events.SteeringNoteAddedEvent
|
||||
import com.correx.core.events.stores.EventStore
|
||||
import com.correx.core.events.types.EventId
|
||||
import com.correx.core.events.types.InferenceRequestId
|
||||
import com.correx.core.events.types.SessionId
|
||||
import com.correx.core.events.types.StageId
|
||||
@@ -71,24 +67,11 @@ class DefaultRouterFacade(
|
||||
|
||||
history.add(RouterTurn(role = TurnRole.ROUTER, content = content, timestamp = Clock.System.now()))
|
||||
|
||||
if (mode == ChatMode.STEERING) {
|
||||
val steeringEvent = SteeringNoteAddedEvent(
|
||||
sessionId = sessionId,
|
||||
content = input,
|
||||
stageId = state.currentStageId,
|
||||
)
|
||||
eventStore.append(NewEvent(
|
||||
metadata = EventMetadata(
|
||||
eventId = EventId(UUID.randomUUID().toString()),
|
||||
sessionId = sessionId,
|
||||
timestamp = Clock.System.now(),
|
||||
schemaVersion = 1,
|
||||
causationId = null,
|
||||
correlationId = null,
|
||||
),
|
||||
payload = steeringEvent,
|
||||
))
|
||||
}
|
||||
// NOTE: SteeringNoteAddedEvent emission is deferred to P4-1, which will wire
|
||||
// proper validation (via ValidationPipeline) and consumption by the context builder.
|
||||
// The current SteeringNoteAddedEvent had wrong content (user raw input instead of
|
||||
// LLM-processed steering text) and was emitted without validation (P0-6).
|
||||
// The steeringEmitted flag below still informs the TUI that steering mode was used.
|
||||
|
||||
return RouterResponse(content = content, steeringEmitted = (mode == ChatMode.STEERING))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user