Skip to content

Commit 596fcd5

Browse files
committed
remove unused code
1 parent 322543c commit 596fcd5

File tree

2 files changed

+2
-33
lines changed

2 files changed

+2
-33
lines changed

src/bridge/transport.ts

Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -533,7 +533,6 @@ export class WebBridge {
533533
chats: data.chats,
534534
config: this.buildSessionConfig(data),
535535
trust: data.trust ?? false,
536-
startedAt: data.startedAt,
537536
};
538537
} catch (err) {
539538
console.error('[Bridge] Failed to parse session:connected', err);
@@ -694,10 +693,8 @@ export class WebBridge {
694693
* fallback). Messages are NOT loaded here — they are fetched on demand when
695694
* the user selects a chat via `loadChatMessages()`.
696695
*
697-
* When the server provides a `startedAt` timestamp, only chats that were
698-
* created or updated since the server started are shown. This prevents the
699-
* sidebar from filling up with stale chats from previous server sessions.
700-
* Chats that a user resumed (updated) after the server started are included.
696+
* All chats returned by the server are shown in the sidebar — the server
697+
* is the authority on which chats are valid.
701698
*/
702699
private async restoreChats(): Promise<void> {
703700
let summaries: ChatSummary[] | undefined = this.sessionState?.chats;
@@ -726,30 +723,6 @@ export class WebBridge {
726723

727724
if (!summaries?.length) return;
728725

729-
// Filter to only show chats from the current server session.
730-
// A chat qualifies if it was created or updated after the server started,
731-
// or if it is currently running (active right now).
732-
const serverStartedAt = this.sessionState?.startedAt;
733-
if (serverStartedAt) {
734-
const startTime = new Date(serverStartedAt).getTime();
735-
const before = summaries.length;
736-
summaries = summaries.filter((s) => {
737-
// Always show currently running chats
738-
if (s.status === 'running') return true;
739-
// Show if updated (resumed) since server started.
740-
// Timestamps may be epoch millis (number) or ISO strings.
741-
const updated = s.updatedAt ? new Date(s.updatedAt).getTime() : 0;
742-
if (updated >= startTime) return true;
743-
// Show if created since server started (and never updated)
744-
if (!s.updatedAt) {
745-
const created = s.createdAt ? new Date(s.createdAt).getTime() : 0;
746-
if (created >= startTime) return true;
747-
}
748-
return false;
749-
});
750-
console.log(`[Bridge] Filtered chats: ${before} total → ${summaries.length} from current session`);
751-
}
752-
753726
if (!summaries?.length) return;
754727

755728
console.log(`[Bridge] Populating sidebar with ${summaries.length} chat(s)`);

src/bridge/types.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,6 @@ export interface SSESessionConnectedPayload {
182182
variants?: string[];
183183
selectedVariant?: string | null;
184184
trust?: boolean;
185-
/** ISO timestamp of when the server process started. Used to filter stale chats. */
186-
startedAt?: string;
187185
}
188186

189187
export interface SSETrustUpdatedPayload {
@@ -213,8 +211,6 @@ export interface SessionState {
213211
chats?: ChatSummary[];
214212
config?: SessionConfig;
215213
trust?: boolean;
216-
/** ISO timestamp of when the server process started. Used to filter stale chats. */
217-
startedAt?: string;
218214
}
219215

220216
export interface SessionConfig {

0 commit comments

Comments
 (0)