fix: persist workbench code agent sessions

This commit is contained in:
lyon
2026-05-26 00:37:29 +08:00
parent 8f80a6f9c3
commit c6adf34f27
7 changed files with 209 additions and 30 deletions
+12 -3
View File
@@ -628,9 +628,9 @@ function runStaticSmoke() {
evidence: ["DEFAULT_API_TIMEOUT_MS=4500 for light probes", `DEFAULT_CODE_AGENT_TIMEOUT_MS=${codeAgentLongTimeoutMs}`, "sendAgentMessage passes timeoutMs"]
});
addCheck(checks, blockers, "code-agent-trace-replay-disclosure", hasCodeAgentTraceReplayDisclosure(files), "Trace replay panels disclose full trace access and preserve open/scroll state while live trace updates.", {
addCheck(checks, blockers, "code-agent-trace-replay-disclosure", hasCodeAgentTraceReplayDisclosure(files), "Trace replay panels auto-replay full trace, avoid compressed-window UI, and preserve open/scroll state while live trace updates.", {
blocker: "observability_blocker",
evidence: ["显示全部可读事件 / 压缩窗口", "复制 JSON", "下载 trace", "traceDetailsOpen", "traceScrollPositions", "internal scroll for full trace"]
evidence: ["显示全部可读事件 / 完整 trace 回放中", "复制 JSON", "下载 trace", "traceDetailsOpen", "traceScrollPositions", "internal scroll for full trace"]
});
addCheck(checks, blockers, "code-agent-provider-readiness-visibility", hasCodeAgentReadinessVisibility(files), "Workbench shows provider/stdio blockers without exposing credential internals and only long-lived Codex stdio replies can become full Code Agent completion.", {
@@ -1978,6 +1978,8 @@ function hasDefaultLoginEntry({ html, app, auth, styles }, artifactPublisher = "
/DEFAULT_AUTH_PASSWORD\s*=\s*["']hwlab2026["']/u.test(auth) &&
/HWLAB_CLOUD_WEB_CONFIG\?\.auth/u.test(auth) &&
/AUTH_STORAGE_KEY\s*=\s*["']hwlab\.cloudWorkbench\.auth\.v1["']/u.test(auth) &&
/const localSession = readLocalSession\(config\)/u.test(auth) &&
/writeLocalSession\(config\)/u.test(functionBody(auth, "attemptLogin")) &&
/账号或密码不正确,请重新输入。/u.test(auth) &&
/ensureWorkbenchAuth/u.test(app) &&
/await\s+ensureWorkbenchAuth/u.test(app) &&
@@ -2672,7 +2674,14 @@ function hasCodeAgentTraceReplayDisclosure({ app, styles }) {
return (
/function\s+messageTraceCountText\s*\(/u.test(app) &&
/显示全部可读事件\s+\$\{readableTotal\}\s+\/\s+已载入原始\s+\$\{loadedTotal\}\s+\/\s+后端原始\s+\$\{rawTotal\}/u.test(app) &&
/压缩窗口\s+\$\{readableTotal\}\s+条可读事件\s+\/\s+已载入原始\s+\$\{loadedTotal\}\s+\/\s+后端原始\s+\$\{rawTotal\}/u.test(app) &&
/完整 trace 回放中\s+\/\s+当前可读事件\s+\$\{readableTotal\}\s+\/\s+已载入原始\s+\$\{loadedTotal\}\s+\/\s+后端原始\s+\$\{rawTotal\}/u.test(app) &&
!/压缩窗口\s+\$\{readableTotal\}/u.test(app) &&
/CODE_AGENT_SESSION_STORAGE_KEY\s*=\s*"hwlab\.workbench\.codeAgentSession\.v1"/u.test(app) &&
/function\s+restoreCodeAgentSessionState\s*\(/u.test(app) &&
/function\s+persistCodeAgentSessionState\s*\(/u.test(app) &&
/window\.localStorage\?\.setItem\(CODE_AGENT_SESSION_STORAGE_KEY/u.test(app) &&
/window\.localStorage\?\.removeItem\(CODE_AGENT_SESSION_STORAGE_KEY/u.test(app) &&
/refreshRestoredCodeAgentTraces/u.test(app) &&
/function\s+maybeReplayFullTraceForMessage\s*\(/u.test(app) &&
/function\s+replayFullTrace\s*\(/u.test(app) &&
/function\s+renderTraceEventList\s*\(/u.test(app) &&