Refresh Azure auth token / hook to run a script on 401 http error? Ref #2484
What feature would you like to see?
The same problem of expiring tokens leading to aborted sessions that was identified in issue #2484 and fixed in commit https://github.com/openai/codex/commit/d1f1e368368622055086d310c2bd78b74f992e0c occurs with Azure bearer tokens. Unlike the OpenAI tokens, in the case of Azure an external script is needed to obtain / refresh the token. If OpenAI / MSFT do not add first party support for Azure to Codex, then perhaps a hook to run a script when an http error 401 takes place would allow us to refresh the tokens. (This would apply to other providers with 1-hr tokens as well.) Otherwise, the 'fix' is quitting codex, refreshing, and reentering, loosing all the conversation history in the process. I am getting GPT-5 to work for close to an hour in general, so this issue is highly problematic.
Are you interested in implementing this feature?
_No response_
Additional information
_No response_
6 Comments
I just encountered this exact same issue. It all of sudden decided to:
I've been coding in this conversation for 3 days, over 11M tokens, the context is invaluable. 😭
Not only did this ruin my session, set me back hours, now I get to comb through the history to rebuild the context, because we have no way to resume a conversation.
EDIT:
Possible solutions:
/resumea conversationHow did you get it to work for 3 days?
I just kept my terminal window open and kept using it.
I really need this feature too
Likewise.
This feature request hasn't received any upvotes in four months, so I'm going to close.