Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

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

Đang mở
#1,573 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
68/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
go
Lĩnh vực
backend, observability-sre

Hướng nghiên cứu

Đọc usershell.ResolveWorkingDir và hai vị trí gọi, agentssh.Server.resolveWorkingDir và agentproc.manager.resolveWorkingDir. Trước tiên, hãy lần theo việc từ chối của stat/IsDir và quá trình phân giải SSH EnvInfoer. Được xem là hoàn tất khi các chẩn đoán ở mức warn tại các vị trí gọi bao gồm đường dẫn được cấu hình và đường dẫn thực tế đã được phân giải khi một cấu hình không rỗng chuyển về home, trong khi resolver dùng chung vẫn không có logger.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
Không có dữ liệu ngôn ngữ
Star
3
Fork
0
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của coder/internal

Tất cả issue của coder/internal

Issue tương tự

Thêm issue về Backend & API Design

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.