Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

agent: log when a configured working directory is rejected and falls back to home

オープン
#1,573 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
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 の本文から書いたものです。

説明

tech-debt

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.ResolveWorkingDir free 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 はありません

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

coder/internal のほかの issue

coder/internal の issue をすべて見る

似ている issue

Backend & API Design の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。