Skip to content

Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure

TypeScript

fix(llm-proxy): give SIGTERM grace for the finalize retry

Alfredo Lopeze196fb263854
diff --git a/deploy/base/control-plane/codex-llm-proxy.yaml b/deploy/base/control-plane/codex-llm-proxy.yaml
index 6f3b4ebb7..8d8bf0b4f 100644
--- a/deploy/base/control-plane/codex-llm-proxy.yaml
+++ b/deploy/base/control-plane/codex-llm-proxy.yaml
@@ -58,9 +58,10 @@ spec:
# On SIGTERM the proxy stops accepting connections and finishes every
# request it already admitted (#739 D6, R18): queue wait 60 s + body read
# 10 s + redeem 15 s + stream cap (CODEX_LLM_PROXY_MAX_STREAM_DURATION_MS /
- # 1000) + finalize 15 s + 20 s margin. test/deployManifest.test.ts derives
- # this value from the proxy's own constants.
- terminationGracePeriodSeconds: 1920
+ # 1000) + finalize 30 s (one call plus its one retry, 15 s each) + 20 s
+ # margin. test/deployManifest.test.ts derives this value from the proxy's
+ # own constants.
+ terminationGracePeriodSeconds: 1935
securityContext:
runAsNonRoot: true
seccompProfile:
diff --git a/deploy/base/control-plane/grok-llm-proxy.yaml b/deploy/base/control-plane/grok-llm-proxy.yaml
index 6653e6f9c..769a62b8a 100644
--- a/deploy/base/control-plane/grok-llm-proxy.yaml
+++ b/deploy/base/control-plane/grok-llm-proxy.yaml
@@ -53,9 +53,10 @@ spec:
# On SIGTERM the proxy stops accepting connections and finishes every
# request it already admitted (#739 D6, R18): queue wait 60 s + body read
# 10 s + redeem 15 s + stream cap (GROK_LLM_PROXY_MAX_STREAM_DURATION_MS /
- # 1000) + finalize 15 s + 20 s margin. test/deployManifest.test.ts derives
- # this value from the proxy's own constants.
- terminationGracePeriodSeconds: 1920
+ # 1000) + finalize 30 s (one call plus its one retry, 15 s each) + 20 s
+ # margin. test/deployManifest.test.ts derives this value from the proxy's
+ # own constants.
+ terminationGracePeriodSeconds: 1935
securityContext:
runAsNonRoot: true
seccompProfile:
diff --git a/scripts/tests/test-codex-llm-proxy-deploy-contract.sh b/scripts/tests/test-codex-llm-proxy-deploy-contract.sh
index 7e2f1973d..de355dd12 100755
--- a/scripts/tests/test-codex-llm-proxy-deploy-contract.sh
+++ b/scripts/tests/test-codex-llm-proxy-deploy-contract.sh
@@ -129,13 +129,14 @@ if len(stream_ms) != 1 or len(grace) != 1:
"terminationGracePeriodSeconds exactly once"
)
else:
- # Queue wait 60 + body read 10 + redeem 15 + finalize 15 + margin 20.
- # The proxy's test/deployManifest.test.ts derives the same sum from code.
- required_grace = -(-int(stream_ms[0]) // 1000) + 120
+ # Queue wait 60 + body read 10 + redeem 15 + finalize 30 (one retry)
+ # + margin 20. The proxy's test/deployManifest.test.ts derives the same
+ # sum from code.
+ required_grace = -(-int(stream_ms[0]) // 1000) + 135
if int(grace[0]) != required_grace:
errors.append(
f"terminationGracePeriodSeconds must be {required_grace} "
- f"(MAX_STREAM_DURATION_MS / 1000 + 120), found {grace[0]}"
+ f"(MAX_STREAM_DURATION_MS / 1000 + 135), found {grace[0]}"
)
if "codex-llm-proxy.yaml" not in active(kustomize):
diff --git a/scripts/tests/test-grok-llm-proxy-deploy-contract.sh b/scripts/tests/test-grok-llm-proxy-deploy-contract.sh
index 29b90fd0f..f9c617d81 100755
--- a/scripts/tests/test-grok-llm-proxy-deploy-contract.sh
+++ b/scripts/tests/test-grok-llm-proxy-deploy-contract.sh
@@ -117,13 +117,14 @@ if len(stream_ms) != 1 or len(grace) != 1:
"terminationGracePeriodSeconds exactly once"
)
else:
- # Queue wait 60 + body read 10 + redeem 15 + finalize 15 + margin 20.
- # The proxy's test/deployManifest.test.ts derives the same sum from code.
- required_grace = -(-int(stream_ms[0]) // 1000) + 120
+ # Queue wait 60 + body read 10 + redeem 15 + finalize 30 (one retry)
+ # + margin 20. The proxy's test/deployManifest.test.ts derives the same
+ # sum from code.
+ required_grace = -(-int(stream_ms[0]) // 1000) + 135
if int(grace[0]) != required_grace:
errors.append(
f"terminationGracePeriodSeconds must be {required_grace} "
- f"(MAX_STREAM_DURATION_MS / 1000 + 120), found {grace[0]}"
+ f"(MAX_STREAM_DURATION_MS / 1000 + 135), found {grace[0]}"
)
if "grok-llm-proxy.yaml" not in active(kustomize):