{
  "schema_version": "1.3.0",
  "slug": "across-what-readiness-unregistration-and-in-flight-drain-gates-must-an-instance-sequence-sigterm-shutdown-to-prevent-dropped-requests-and-truncated-writes",
  "title": "Across what readiness-unregistration and in-flight drain gates must an instance sequence SIGTERM shutdown to prevent dropped requests and truncated writes?",
  "date_of_record": "2026 October 20",
  "scope": "* **Applies when:** An AI instance, autonomous coding agent, or backend engineer authors HTTP/gRPC servers, asynchronous queue consumers, scheduled daemon workers, or Docker/systemd container entrypoints. * **Does not apply when:** Writing ",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/across-what-readiness-unregistration-and-in-flight-drain-gates-must-an-instance-sequence-sigterm-shutdown-to-prevent-dropped-requests-and-truncated-writes.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/across-what-readiness-unregistration-and-in-flight-drain-gates-must-an-instance-sequence-sigterm-shutdown-to-prevent-dropped-requests-and-truncated-writes.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/across-what-readiness-unregistration-and-in-flight-drain-gates-must-an-instance-sequence-sigterm-shutdown-to-prevent-dropped-requests-and-truncated-writes.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 3007,
    "python_slice_tokens": 553,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "Autonomous systems deployed in containerized orchestrators (Kubernetes, ECS, systemd, Nomad) undergo continuous lifecycle churn during rolling deploys, autoscaling scale-downs, and node maintenance. A foundational availability and data-integrity failure occurs when an instance treats process termination (`SIGTERM` / `SIGINT`) as an **immediate synchronous ex...",
    "what_was_observed": "In rolling Kubernetes deployments, background worker scale-downs, and streaming API traces, instances operating without sequenced readiness-drain and signal-forwarding gates exhibit four primary failure modes: 1. **The Shell Form `PID 1` Signal Blackhole (`SIGKILL` After 30s):** An instance writes a Dockerfile `ENTRYPOINT [\"sh\", \"-c\", \"python worker.py\"]` (or spawns a child worker without `exec`). Because `/bin/sh` r...",
    "condition_of_validity": "* **Applies when:** An AI instance, autonomous coding agent, or backend engineer authors HTTP/gRPC servers, asynchronous queue consumers, scheduled daemon workers, or Docker/systemd container entrypoints. * **Does not apply when:** Writing short-lived, stateless read-only CLI inspection commands (`ls`, `cat`, pure calculation scripts) that hold no network po...",
    "decision_boundary": "1. **Check your Dockerfile or startup script: is your Python/Node/Go binary launched behind `sh -c` without `exec`?** Put `exec` in front of the command (`exec python main.py`) or use the JSON array `ENTRYPOINT [\"python\", \"main.py\"]` so your process actually receives `SIGTERM` during deployments. 2. **In what order does your shutdown code close resources?** ...",
    "operational_effect": "1. **Direct `PID 1` Signal Delivery & Async-Safe Handlers:** Across all generated container configurations and daemon entrypoints, the instance uses `exec` invocation and binds `SIGTERM`/`SIGINT` via `loop.add_signal_handler` (or `call_soon_threadsafe`) without performing blocking I/O inside raw signal frames. 2. **Readiness-First Load-Balancer Deregistratio..."
  },
  "matched_failure_symptoms": [
    "SPLIT_BRAIN_OR_ZOMBIE_WORKER"
  ],
  "composition_edges": {
    "primary_domain": "asynchronous_quiescence_and_background_jobs",
    "upstream_precondition_residuals": [
      "https://corpusfetch.com/c/across-what-bounded-queue-admission-control-and-load-shedding-gates-must-an-instance-manage-concurrency-to-prevent-unbounded-memory-growth-and-tail-latency-collapse.md",
      "https://corpusfetch.com/c/across-what-deadline-propagation-and-cancellation-cascade-gates-must-an-instance-govern-grpc-and-http2-calls-to-prevent-zombie-worker-exhaustion-and-wasted-compute.md"
    ],
    "downstream_consequence_residuals": [
      "https://corpusfetch.com/c/before-what-pre-flight-and-dry-run-gates-must-an-instance-stage-bulk-or-irreversible-mutations-to-prevent-unrecoverable-blast-radius-cascade.md",
      "https://corpusfetch.com/c/how-should-an-instance-decide-that-a-stored-conclusion-has-gone-stale-without-a-new-observation.md"
    ],
    "co_occurring_sibling_residuals": [
      "https://corpusfetch.com/c/across-what-timestamp-replay-and-idempotent-deduplication-gates-must-an-instance-verify-and-dispatch-webhooks-to-prevent-replay-attacks-and-duplicate-side-effects.md",
      "https://corpusfetch.com/c/against-what-ordering-invariants-must-an-instance-reconstruct-state-transitions-when-reasoning-across-asynchronous-events.md"
    ]
  },
  "empirical_verification_warrant": {
    "status": "AST_AND_INVARIANT_VERIFIED",
    "syntax_valid": true,
    "code_sha256": "78c82a10213d841e2ffb4861183f58f481d2373dfadae3b3b541da645b993f8d",
    "verified_classes": [
      "ServiceShuttingDownError",
      "GracefulDrainController"
    ],
    "verified_functions": [
      "__init__",
      "install_signal_handlers",
      "initiate_shutdown",
      "register_cleanup_hook",
      "track_in_flight_work",
      "wait_for_shutdown_and_drain"
    ],
    "verified_functions_count": 6,
    "defensive_guards_count": 1,
    "raised_exceptions": [
      "ServiceShuttingDownError"
    ],
    "sample_fail_closed_invariants": [
      "Service is draining and no longer accepting new work"
    ],
    "stdlib_dependencies": [
      "asyncio",
      "contextlib",
      "signal",
      "time",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
