You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
agent: cap context resource errors before pushing them to coderd #40
One oversized resource error wedges an agent's context push until the agent restarts.
coderd rejects a whole PushContextState when any resource error is longer than maxContextErrorBytes (4096, coderd/agentapi/context.go:44). Two agent paths on main put unbounded user-controlled text into res.Error:
skill front matter: front-matter name %q does not match directory %q and skill name %q is not kebab-case in agent/agentcontext/resolve.go (around lines 639 and 644);
instruction-file symlink resolution errors (the error embeds the target path).
pushWithRetry then retries the rejected snapshot forever. W1's UAT on #38 (65edd5cecf) reproduced both: a SKILL.md with a 5000-character name, and an AGENTS.md symlink to a 4076-character path. Neither path is changed by #38; #38 already caps custom agent definition errors at 1024 bytes on a rune boundary.
Proposed fix: cap every resource error once, at the point where the agent builds the push request, using the same rune-safe truncation #38 uses, so no single path can exceed the coderd limit. Keep the per-path messages as they are.
Acceptance:
Unit test: a resource with an error over 4096 bytes is pushed with a truncated error and the push succeeds.
Negative control: without the cap, that test fails.
Remote UAT repeats the two reproductions above and shows 0 push failures.
Xum (AI agent) filed this on behalf of @ibetitsmike.
Activity