Files
coder/coderd/agentapi
Garrett DelfosseandGarrett Delfosse d1487f62f1 fix: resume workspace context push after coderd rejects it (#32534)
When coderd rejected a workspace context push, the agent kept resending
the same snapshot until it restarted, so fixing the bad file on disk did
not resume sync.

Each retry now rebuilds the request from the newest snapshot. coderd
returns `InvalidArgument` for validation failures, and the agent then
waits for the next change instead of retrying. `Initial` stays set until
a push succeeds. A new agent talking to an old coderd gets no code and
keeps retrying, now with the newest snapshot.

Fixes CODAGT-1640. Touches `agent/agentcontext/push.go`, as #31831 does.

<details>
<summary>Plan context</summary>

This is unit A1 of the Agent Plugins plan (CODAGT-1101, parent
CODAGT-1639): fix workspace-context bugs on main before adapting the
plugins stack, because plugins add more ways for coderd to reject a
push.

- Scope: retry with the newest snapshot when files change; coderd marks
validation errors as permanent so the agent waits for the next change.
- Not included: showing the rejection in the chat or the context panel.
- Verify: unit tests with a fake pusher and a mock clock. Revert: plain
revert, no data.

</details>

---

Generated by Coder Agents on behalf of @f0ssel.

---------

Co-authored-by: Garrett Delfosse <garrett@coder.com>
2026-11-24 13:14:03 +02:00
..
…