claude -p killed by timeout or systemd: the Sume job keeps running
A supervisor that kills claude -p does not cancel the Sume job it started. List jobs, then wait or cancel before retrying, or you pay twice.

If timeout, systemd or another supervisor kills a headless claude -p session, any Sume job it already submitted keeps running and keeps billing. Sume's docs are explicit that a client-side timeout does not cancel a job: you have only stopped watching (Jobs and results, read 2026-10-04). Before you rerun the wrapper, find the job and either wait for it or cancel it.
What changed in Claude Code 2.1.288
The 2.1.288 changelog entry says it fixed headless (-p and SDK) sessions occasionally ignoring SIGTERM when a supervisor such as timeout or systemd sends SIGCONT alongside it (Claude Code changelog, read 2026-10-04). Before the fix a supervised session could outlive its stop signal. After it, the session ends when asked, which makes the question about what it left behind more important, not less.
What the killed session left behind
A generation job is created on the Sume side the moment the paid call is accepted. The job then runs on its own. Killing the process that submitted it does not change its status, and the job is billed as it would be if you were watching.
| Situation | Job state | What to do |
|---|---|---|
| Killed before submit | No job exists | Safe to rerun |
| Killed after submit, during the wait | Job queued or running | Find the id, then wait or cancel |
| Killed after completion | Job completed and billed | Read the result; do not resubmit |
Find it, then decide
List recent jobs with jobs_list over MCP or GET /v1/jobs, then read the one you want with jobs_status. If you still want the output, wait on it. If you do not, cancel it explicitly. Cancelling a job that is already canceled is idempotent and returns the same canceled job, and a job that cannot be canceled runs to completion.
#!/usr/bin/env bash
set -uo pipefail
: "${SUME_API_KEY:?set SUME_API_KEY}"
timeout 900 claude -p "Render the teaser with Sume and wait for the result"
status=$?
if [ "$status" -ne 0 ]; then
echo "claude exited with $status; check Sume jobs before retrying" >&2
curl -sS "https://api.sume.com/v1/jobs" \
-H "Authorization: Bearer $SUME_API_KEY"
fiMake the rerun safe
Give the paid call a deterministic idempotency_key, so the rerun lands on the same key and does not submit a second paid job. On the hosted MCP the key is required on write and paid tools. Do not resubmit the original paid request just because a local timeout fired; read the job first.
- Log the job id as soon as the submit returns.
- Run the wait step with
jobs_wait, which holds at most 55 seconds per call, and loop. - Cancel only when you are sure you do not want the output.
Sources
Related posts
More in Developers
- claude plugin validate: a clean .mcp.json entry for Sume
Claude Code v2.1.281 makes claude plugin validate check .mcp.json entries. A Sume entry needs only the URL https://mcp.sume.com/mcp and no secret.
- Claude programmatic tool calling skips MCP connector tools: Sume fix
Claude's programmatic tool calling cannot call tools from the MCP connector. Sume's script_run runs the loop on the server instead, with a call journal.
- Sonnet 5.5 on Bedrock has no strict tools: check Sume calls first
Anthropic says strict tool use is unavailable for Claude Sonnet 5.5 on Amazon Bedrock. Validate arguments yourself and use Sume dry_run before paid calls.
- Sonnet 5.5 strict tool schema for a capped Sume Agent Completion
Sonnet 5.5 rejects forced tool_choice, so use auto plus strict: true. A tool schema that makes generation_spend_cap_usd mandatory for Sume Agent Completions.
Written by Sume