Skip to content

[codex] degrade retryable gateway startup failures - #24364

Closed
foras910521-lab wants to merge 1 commit into
NousResearch:mainfrom
foras910521-lab:codex/gateway-startup-degraded
Closed

[codex] degrade retryable gateway startup failures#24364
foras910521-lab wants to merge 1 commit into
NousResearch:mainfrom
foras910521-lab:codex/gateway-startup-degraded

Conversation

@foras910521-lab

Copy link
Copy Markdown
Contributor

What does this PR do?

Keeps the gateway process alive when every configured messaging platform fails startup with retryable errors, and records the gateway as degraded so the reconnect watcher can recover without relying on service-manager restart loops.

Why

Current startup logic already distinguishes retryable and non-retryable adapter failures. However, if no platform connects and the failures are retryable, startup still returns failure and writes startup_failed. That can prevent the in-process reconnect watcher from recovering transient DNS/connectivity failures.

Changes made

  • Preserve existing non-retryable startup behavior: auth/conflict/app-lock style failures still request a clean exit and write startup_failed.
  • For all-retryable startup failures, keep startup alive, leave failed platforms queued for the reconnect watcher, and write gateway_state=degraded with the failure reason.
  • Clear stale exit reasons when startup reaches normal running state.
  • Update startup failure coverage to assert degraded mode and retry queue behavior.

Relationship to upstream #17984

This is intentionally aligned with #17984 in using a degraded process state instead of a fatal startup exit for transient failures. It is narrower around the current main implementation because main already separates retryable from non-retryable startup errors; this PR keeps that distinction so non-retryable failures do not become false healthy/degraded states.

Validation

  • venv/bin/python -m ruff check .
  • scripts/run_tests.sh tests/gateway/test_runner_startup_failures.py tests/gateway/test_platform_reconnect.py tests/gateway/test_runner_fatal_adapter.py tests/gateway/test_status.py

Result: 70 passed.

Scope note

This PR does not change Feishu adapter code, launchd/systemd service definitions, Hindsight/API server lifecycle, Wi-Fi, DNS, system proxy settings, or any third-party proxy app configuration.

@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/gateway Gateway runner, session dispatch, delivery labels May 12, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Likely duplicate of #17984 — both keep gateway alive in degraded mode for retryable startup failures instead of exiting fatally. This PR is narrower and aligned with current main separation of retryable vs non-retryable errors.

@foras910521-lab foras910521-lab closed this by deleting the head repository Jun 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/gateway Gateway runner, session dispatch, delivery P2 Medium — degraded but workaround exists type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants