You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maka.apache.org by "M4n5ter (via GitHub)" <gi...@apache.org> on 2026/08/21 09:10:06 UTC
[PR] fix(desktop): fence stale transcript range failures [maka]
M4n5ter opened a new pull request, #3406:
URL: https://github.com/apache/maka/pull/3406
<details open>
<summary>English</summary>
## Summary
Fence Desktop transcript range reads to the exact renderer registration and Runtime Host source generation that started them. Closing a session or replacing its Host now cancels stale range failures at the registry boundary, while failures from the current registration and source still propagate normally.
Also prevent an obsolete transcript controller from presenting a history-load error after the user has moved to another session or returned through an A → B → A navigation.
This keeps teardown immediate and preserves delivery ACK/backpressure semantics; it does not add consumer reuse, request replay, string-matched cancellation, or a second lifecycle state machine.
Fixes #3394
## Verification
- `npm run lint`
- `npm run format:check`
- `npm --workspace @maka/desktop run typecheck`
- `npm --workspace @maka/desktop test` — 1,018 tests passed
- Added a deterministic lifecycle regression covering consumer close, Runtime Host source replacement, and a real current-source failure.
- Not run: Windows Electron real-window smoke. There is no visual change; the reported race is covered at the owning lifecycle boundary.
## Root cause
`RuntimeHostSessionObservationRegistry` already fenced transcript open/restore work by registration and source identity, but `loadTranscriptBefore` and `loadTranscriptAround` returned the physical observer promises directly. A close or Host replacement could therefore reject an operation that no longer belonged to the current logical consumer, leaking it through Electron IPC and the renderer toast path.
## AI use
Select exactly one:
- [ ] No generative tool made a substantive contribution
- [x] Generative tooling made a substantive contribution
Tool(s) and scope: Codex investigated the lifecycle race, developed the registration/source fencing design, implemented the change and regression coverage, and prepared this draft PR. The human contributor remains responsible for review and submission.
## Checklist
- [x] Tests cover the change and fail without it
- [x] Lint, format, typecheck and the affected suites pass locally
Does this PR entail a change in behavior?
- [x] Yes — stale transcript operations are cancelled instead of surfacing as current-session failures
- [ ] No
</details>
<details>
<summary>中文</summary>
## 概述
将 Desktop transcript range read 绑定到发起它的精确 renderer registration 和 Runtime Host source generation。会话关闭或 Host replacement 后,Registry 会在生命周期边界取消旧 range operation 的失败;当前 registration 和 source 的真实错误仍然正常传播。
同时,过期 transcript controller 在用户切换会话或经历 A → B → A 后,不再有权提交历史读取错误。
该方案保持 teardown 立即执行,也保留 delivery ACK/backpressure 语义;不增加 consumer 复用、请求重放、错误字符串匹配或第二套生命周期状态机。
对应并关闭 #3394。
## 验证
- `npm run lint`
- `npm run format:check`
- `npm --workspace @maka/desktop run typecheck`
- `npm --workspace @maka/desktop test` — 1,018 项测试通过
- 新增确定性生命周期回归测试,覆盖 consumer close、Runtime Host source replacement 和当前 source 的真实失败。
- 未运行 Windows Electron real-window smoke。本次没有视觉变更;报告中的竞态已在拥有该生命周期的边界完成覆盖。
## 根因
`RuntimeHostSessionObservationRegistry` 已经用 registration/source identity fence 保护 transcript open 和 restore,但 `loadTranscriptBefore`、`loadTranscriptAround` 直接返回物理 observer Promise。因此 close 或 Host replacement 可以拒绝一个已经不属于当前逻辑 consumer 的 operation,最终通过 Electron IPC 和 renderer toast 泄漏为当前错误。
## AI 使用
- [ ] 没有生成式工具作出实质贡献
- [x] 生成式工具作出了实质贡献
工具和范围:Codex 排查生命周期竞态、设计 registration/source fencing、实施修改与回归覆盖,并准备本 draft PR。最终审查与提交责任仍由人类贡献者承担。
## Checklist
- [x] 测试覆盖本次变更,并会在修复前失败
- [x] 本地 lint、format、typecheck 和受影响测试套件均已通过
本 PR 是否改变行为?
- [x] 是——过期 transcript operation 会被取消,不再作为当前会话错误呈现
- [ ] 否
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org
Re: [PR] fix(desktop): fence stale transcript range failures [maka]
Posted by "M4n5ter (via GitHub)" <gi...@apache.org>.
M4n5ter merged PR #3406:
URL: https://github.com/apache/maka/pull/3406
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org