You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit d25189d
Browse filesBrowse the repository at this point in the historyBrowse files
fix(server): keep the shared Codex app-server scope alive after a tool OOM kill
Since #17662 every agent scope starts with OOMPolicy=stop. The Codex
app-server is shared by every thread on a provider instance, and the
commands its tools run live in the same scope. When the kernel
OOM-killed one tool process, systemd stopped the whole scope, so the
app-server died and every Codex thread on that instance failed.
AgentScope.wrap now takes `shared`, and the Codex app-server spawn
passes it. On systemd 253 or newer, shared scopes start with
OOMPolicy=continue, so systemd logs the kill and the app-server keeps
running. Claude and terminal scopes keep OOMPolicy=stop. The probe and
the plain-scope fallback for older systemd are unchanged.
With OOMPolicy=continue systemd never records Result=oom-kill, so such
a scope can never explain one thread's failure. It is no longer
tracked for the thread that opened it. Otherwise every later failed
turn on that thread would poll the scope for about 2 seconds, waiting
for a stop that never comes. Launching it still ends the thread's
previous answer, and nothing reads its result, so it gets --collect
like thread-less scopes.
Older user managers cannot set OOMPolicy on a scope. There a shared
scope starts as before and stays tracked for its thread without
--collect, because systemd can still stop it on an OOM kill and record
Result=oom-kill (systemd 252 does).
Not changed:
- The kernel still picks the victim. If it kills the app-server
itself, every thread on the instance still loses it.
- A systemd-oomd kill still ends the whole scope.
- On systemd 253 or newer, a Codex turn that fails because its
app-server was itself killed for memory is no longer labeled
"Killed: out of memory.", since systemd records no OOM result under
OOMPolicy=continue. Before, only the thread that opened the session
got that label.
- Recovering a session whose app-server died is #17046 and #18139.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
0 commit comments