agent: log when a configured working directory is rejected and falls back to home
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ả
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.
- 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
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của coder/internal
-
flake
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
-
flake
-
flake
Tất cả issue của coder/internal
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
mksglu/context-mode#1200 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
-
clawsweeper:needs-maintainer-review clawsweeper:needs-product-decision clawsweeper:no-new-fix-pr impact:auth-provider issue-rating: 🌊 off-meta tidepool P2
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 80/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100