Skip to content

Commit e830856

Browse files
dimakisclaude
andcommitted
style(transport): combine toClientState fall-through, clarify CREATED exclusion
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent f4a7c45 commit e830856

1 file changed

Lines changed: 2 additions & 5 deletions

File tree

packages/protocol/src/event-store.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,6 @@ function toClientState(state: SessionState): ClientSessionState {
3232
case 'CREATED':
3333
case 'CLOSING':
3434
case 'ENDED':
35-
return 'idle';
36-
// DETACHED/SUSPENDED: return 'idle' as safe default. The server layer
37-
// can override if needed (e.g. to reflect last-known running state).
3835
case 'DETACHED':
3936
case 'SUSPENDED':
4037
return 'idle';
@@ -667,8 +664,8 @@ export class EventStore {
667664
* Returns the number of sessions recovered.
668665
*/
669666
recoverStaleSessions(): number {
670-
// CREATED is excluded: it's transient and moves to STARTING immediately (see isActive comment
671-
// in setSessionState). All other non-terminal states are recovered.
667+
// CREATED excluded: transient state, moves to STARTING synchronously in startChat().
668+
// The crash window between CREATED and STARTING is negligible.
672669
const staleStates = ['ACTIVE', 'STARTING', 'DETACHED', 'SUSPENDED', 'CLOSING'];
673670
const placeholders = staleStates.map(() => '?').join(', ');
674671
// Inline prepare is intentional — this runs once at startup, not worth caching.

0 commit comments

Comments
 (0)