mirror of
https://github.com/openai/codex.git
synced 2026-12-02 00:31:03 +00:00
V2 residency eviction removes idle agents from ThreadManager while leaving their logical identities in AgentRegistry. Status queries therefore report NotFound for completed and errored agents after eviction, even though callers can still address those agents. When eviction removes the expected CodexThread, retain its bounded terminal status in the matching AgentMetadata. Under the ThreadManager write lock, publish the status only if the registry still contains the same metadata generation. This makes the status available before the matching removal becomes visible without publishing through a stale metadata handle. Tie each cached status to its CodexThread source. Reloaded threads clear the cache, and status reads reject a cache from another CodexThread. Limit cached text to 128 bytes because status can enter model-visible tool output. Keep existing behavior for interrupted agents and for Missing or Replaced removals, where eviction did not remove the captured thread.