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

推荐订阅源

V
Visual Studio Blog
爱范儿
爱范儿
GbyAI
GbyAI
博客园 - 叶小钗
Last Week in AI
Last Week in AI
Jina AI
Jina AI
Microsoft Security Blog
Microsoft Security Blog
云风的 BLOG
云风的 BLOG
C
Check Point Blog
H
Help Net Security
P
Proofpoint News Feed
酷 壳 – CoolShell
酷 壳 – CoolShell
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
大猫的无限游戏
大猫的无限游戏
H
Hackread – Cybersecurity News, Data Breaches, AI and More
B
Blog RSS Feed
Y
Y Combinator Blog
U
Unit 42
T
Tailwind CSS Blog
MyScale Blog
MyScale Blog
N
Netflix TechBlog - Medium
S
SegmentFault 最新的问题
J
Java Code Geeks
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知

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(webchat): sessions persist after reconnects (#89017) ...
zhangguiping · 2026-06-23 · via Recent Commits to openclaw:main

@@ -1817,6 +1817,101 @@ describe("initSessionState reset policy", () => {

18171817

expect(result.sessionId).not.toBe(existingSessionId);

18181818

});

181918191820+

it("preserves idle rollover when an ordinary send asserts the current session id", async () => {

1821+

vi.setSystemTime(new Date(2026, 0, 18, 5, 30, 0));

1822+

const root = await makeCaseDir("openclaw-reset-idle-requested-session-ordinary-");

1823+

const storePath = path.join(root, "sessions.json");

1824+

const sessionKey = "agent:main:main";

1825+

const existingSessionId = "webchat-ordinary-session-id";

1826+1827+

await writeSessionStoreFast(storePath, {

1828+

[sessionKey]: {

1829+

sessionId: existingSessionId,

1830+

updatedAt: new Date(2026, 0, 18, 4, 45, 0).getTime(),

1831+

},

1832+

});

1833+1834+

const cfg = {

1835+

session: {

1836+

store: storePath,

1837+

reset: { mode: "daily", atHour: 4, idleMinutes: 30 },

1838+

},

1839+

} as OpenClawConfig;

1840+

const result = await initSessionState({

1841+

ctx: { Body: "hello", SessionKey: sessionKey, Provider: "internal", Surface: "internal" },

1842+

cfg,

1843+

commandAuthorized: true,

1844+

requestedSessionId: existingSessionId,

1845+

});

1846+1847+

expect(result.isNewSession).toBe(true);

1848+

expect(result.sessionId).not.toBe(existingSessionId);

1849+

});

1850+1851+

it("reuses an idle-expired session when a reconnecting client requests current session resume", async () => {

1852+

vi.setSystemTime(new Date(2026, 0, 18, 5, 30, 0));

1853+

const root = await makeCaseDir("openclaw-reset-idle-requested-session-");

1854+

const storePath = path.join(root, "sessions.json");

1855+

const sessionKey = "agent:main:main";

1856+

const existingSessionId = "webchat-reconnect-session-id";

1857+1858+

await writeSessionStoreFast(storePath, {

1859+

[sessionKey]: {

1860+

sessionId: existingSessionId,

1861+

updatedAt: new Date(2026, 0, 18, 4, 45, 0).getTime(),

1862+

},

1863+

});

1864+1865+

const cfg = {

1866+

session: {

1867+

store: storePath,

1868+

reset: { mode: "daily", atHour: 4, idleMinutes: 30 },

1869+

},

1870+

} as OpenClawConfig;

1871+

const result = await initSessionState({

1872+

ctx: { Body: "hello", SessionKey: sessionKey, Provider: "internal", Surface: "internal" },

1873+

cfg,

1874+

commandAuthorized: true,

1875+

requestedSessionId: existingSessionId,

1876+

resumeRequestedSession: true,

1877+

});

1878+1879+

expect(result.isNewSession).toBe(false);

1880+

expect(result.sessionId).toBe(existingSessionId);

1881+

});

1882+1883+

it("does not reuse an idle-expired session for a stale asserted session id", async () => {

1884+

vi.setSystemTime(new Date(2026, 0, 18, 5, 30, 0));

1885+

const root = await makeCaseDir("openclaw-reset-idle-stale-requested-session-");

1886+

const storePath = path.join(root, "sessions.json");

1887+

const sessionKey = "agent:main:main";

1888+

const existingSessionId = "webchat-current-session-id";

1889+1890+

await writeSessionStoreFast(storePath, {

1891+

[sessionKey]: {

1892+

sessionId: existingSessionId,

1893+

updatedAt: new Date(2026, 0, 18, 4, 45, 0).getTime(),

1894+

},

1895+

});

1896+1897+

const cfg = {

1898+

session: {

1899+

store: storePath,

1900+

reset: { mode: "daily", atHour: 4, idleMinutes: 30 },

1901+

},

1902+

} as OpenClawConfig;

1903+

const result = await initSessionState({

1904+

ctx: { Body: "hello", SessionKey: sessionKey, Provider: "internal", Surface: "internal" },

1905+

cfg,

1906+

commandAuthorized: true,

1907+

requestedSessionId: "webchat-stale-session-id",

1908+

resumeRequestedSession: true,

1909+

});

1910+1911+

expect(result.isNewSession).toBe(true);

1912+

expect(result.sessionId).not.toBe(existingSessionId);

1913+

});

1914+18201915

it("drains stale system events when idle rollover creates a new session", async () => {

18211916

vi.setSystemTime(new Date(2026, 0, 18, 5, 30, 0));

18221917

const root = await makeCaseDir("openclaw-reset-idle-system-events-");