Skip to content

fix(memory): keep transcripts out of session detail snapshots - #1172

Merged
xintaofei merged 1 commit into
spacering-net:mainfrom
kogekiplay:fix/project-session-metadata
Nov 18, 2026
Merged

xintaofei merged 1 commit into
spacering-net:mainfrom
kogekiplay:fix/project-session-metadata

Conversation

@kogekiplay

@kogekiplay kogekiplay commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Persistent session-detail panels can keep the last removed transcript through a React useSyncExternalStore alternate-hook snapshot. The main details panel selects the entire runtime session; the auxiliary details tab selects detail and localTurns. Both need only summary, usage and current-model metadata. A shallow comparison suppresses rerenders but does not shrink the snapshot graph.

Project the required metadata before subscribing, then apply live workspace/tab title and status columns. Previous hook snapshots now contain summary/stats/model values rather than the session, detail or turn arrays. The auxiliary panel continues to exclude token usage from its subscription. The resolver's existing entry point and model/usage fallback priorities are preserved.

A local native WKWebView fixture first confirmed the concrete path:

persistent Frame → alternate Fiber → useSyncExternalStore hook.memoizedState → removed runtime session → localTurns[0] → completed reply

Only six known Fiber nodes and twelve hooks were inspected; emitted evidence contains paths/counts, not a heap dump or application objects. A preceding known-field follow-up found the same path, removed it with one ordinary empty-frame commit, and then naturally reclaimed all representatives. This is a bounded previous snapshot, not evidence of accumulating per-cycle leakage.

The final single-factor comparison uses the actual projection helper in this branch, the same persistent shallow subscription, three generated 96-line replies, 720 serial native deltas, 730 native calls/726 distinct script texts, and a fixed natural idle. Only full-session versus projected-metadata selection differs. Both variants share the separately validated #1170 animation release inside the fixture; that repair is not included in this source branch. No live model, user database, real ACP Provider, forced GC, allocation pressure, debugger or heap snapshot was used.

Final native observation Full session Metadata projection
Retired sessions alive / tracked 1 / 3 0 / 3
Retired completed replies alive / tracked 1 / 3 0 / 3
Retired message views alive / tracked 0 / 3 0 / 3
Matching known hook paths session + reply none
Runtime sessions still in store 0 0
Final physical footprint 236.1 MiB 247.1 MiB

The physical totals do not establish a process-byte improvement. The first two session/reply pairs already collected in the control; only the last pair remained in the previous hook snapshot. Known ResizeObserver warnings are preserved in the native records; both variants completed normally with all 720 updates and no unexpected evaluation/report errors.

Validation on freshly fetched official main (bd88b9dac0417057342fca13234b9c19a8b8093d):

  • 33 focused resolver/panel tests passed, including transcript-only selection stability, live model/usage changes, and projected live title/status behavior.
  • Full frontend suite: 790 files / 11,715 tests passed on Node 24.22.3.
  • TypeScript, changed-file ESLint/Prettier, diff check and production frontend build passed.
  • The native comparison above used exact candidate file fingerprints verified before and after source validation.

This repairs avoidable transcript ownership in persistent metadata snapshots. It does not identify the original production WebContent long-term growth, attribute native bytes, or cover all Provider/cache/view ownership paths. Real desktop evidence and its comparison limits are recorded below. No Rust source changes are included.

Extended unpatched desktop control: the earlier memory.6 integration, which does not contain this metadata change, eventually reclaimed all tracked representatives before memory.7 was installed. The same reporter retained nonzero retirement totals 1/1/2 and first reported alive 0/0/0 at 06:04 UTC on November 16; before replacement its same WebContent process was around 364.7 MiB. This later interval followed the separately labelled tab/history activation and local fixture/build activity, with visible/unfocused reports, outside the fixed 30-minute control. Eventual collection therefore does not require this repair, and these late readings cannot be attributed to it. The confirmed repair scope remains avoiding transcript ownership in metadata hook snapshots, rather than proving a permanent leak or a production-byte reduction.

The labelled 0.45.0+memory.7 local integration has now passed 397 related integration tests, types, diagnostics-enabled frontend build, native release packaging/signature/file/archive checks and recorded backup/replacement. The actual installed version/hash/new process identities and unchanged single passive observer were verified. Its completed real desktop workload/recovery remains separate from the native selector comparison above.

The real memory.7 workload and fixed 30-minute recovery have now completed. Native UI verified all 96 lines/END, then normally closed the synthetic tab while preserving the original two tabs. The reply took 34 seconds. The interval contains 120 physical-footprint samples with maximum internal gap 15.09 seconds and checked boundary coverage. Baseline median 324.9 MiB; recovery median 360.8 MiB, lower quartile 340.9 MiB, last-ten-minute median 363.8 MiB. Representative retirement totals stayed 1/1/1, and a fresh matching-reporter report first showed all three alive counters at 0 at 07:01:14 UTC.

This real run has material comparison limits: completion-to-close latency was longer than memory.6, the first intended streaming AX read already saw the completed reply, and document focus changed from 1 to 0 at 06:59:14 UTC before the all-collected report. The earlier memory.6 fixed window stayed focused throughout, and that older integration later collected all representatives too. These serial observations therefore do not isolate a production byte or collection-latency improvement caused by this change. The confirmed repair evidence remains the single-factor native hook-snapshot comparison; original long-term WebContent growth is unresolved.

Persisted-history follow-up on November 16 (same memory.7 process): the same saved 96-line synthetic transcript was opened, connected and normally closed three times, with no new model output. The original two tabs were preserved. The activity counts returned to baseline after each close. Pre-operation physical footprint was 367.8 MiB; the third immediate post-close capture was 459.2 MiB. A separately fixed ten-minute recovery contains 40 samples, maximum internal gap 15.05 seconds and checked boundaries: median 461.6 MiB, lower quartile 460.2 MiB. The retired session/turn/view representatives were still 3/3/3 in that window.

At 08:17:01 UTC, the same reporter naturally reached 0/0/0 while the document remained visible and focused; this was observed before any proposed focus transfer, so that conditional action was not performed. Physical footprint was then about 422.4 MiB. This is additional counterevidence to treating either a short surviving-WeakRef interval as permanent retention or loss of focus as necessary for reclamation. It does not attribute the remaining process bytes to these objects or prove the original growth is fixed.

A separate additional fixed five-minute untouched interval completed with 20 samples, maximum internal gap 15.10 seconds, median 422.6 MiB and lower quartile 422.5 MiB. The representatives remained collected in fresh visible/focused reports. The remaining floor is above the pre-reopen reading; aggregate allocator categories do not supply an ownership chain or allocation stack, so no additional product repair or overall-resolution claim follows from these observations.

@xintaofei

Copy link
Copy Markdown
Collaborator

Verdict: the approach holds, and this is ready to merge as it stands. No changes were needed.

Approach. The fix is the right one. React's useSyncExternalStore keeps the previous hook snapshot, so after a session is removed it holds whatever the selector returned. Before this PR, that was the whole runtime session in the main panel and detail/localTurns in the aux tab. Computing the summary, stats and model inside the useShallow selector means the snapshot never holds the transcript. Wrapping the selector more tightly would not get there.

What I checked

  • Resolver behaviour matches main. Stats still come from sessionStats, then detail.session_stats. The model is still the last model in localTurns, then in detail.turns, then detail.summary.model, then the resolved summary's model. Live title and status still come from the workspace list and tab (src/components/conversations/active-session-details.ts:57-139). The on-demand caller in conversation-detail-header.tsx behaves the same.
  • The main panel now re-renders less (src/components/conversations/conversation-detail-panel.tsx:2805). It used to re-render on every streaming batch because it subscribed to the whole session; now it re-renders only when the summary, stats or model change. Nothing in its render body read store state without subscribing. The other store reads happen in callbacks and effects, so this is a pure improvement.
  • Stats updates still come through. sessionStats is replaced with a new object, not edited in place, so the shallow comparison still sees each change.

Non-blocking notes

  • The selector now runs pickModelFromTurns on every store update. It scans backwards and stops at the first turn with a model, so this is cheap in practice.
  • The doc comment at src/components/layout/aux-panel-session-details-tab.tsx:29 still names resolveActiveSessionDetails, but the tab now calls resolveActiveSessionDetailsFromSnapshot.

Verification

  • tsc --noEmit, eslint . and prettier pass.
  • The focused resolver and panel tests pass (6 files, 100 tests), as does the full frontend suite (790 files, 11,715 tests).
  • The production build passes.
  • A separate review of the diff found nothing blocking.

🤖 Generated with Codeg

@xintaofei
xintaofei merged commit 3f4c863 into spacering-net:main Nov 18, 2026
10 checks passed
xintaofei added a commit that referenced this pull request Nov 18, 2026
This release adds SRN account sign-in and a new Harness Engineering page for MCP servers and skills, adds update-time filters to tasks and hourly ranges to token usage, makes accepting a suggested reply easier on touch devices, fixes a Windows crash and several memory leaks, and updates many agents.

## New

- **Sign in with SRN, the SpaceRing account**, from the new account menu at the left of the status bar, which replaces the quick actions menu.
- **New Harness Engineering page in the workspace sidebar**, where you can browse the SRN Harness catalog and install, update or remove MCP servers and skills, and see when an install has a newer version.
- **MCP servers from all agents now appear in one list.** If agents define the same server differently, both definitions are shown and nothing is merged. Edits keep each config file's format and comments, and are undone if a later write fails.
- **You can filter tasks by when they were last updated**: last 24 hours, last 7 days, last 30 days or all time. The task page and the workspace sidebar share and remember the same choice.
- **Token usage now has "Today" and "Last 24 hours" ranges with hourly charts**, and the dashboard opens on the last 24 hours.
- **A lightbulb button next to Send fills in the agent's suggested reply**, so you no longer need the Tab key on touch devices. (#1186 requested by @Fiveo9)

## Improved

- **Updated Claude Code (claude-agent-acp) to 0.108.0, Codex (codex-acp) to 2.7.0, OpenCode to 2.3.2, Hermes to 0.23.2, CodeBuddy to 2.185.0, Grok to 1.0.89, Kimi Code to 2.6.3, Qoder to 1.1.91, ZCode to 0.88.1 and Command Code to 1.90.0.** When a Codex hook blocks or stops a turn, codeg now shows the hook's reason instead of reporting an empty reply. OpenCode's background compaction setting uses the new version's option.
- **Long branch names in the branch menu stay readable**: merge and rebase actions keep the target branch name visible, and hovering shows the full name.
- **The "New files" and "Files changed" lists under a reply use the same thin scrollbar as the rest of the app.**
- **Updated Next.js and patched dependencies with known security issues.**

## Fixed

- **Fixed codeg occasionally crashing on Windows when several agents run at once**, which also stopped every running agent. (#1185, @ana52070)
- **Reduced memory retained after closing conversations and tabs.** (#1170, #1172, #1173, #1176, @kogekiplay)
- **Codex messages no longer run together while streaming.** For example, a diagram that followed a sentence directly could fail to render.
- **On touch devices, long-pressing to select text no longer opens the conversation menu**, so you can copy, quote or ask about the selection again. (#1182 reported by @z91300)
- **Building from source now works when Cargo is set to use a custom output directory.** (#1171, @kogekiplay)

## Note

- **MCP, Skills, Skill packs and office tools have moved from Settings to the Harness Engineering page.**
- **In Codeg Web, SRN sign-in stays off until the server instance is registered.**

Thanks to @kogekiplay and @ana52070 for contributing to this release, and to @z91300 and @Fiveo9 for the reports.

-----------------------------

# 发布版本 0.46.0

这一版新增 SRN 账号登录,以及管理 MCP 服务器和技能的「驾驭工程」页面;待办任务支持按更新时间筛选,Token 用量支持按小时查看;在触屏设备上采用建议回复更方便;同时修复了 Windows 上的一处崩溃和多处内存泄漏,并更新多个智能体。

## 新增

- **支持用 SpaceRing 账号 SRN 登录**,入口在状态栏左侧新的账号菜单中,该菜单取代了原来的快捷操作菜单。
- **工作区侧边栏新增「驾驭工程」页面**,可以浏览 SRN Harness 目录,安装、更新或移除 MCP 服务器和技能,已安装项有新版本时会提示。
- **所有智能体的 MCP 服务器现在集中显示在一个列表中。** 同一服务器在不同智能体中定义不一致时,两种定义都会显示,不会被合并。修改会保留各配置文件原有的格式和注释;后续写入失败时会撤销已写入的内容。
- **待办任务支持按更新时间筛选**:近 24 小时、近 7 天、近 30 天或全部时间。任务页和工作区侧边栏共用同一个筛选,并记住你的选择。
- **Token 用量新增「今日」和「近 24 小时」两个按小时显示的范围**,打开时默认显示近 24 小时。
- **发送按钮旁新增灯泡按钮,一键填入智能体给出的建议回复**,在触屏设备上不用 Tab 键也能采用。(#1186 由 @Fiveo9 提出)

## 改进

- **Claude Code(claude-agent-acp)更新至 0.108.0,Codex(codex-acp)更新至 2.7.0,OpenCode 更新至 2.3.2,Hermes 更新至 0.23.2,CodeBuddy 更新至 2.185.0,Grok 更新至 1.0.89,Kimi Code 更新至 2.6.3,Qoder 更新至 1.1.91,ZCode 更新至 0.88.1,Command Code 更新至 1.90.0。** Codex 的某一轮被 hook 拦截或中止时,会显示 hook 给出的原因,不再报告为空回复。OpenCode 的后台压缩设置已改用新版的配置项。
- **分支菜单中的长分支名不再被截断**:合并、变基操作会始终显示目标分支名,鼠标悬停可查看完整名称。
- **回复下方的「新增文件」「变更文件」列表改用与应用其他位置一致的细滚动条。**
- **更新 Next.js,并修补了存在已知安全问题的依赖。**

## 修复

- **修复 Windows 上多个智能体同时运行时,codeg 偶尔崩溃并导致所有智能体一起退出的问题。**(#1185,@ana52070)
- **减少关闭会话和标签页后的内存残留。**(#1170、#1172、#1173、#1176,@kogekiplay)
- **修复 Codex 流式输出时相邻消息连在一起的问题**,例如紧跟在一句话后面的图表可能无法渲染。
- **修复触屏设备上长按选择文字时会弹出会话菜单的问题**,现在可以正常复制、引用或针对选中内容提问。(#1182 由 @z91300 反馈)
- **修复 Cargo 设置了自定义输出目录时无法从源码构建的问题。**(#1171,@kogekiplay)

## 注意

- **MCP、技能、技能包和办公工具已从设置移到「驾驭工程」页面。**
- **Codeg Web 中的 SRN 登录在服务器实例注册前不可用。**

感谢 @kogekiplay 和 @ana52070 为本次发布做出的贡献,也感谢 @z91300 和 @Fiveo9 的反馈。
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants