惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

大猫的无限游戏
大猫的无限游戏
J
Java Code Geeks
小众软件
小众软件
D
Docker
腾讯CDC
H
Hackread – Cybersecurity News, Data Breaches, AI and More
V
V2EX
博客园 - 叶小钗
GbyAI
GbyAI
Microsoft Azure Blog
Microsoft Azure Blog
Stack Overflow Blog
Stack Overflow Blog
B
Blog RSS Feed
酷 壳 – CoolShell
酷 壳 – CoolShell
博客园 - 【当耐特】
IT之家
IT之家
博客园 - 司徒正美
M
MIT News - Artificial intelligence
T
The Blog of Author Tim Ferriss
The GitHub Blog
The GitHub Blog
罗磊的独立博客
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
L
LangChain Blog
阮一峰的网络日志
阮一峰的网络日志
C
Check Point Blog

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
fix(tui): bound session list recency (#77752) · openclaw/...
vincentkoc · 2026-05-05 · via Recent Commits to openclaw:main

@@ -1,5 +1,9 @@

11

import { describe, expect, it, vi } from "vitest";

22

import { createCommandHandlers } from "./tui-command-handlers.js";

3+

import {

4+

TUI_RECENT_SESSIONS_ACTIVE_MINUTES,

5+

TUI_SESSION_PICKER_LIMIT,

6+

} from "./tui-session-list-policy.js";

3748

type LoadHistoryMock = ReturnType<typeof vi.fn> & (() => Promise<void>);

59

type RunAuthFlow = NonNullable<Parameters<typeof createCommandHandlers>[0]["runAuthFlow"]>;

@@ -16,6 +20,7 @@ async function flushAsyncSelect() {

1620

function createHarness(params?: {

1721

sendChat?: ReturnType<typeof vi.fn>;

1822

getGatewayStatus?: ReturnType<typeof vi.fn>;

23+

listSessions?: ReturnType<typeof vi.fn>;

1924

patchSession?: ReturnType<typeof vi.fn>;

2025

resetSession?: ReturnType<typeof vi.fn>;

2126

runAuthFlow?: RunAuthFlow;

@@ -32,6 +37,7 @@ function createHarness(params?: {

3237

}) {

3338

const sendChat = params?.sendChat ?? vi.fn().mockResolvedValue({ runId: "r1" });

3439

const getGatewayStatus = params?.getGatewayStatus ?? vi.fn().mockResolvedValue({});

40+

const listSessions = params?.listSessions ?? vi.fn().mockResolvedValue({ sessions: [] });

3541

const patchSession = params?.patchSession ?? vi.fn().mockResolvedValue({});

3642

const resetSession = params?.resetSession ?? vi.fn().mockResolvedValue({ ok: true });

3743

const setSession = params?.setSession ?? (vi.fn().mockResolvedValue(undefined) as SetSessionMock);

@@ -64,8 +70,8 @@ function createHarness(params?: {

6470

sessionInfo: {},

6571

};

667267-

const { handleCommand } = createCommandHandlers({

68-

client: { sendChat, getGatewayStatus, patchSession, resetSession } as never,

73+

const { handleCommand, openSessionSelector } = createCommandHandlers({

74+

client: { sendChat, getGatewayStatus, listSessions, patchSession, resetSession } as never,

6975

chatLog: { addUser, addSystem } as never,

7076

tui: { requestRender } as never,

7177

opts: params?.opts ?? {},

@@ -92,7 +98,9 @@ function createHarness(params?: {

9298

return {

9399

handleCommand,

94100

getGatewayStatus,

101+

listSessions,

95102

sendChat,

103+

openSessionSelector,

96104

openOverlay,

97105

closeOverlay,

98106

patchSession,

@@ -114,6 +122,31 @@ function createHarness(params?: {

114122

}

115123116124

describe("tui command handlers", () => {

125+

it("bounds session picker hydration to recent TUI sessions", async () => {

126+

const listSessions = vi.fn().mockResolvedValue({

127+

sessions: [

128+

{

129+

key: "agent:main:main",

130+

displayName: "main",

131+

updatedAt: Date.now(),

132+

},

133+

],

134+

});

135+

const { openSessionSelector } = createHarness({ listSessions });

136+137+

await openSessionSelector();

138+139+

expect(listSessions).toHaveBeenCalledWith({

140+

limit: TUI_SESSION_PICKER_LIMIT,

141+

activeMinutes: TUI_RECENT_SESSIONS_ACTIVE_MINUTES,

142+

includeGlobal: false,

143+

includeUnknown: false,

144+

includeDerivedTitles: true,

145+

includeLastMessage: true,

146+

agentId: "main",

147+

});

148+

});

149+117150

it("renders the sending indicator before chat.send resolves", async () => {

118151

let resolveSend: (value: { runId: string }) => void = () => {

119152

throw new Error("sendChat promise resolver was not initialized");