agent: log when a configured working directory is rejected and falls back to home
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 68/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 冷清
- 技术栈
- go
调研方向
阅读 usershell.ResolveWorkingDir 以及两个调用点 agentssh.Server.resolveWorkingDir 和 agentproc.manager.resolveWorkingDir。首先跟踪 stat/IsDir 的拒绝逻辑和 SSH EnvInfoer 的解析过程。当非空配置回退到 home 时,调用点的 warn 级诊断包含配置的路径和实际解析出的路径,同时共享 resolver 仍不包含 logger,即视为完成。
由索引模型根据 Issue 内容生成。
描述
Problem
usershell.ResolveWorkingDir (introduced in coder/coder#26102) uses a configured working directory when it exists as a directory, and otherwise silently falls back to the user's home directory. The callers (the agentssh SSH command and SFTP paths, and agentproc) do not distinguish "used the configured directory" from "fell back to home," so a rejected configured directory produces no log or metric.
Scenario: an admin sets the agent directory to a path that does not exist or is not accessible (bad mount, wrong permissions). SSH and SFTP sessions silently land in $HOME. Nothing correlates the rejected directory with the session, so support cannot explain why sessions start in the wrong place.
This is pre-existing behavior. All three resolvers fell back silently before the unification, which preserved the contract rather than introducing it.
How to verify
Read usershell.ResolveWorkingDir and the two call sites (agentssh.Server.resolveWorkingDir and agentproc.manager.resolveWorkingDir). When the configured directory is non-empty but fails the stat/IsDir check, the function returns the home directory with a nil error and nothing is logged.
Desired outcome
When a non-empty configured working directory is rejected and resolution falls back to home, the agent emits a diagnostic (a warn-level log with the configured and resolved paths) at the call sites that have a logger. The shared resolver stays logger-free.
Constraints
- Keep the shared
usershell.ResolveWorkingDirfree of a logger dependency. The diagnostic belongs at the call sites. - The SSH command path resolves against a per-session EnvInfoer (container override), so the log there should reflect the actual resolved directory rather than assume the host.
Follow-up to coder/coder#26102 (deep-review CRF-1).
🤖 Filed by Coder Agents on behalf of @mafredri.
- 主要语言
- 没有语言数据
- 星标
- 3
- 派生
- 0
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
coder/internal 的其他 Issue
-
flake
难度 2/5 1-3 小时 新手友好度 72/100
-
chore: cleanup http transport debt可能已有人在做 @sreya 于 19 天前认领。 未关闭
-
难度 4/5 3-5 天 新手友好度 45/100
-
flake: TestPubsubCluster/ClusterAuthRequired可能重新可做 @sreya 于 70 天前认领,目前没有进行中的 PR。 未关闭flake
-
flake: TestSnapshotChanged_MultipleConfigFiles (multiple variants)可能重新可做 @Shelnutt2 于 89 天前认领,目前没有进行中的 PR。 未关闭
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 62/100
维护者通常 1 天内回复
-
effort: low prio: low ready
难度 1/5 1 小时以内 新手友好度 82/100
digitalfabrik/integreat-cms#4621 ·
维护者通常 5 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
-
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复
-
support
难度 2/5 1-3 小时 新手友好度 66/100
维护者通常 1 天内回复