fix: ploeg-worker owns the per-run LiteLLM key lifecycle #6
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "agent/vik-585"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
VIK-585
Per-run LiteLLM keys leaked when a run failed because the agent-runner entrypoint revoke was not failure-safe and the worker SIGKILLed the child, defeating shell traps. This PR moves key lifecycle into the worker where it cannot be bypassed.
What changed
pkg/litellm/client.go — LiteLLM API client with Mint/Revoke methods against /key/generate and /key/delete.
cmd/ploeg-worker/main.go — Worker binary that:
ploeg-<12hex>, budget fromLITELLM_KEY_BUDGET, models fromLLM_MODEL, 4h TTL)LLM_API_KEYso agent-runner ≥ 1.0.1 skips its own mint/revokeminted per-run key/revoked per-run key(dashboards grep these)cmd/ploeg-worker/main_test.go — Tests covering agent failure (revoke called), agent success (revoke called), mint failure (no revoke), alias format, trace truncation, client HTTP contract, error responses, and empty models.
ops/helm/ploeg/ — Helm chart for the worker ScaledJob with
LITELLM_API_BASEandLITELLM_MASTER_KEYwired from existing secrets.Verification
ploeg-<12hex>(Grafana join key)Note: The correct base branch for this PR is
development. Please retarget after creation.Built against the stale main stub (no merge base with development) — root cause VIK-589. Re-dispatching after the base sync; kept as reference.
Pull request closed