Skip to content

Codex app-server startup retries can exhaust before replacement server is ready #83959

Description

@chac4l

Summary

On OpenClaw v2026.5.18, a scheduled background agent turn using the Codex harness failed during app-server startup with:

Error: codex app-server client is closed

The local logs showed repeated startup-close handling in the same shape:

codex app-server connection closed during startup; restarting app-server and retrying

After the retry budget was exhausted, a later turn succeeded shortly afterward, which suggests the replacement app-server may still have been warming up when the immediate retries ran.

Impact

A scheduled/background turn can fail before reaching user work, even though the Codex route becomes viable moments later. This is especially noisy for cron-style automation because it reports a job failure even when there is no task-level or repository-level problem.

Expected behavior

When the app-server connection closes during startup, OpenClaw should tolerate a short replacement-server warm-up window before declaring the Codex harness failed.

Useful behavior would be:

  • retry with a small backoff instead of immediately reusing the same failing window
  • use a retry budget large enough for the replacement app-server to bind and become ready
  • preserve the hard failure if the app-server remains unavailable after that bounded window
  • make the terminal error distinguish startup lifecycle exhaustion from task/model failure

Local mitigation tested

A local mitigation increased the startup-close retry budget and added a short bounded backoff between startup retry attempts. After restarting the gateway, a trivial Codex agent smoke test completed successfully and no new startup-close exhaustion was observed.

Related

Possibly related to #79495, which covers shared Codex app-server client eviction across agents. This issue is narrower: even when restarting the app-server is the intended recovery path, the startup retry loop can exhaust before the replacement process is ready.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1High-priority user-facing bug, regression, or broken workflow.clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.impact:crash-loopCrash, hang, restart loop, or process-level availability failure.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions