Repository navigation
fix(desktop): 避免进程台账与登录 PATH 缓存的临时文件冲突(#2376) - #2444
Merged
Merged
Conversation
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
devin-ai-integration
Bot
requested review from
1lck,
Mucheen and
xiaoyumuxi
as code owners
November 26, 2026 12:42
Contributor
Author
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
1 task done
Contributor
Author
There was a problem hiding this comment.
🔍 Devin Review: 1 flag
Not posted on this PR by your GitHub settings — view it in Devin Review. (Configure)
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
21 of 24 tasks
1lck
approved these changes
Nov 27, 2026
1lck
approved these changes
Nov 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
关联 Issue / Linked issue
Closes #2376
PR 类型 / Type
改动说明 / What changes
背景 / Why
两个 Lithe 实例保存进程台账或登录 PATH 缓存时,都可能写到同一个临时文件。一个实例改名后,另一个实例会丢失待提交的文件。台账改名失败时还会留下临时文件。
改动 / Changes
atomicfile.Write。每次写入独占同目录的临时文件,以0600权限保存,在同步并关闭文件后替换目标,失败时清理本次暂存。保留台账 JSON 以及缓存 PATH 的行尾换行。login_path_cache_write。缓存失败不影响本次启动采用的 PATH。不在本 PR 范围内 / Out of scope
本次保证每个文件快照完整发布。台账的读、修改、写之间仍沿用进程内互斥;多个进程对记录的逻辑合并是另一层问题。
类型专属:fix
复现与根因
在
5bdb7d36固定复现顺序:保留一个写入方已写好、尚未改名的文件,然后由另一个写入方保存。台账和 PATH 用例均因第一份暂存消失而失败。另用一个已有目录阻止替换,旧台账在失败后留下process-ledger.json.tmp。两处固定名称写入引入于 #1799(0faecba49)。台账为跨平台实现,登录 shell 缓存用于 Unix。检查项
Activate的启动入口与 Windows 实现、冷热启动缓存调用方,以及台账的登记、移除和清扫路径。范围检查 / Scope checks
功能矩阵 / Feature matrix
login-shell-environment和run-processes-end-with-ide补入测试路径。原生整机验收状态维持 pending。矩阵与变更检查通过,无生成文件。插件归属 / Plugin ownership
UI 验证 / UI evidence
N/A。改动位于后台文件写入。
统一日志系统 / Structured logging
app.background.operation_failed。只传操作名和core.LogErrorFields,不采集 PATH 值。TestEveryLoggedEventIsAcceptedByTheKernel通过。历史日志脚本已移除,未作为通过项。界面文案 / i18n
N/A。无新增界面文案。
逻辑归属 / Logic placement
性能与内存 / Performance and memory
设置 / Settings
N/A。无设置变更。
插件契约 / Plugin contract
N/A。无协议变更。
发行包与资源 / Bundle and resources
无用代码与重构 / Dead code and refactoring
验证 / Verification
desktop-go.sh test -count=1及test -race -count=1,覆盖atomicfile、loginenv、processledgergo test -race -count=5loginenv.Activate,使用受控 shell 和隔离的缓存目录桌面全量测试
scripts/desktop/desktop-go.sh test -json ./...完成,除localshell外均通过。该包在两轮中分别出现 Bash 挂断后作业超过 5 秒仍存活(#2054,已有 PR #2441),以及TestShellSeesItsDirectoryAsTheHostSpelledIt在 PTY 换行到达前即断言。两者均在5bdb7d36的原始生产代码上用 Go overlay 独立复现;本分支单独重跑终端包通过。首轮本地自设 150 秒超时中断了工作台测试,改用仓库默认时限后工作台全包通过。基线的脚本测试缺少 Dev Container 只读检查所需的 fixture,导致三个用例失败。以单独提交补入与 #2441 相同的一行 fixture。本地发行目录只读测试 5/5 通过,后续两组 CI 脚本测试 90/90、28/28 通过。基线 CI
提交
4db017820的桌面 Go 检查在 Linux、macOS 和 Windows 均通过。提交32788255f只补测试数据,格式和脚本 CI 已通过。最新 Linux 插件截图步骤在 5 分钟超时,更新后的 main (59417db70) 在同一步骤、同一时限失败。PR 的 Linux 任务 · main 的 Linux 任务未在本机运行 macOS 或 Windows 原生桌面,本次本地环境为 Ubuntu 22.04.5 amd64、Go 1.27.4。
提交前确认 / Final checks
Link to Devin session: https://app.devin.ai/sessions/72ec0b84bea04de983410b42c58441a0
Open in Devin Desktop: https://app.devin.ai/desktop/session/72ec0b84bea04de983410b42c58441a0?variant=devin
Requested by: @1lck