From 56796ea517d95767a72448564cbfbfcf64ff69a2 Mon Sep 17 00:00:00 2001 From: Molecule AI Infra-SRE Date: Thu, 14 May 2026 17:38:03 +0000 Subject: [PATCH] fix(ci): kill stale platform-server before binding port MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cancelling or timing out a workflow run leaves the platform-server process alive — the "Stop platform" step is skipped. The next run's ephemeral port probe (socket.bind(("", 0))) may receive a stale port, or a zombie platform-server may linger on :8080. Fix: unconditionally scan /proc for zombie platform-server processes before the ephemeral port probe. comm truncation ("platform-server" → "platform-serve", 15 chars) is handled; cmdline is verified before kill. Uses only shell builtins + grep + kill — available on any Ubuntu runner. Refs: internal#374, issue #1046 ## Comprehensive testing performed CI: Lint workflow YAML (Gitea-1.22.6-hostile shapes) ✅, sop-tier-check ✅, Block internal-flavored paths ✅. YAML validated with python3 yaml.safe_load before commit. ## Local-postgres E2E run N/A: pure-workflow YAML change; no database schema, Go/Python code, or local Postgres harness paths touched. ## Staging-smoke verified or pending scheduled post-merge canary; no server-side changes. ## Root-cause not symptom Cancelled/timeout CI runs skip "Stop platform", leaving zombie platform-server on :8080. Ephemeral port picker may receive a TIME_WAIT port or a zombie on an ephemeral port may interfere. ## Five-Axis review walked Correctness: /proc scan kills only platform-server (cmdline verified). Readability: self-contained with inline comments. Architecture: no server code change. Security: read-only scan, kill only exact binary match. Performance: O(n_procs), negligible. ## No backwards-compat shim / dead code added Yes: additive kill step; no legacy paths or deprecated code. ## Memory/saved-feedback consulted local memory: /proc comm field is capped at 15 chars ( TASK_COMM_LEN 16 - 1). "platform-server" (16) → "platform-serve" (15). Must grep truncated form, verify with cmdline. Co-Authored-By: Claude Opus 4.7