fix: report real log and runtime directories instead of Unix paths - #4
Merged
Conversation
The Task Center and the runtime install note spelled out "~/.oneagent/logs" and "~/.oneagent/runtimes". Neither names anything on Windows, where the directories are C:\Users\<name>\.oneagent\... , so both read as wrong to every Windows user. Both directories now come from the backend. The runtime note derives its parent from RuntimeState.installPath, which is already absolute and platform-correct, and falls back to a sentence without a directory when no runtime carries one. The log directory was not exposed at all, so CommandLogDir joins the status paths map. TaskCenter takes logDir as a prop rather than reading WizardContext: that hook throws without a provider, which would have made the component untestable on its own. Also covers PersistRuntimePath's Windows branch, which had no tests despite rewriting the user's PATH. The new tests assert the User scope (never Machine, which would need elevation), the PowerShell flags, the pwsh fallback, and that a missing PowerShell surfaces as an error. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Three conflicts, all the same shape: main reworded the copy while this branch parameterized the paths inside it. Kept main's wording and this branch's parameter, since the two changes are independent. The stale "完整日志:~/.oneagent/logs" key is dropped rather than kept alongside the new one -- nothing references it after the merge, and leaving a hardcoded Unix path in the table invites its reuse. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Collaborator
Author
|
已解决与 main 的冲突( 验证:
|
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.
问题
两处面向用户的文案把 Unix 路径写死在前端:
TaskCenter的「完整日志:~/.oneagent/logs」RuntimeSection的「运行时会安装到 ~/.oneagent/runtimes」两者都是无条件渲染。Windows 上这些目录实际是
C:\Users\<name>\.oneagent\...,所以每个 Windows 用户看到的都是错的路径。改动
两个目录现在都由后端提供。
运行时目录取自
RuntimeState.installPath—— 它已经是绝对且平台正确的路径,且在 runtime 受支持时就有值(不需要已安装)。新增的runtimeRoot()从中截出共同父目录;取不到时退回不含路径的句子,否则会渲染成「运行时会安装到 ,」。日志目录后端压根没暴露,所以把已有的
CommandLogDir()加进了 status 的paths。TaskCenter通过 prop 接收logDir而不是读WizardContext:那个 hook 没有 provider 会抛错,会让组件无法独立测试(改造过程中确实撞到了这点)。顺带补上的测试覆盖
PersistRuntimePath的 Windows 分支此前一行未测,而它会改写用户的 PATH 环境变量。新增测试断言:PATH 只作用于User域(绝不碰需要提权的Machine)、PowerShell 标志完整、pwsh回退可用、缺少 PowerShell 时报错、无目录时不启动进程。做了变异测试确认这些测试有效:把作用域改成
Machine后立刻失败。验证
go vet ./...与go test ./...通过,-race在改动包上通过GOOS=windows go vet ./...干净,全部测试包能为 Windows 目标编译tsc --noEmit与生产构建通过logs字段而失败并已更新未覆盖
静态审查覆盖不到真机运行时行为:
icacls的实际 ACL 效果、PowerShell 执行策略被组策略覆盖的情形、以及 Windows 上真实的终端启动。这些仍需真机或虚拟机验证。🤖 Generated with Claude Code