agent: log when a configured working directory is rejected and falls back to home
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 68/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 静か
- 技術スタック
- go
調査の方向性
usershell.ResolveWorkingDir と 2 つの呼び出し箇所、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 はありません
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
coder/internal のほかの issue
-
flake
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
-
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
-
flake
-
flake
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 80/100
microsoft/magentic-ui#588 ·
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
alexgorbatchev/simple-ptt#3 · コメント 1 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
CorrelAid/formtransform#44 ·