agent: route remaining home-directory lookups through usershell EnvInfoer
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 55/100
Hướng nghiên cứu
Bắt đầu với năm tệp Go được liệt kê và kiểm tra cách EnvInfoer đã được truyền qua agent, sử dụng lệnh grep được cung cấp để tìm các lookup trực tiếp còn lại. Hãy lần theo seam usershell hiện có trước khi xác định plumbing cần thiết cho từng subsystem. Hoàn tất khi các lookup của agent không thuộc test bên ngoài agent/usershell không còn bỏ qua EnvInfoer, trong khi agent/agentsocket/socket_windows.go vẫn không thay đổi.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Problem
agent/usershell is the canonical place to resolve a user's home directory and shell, and usershell.EnvInfoer is the injectable seam that lets SSH sessions, the process API, and tests override that resolution (host vs container vs deterministic test environment). coder/coder#26102 routed working-directory resolution, MOTD/hushlogin lookup, manifest path expansion, and secret-file injection through EnvInfoer, and unexported usershell.HomeDir/usershell.Get so the host is no longer reachable directly from the resolution path.
Several agent subsystems still call os.UserHomeDir() (and user.Current()) directly, bypassing the injected EnvInfoer. In a container session, or a test with an injected environment, these resolve the host home directory instead of the intended one.
Remaining sites as of coder/coder#26102:
agent/agentssh/x11.goresolving~/.Xauthorityagent/agentscripts/agentscripts.goexpanding~in script log pathsagent/agentcontextconfig/resolve.goexpanding~in context-config pathsagent/agentfiles/ls.goresolving the home base forLSRelativityHomeagent/agentcontainers/ignore/dir.goresolving the global gitignore home
How to verify
From the coder/coder repo root:
grep -rn 'os\.UserHomeDir\|user\.Current' --include='*.go' agent/ | grep -v '/usershell/' | grep -v '_test.go'
Every hit outside agent/usershell is a direct lookup that does not consult an EnvInfoer.
Desired outcome
These subsystems resolve the home directory through an EnvInfoer (the same one already plumbed into the agent), so injected and container environments are honored consistently. After this, the only direct home/user lookups in the agent tree should live inside agent/usershell, which backs SystemEnvInfo.
Constraints
agent/agentscripts,agent/agentcontextconfig,agent/agentfiles, andagent/agentcontainers/ignoredo not currently receive anEnvInfoer. Threading the seam into each is the bulk of the work, and the reason this is split out from coder/coder#26102 rather than bundled in.agent/agentsocket/socket_windows.gocallsuser.Current()for the current user's SID to set Windows socket ACLs. That is a real OS-identity check, not home/shell resolution, and should stay on the OS user rather than an injectable seam. Leave it as-is.
Follow-up to coder/coder#26102. Parent: coder/internal#1560.
🤖 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
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 80/100
microsoft/magentic-ui#588 ·
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
alexgorbatchev/simple-ptt#3 · 1 bình luận ·
-
Độ 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 75/100
CorrelAid/formtransform#44 ·