Skip to content

fix: apply CODEX_CONFIG thread_unload_delay_secs to the app-server - #646

Open
binbandit wants to merge 1 commit into
agentclientprotocol:mainfrom
binbandit:fix/codex-config-app-server-keys
Open

binbandit wants to merge 1 commit into
agentclientprotocol:mainfrom
binbandit:fix/codex-config-app-server-keys

Conversation

@binbandit

Copy link
Copy Markdown

CODEX_CONFIG gets merged into each thread's config, but the app-server never reads thread_unload_delay_secs from a thread's config. It only uses its own startup config (self.config.thread_unload_delay in thread_processor.rs). So setting it through CODEX_CONFIG does nothing, and a closed session keeps its MCP servers running for the default 60s whatever you set.

Repro: a throwaway CODEX_HOME with one stub stdio MCP server, CODEX_CONFIG='{"thread_unload_delay_secs":5}', then session/new and session/close with no prompt. Then time how long the stub process lives after the close:

  • main: exits 61.8s after session/close
  • this branch: exits 5.8s after session/close

On main the adapter log shows "thread_unload_delay_secs":5 going out in the thread/start config, where Codex ignores it.

Change

hooks already move from CODEX_CONFIG to -c overrides when the app-server starts. This puts thread_unload_delay_secs on the same list. Every other key still goes to the thread config as before.

The helper isn't hooks-only anymore, so CodexHookConfig.ts / prepareCodexHookConfig are renamed to CodexStartupConfig.ts / prepareCodexStartupConfig. readme-dev.md mentions the new key.

I only added the key I could check end to end. Other app-server level keys might have the same problem, and they'd go on the same list.

Testing

  • New CodexStartupConfig.test.ts: fails on main, passes here
  • npm run typecheck, npm test, npm run test:integration and npm run build pass
  • The repro above against the bundled Codex 0.160.1

The app-server reads thread_unload_delay_secs only from its own startup
config, so passing it in the thread config had no effect. Move it to a
`-c` startup override, the same way hooks already are.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant