Skip to content

ci: agent test jobs run under systemd limits so a wedge fails fast and leaves evidence - #117

Merged
jaredLunde merged 1 commit into
mainfrom
ci-agent-hang
Oct 3, 2026
Merged

jaredLunde merged 1 commit into
mainfrom
ci-agent-hang

Conversation

@jaredLunde

Copy link
Copy Markdown
Contributor

Summary

The test (agent-rest) / test (agent-code-mode) CI jobs keep wedging at a flat 30:00 with no log. It happened on 3 of the last 4 runs on #115/#116.

  • Memory is ruled out. Measured under emulated runner limits (16G cgroup, 4 CPUs, the exact ci.yml filters): test runs peak at ~0.3 GB / ~80 tasks, and a cold compile at ~3.2 GB of process memory.
  • The test step now runs inside sudo systemd-run --wait with RuntimeMaxSec=11min, MemoryMax=8G, MemorySwapMax=0 and TasksMax=4096.
    • systemd, not the runner, enforces the limits. When the unit stops, it kills everything left in it, including processes that survive SIGKILL or leaked daemons. Then systemd-run returns, so the job fails fast and the always() steps still run.
  • New ci-resources sampler: memory, swap, pressure stats, load, pids, disk, top memory users and D-state processes every 5 s. It's uploaded with nextest.log, so the next wedge leaves evidence.

Validated locally under the emulated limits: 3/3 runs of each suite. A forced tiny MemoryMax fails loudly in 1 s, and a short RuntimeMaxSec kills at 8 s.

To confirm on this PR's first run: that hosted runners allow sudo systemd-run (runner image systemd 255).

🤖 Generated with Claude Code

https://claude.ai/code/session_01JimHGjsfk2Ktm5GxyZJKKk

…he runner

The agent-rest / agent-code-mode wedge leaves the test step in_progress past
nextest's global-timeout, the step timeout and the job timeout, all of which
need the runner to act. Memory exhaustion is ruled out by measurement under
the runner's limits (4 CPUs, 16 GB): run peak ~0.3 GB / 80 tasks, compile
anon peak ~3.2 GB.

The test step now runs nextest via `sudo systemd-run --wait` with
RuntimeMaxSec=11min, MemoryMax=8G, MemorySwapMax=0 and TasksMax=4096, so an
overrun fails loudly with a systemd result and the always() steps still run;
the unit's cgroup kill replaces the pkill sweep. A ci-resources sampler unit
records memory, swap, PSI, pids, disk, top RSS and D-state processes every 5s,
uploaded with nextest.log as an artifact.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JimHGjsfk2Ktm5GxyZJKKk
@jaredLunde
jaredLunde merged commit 71a6b0f into main Oct 3, 2026
20 checks passed
@jaredLunde
jaredLunde deleted the ci-agent-hang branch October 3, 2026 03:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant