# fix\(server\): managed Codex conversations recover after ChatGPT token renewal · pingdotgg/t3code

[View on GitCafe](https://git.cafe/pingdotgg/t3code/commit/39da4237e5dd2fcf9501610c05ad7f0e1ad7dfc9)

Repository: [pingdotgg/t3code](https://git.cafe/pingdotgg/t3code)

Visibility: public

Requested revision: 39da4237e5dd2fcf9501610c05ad7f0e1ad7dfc9

Requested commit: 39da4237e5dd2fcf9501610c05ad7f0e1ad7dfc9

Commit: 39da4237e5dd2fcf9501610c05ad7f0e1ad7dfc9

Tree: 76b2d1ae16e48162fa65bc5b2e7d825d1ab39b77

Author: Lakshmi Tanmay

Committer: Lakshmi Tanmay

## Message

```
fix(server): managed Codex conversations recover after ChatGPT token renewal

Managed ChatGPT sign-in passes the access token to Codex app-server through
its launch environment, and the session manager kept reusing that process
after the token was renewed, so every turn failed with 401 token_expired
until T3 restarted.

Codex sessions now report when the token they launched with no longer
matches the current one (reading it refreshes a token near expiry). Before
reusing an idle session for a new turn, the session manager releases a stale
one, the same way idle release does, and the turn reopens app-server with
the renewed token and resumes the thread.

Fixes #16132

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

```

## Parents

- [611132c171f3a821bd2e32f22261135cef6330ac](https://git.cafe/pingdotgg/t3code/commit/611132c171f3a821bd2e32f22261135cef6330ac?format=markdown)

[Source at this commit](https://git.cafe/pingdotgg/t3code/tree/39da4237e5dd2fcf9501610c05ad7f0e1ad7dfc9?format=markdown)
