mirror of
https://github.com/coder/coder.git
synced 2026-10-16 14:48:56 +08:00
A process started through the agent's process API without a `workdir` runs in the agent's default directory, but only an explicit `workdir` was recorded in the chat's path store. Repositories touched that way were never watched by the git panel. The path store now records `proc.workDir`, the directory the process actually ran in, whether requested or defaulted. ### Before https://github.com/user-attachments/assets/b98c290a-0c77-4ce4-bb00-eb4088d2067e ### After https://github.com/user-attachments/assets/0383aa1a-eced-4338-97af-3c54501cdedb <details> <summary>Decision log</summary> The git panel's refresh button should show everything a page reload would. Investigation found five ways it didn't, each fixed in its own PR on the current `changes` protocol: 1. `execute` without a workdir didn't record the directory the process ran in (`agent/agentproc`). 2. Refresh only rescanned repos already being watched, so a repo created or recreated after its path was recorded stayed hidden (`agent/agentgit`). A connection with no repos also got no first message. 3. After a git watch reconnect, the new full state was merged into the previous connection's map, so deleted repos stayed visible (`useGitWatcher`). 4. A chat watch reconnect didn't refetch the open chat, so missed `diff_status_change` events were lost (`AgentsPageLayout`). 5. Refresh didn't refetch the chat, whose diff statuses back the PR tabs, and was disabled until git context existed (`GitPanel`, `AgentChatPageView`). Considered and deferred: a snapshot protocol with diffs fetched by hash, which would keep large multi-repo diffs under the 4 MiB proxy read limit, and making scans faster at scale. Neither is needed to fix refresh, and together they made a single ~5900-line change that couldn't be reviewed. The refresh spinner still runs for a fixed time, since tying it to the response needs a request ID in the protocol. </details> --- _Generated by Coder Agents on behalf of @DanielleMaywood._