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
[Bug]: Duplicate [hooks.state."…"] tables accumulate in codex-runtime-home/config.toml on every close→reopen, breaking Codex startup #3190
On Windows, Orca's managed Codex config at
%APPDATA%\orca\codex-runtime-home\home\config.toml accumulates duplicate
[hooks.state."<abs-path-to-hooks.json>:::"] tables across
close/reopen cycles. Because duplicate keys/tables are invalid in TOML, the next
launch fails to parse the file and the agent will not start.
This looks like an append-instead-of-update serializer bug: hook-trust state
is re-written (appended) on shutdown rather than replaced in place, so the same
quoted-path key is emitted more than once. It is very likely compounded by the
process-lifecycle bug described in the optional second issue (a stale Orca/Codex
process surviving window close means two writers touch the same file).
Steps to reproduce
Use Codex in Orca in a workspace that has a hooks.json with a SessionStart
(session_start) hook, so Orca persists hook-trust state.
Close the Orca window.
Reopen Orca (or relaunch the Codex agent in the same workspace).
Repeat the close→reopen cycle a few times.
Actual behavior
Codex fails to start and emits a TOML parse error pointing at a [hooks.state."…"]
table. Example (line number varies as duplicates accumulate; username redacted):
Inspecting config.toml shows the same [hooks.state."…hooks.json:session_start:0:0"]
header present two or more times. Removing the duplicate header(s) and relaunching
resolves it immediately — until the next close→reopen cycle reintroduces the duplicate.
Expected behavior
Hook-trust state should be updated in place (one table per unique hook key),
never appended as a duplicate.
If a malformed/duplicate config.toml is encountered on startup, Orca should
surface a clear, recoverable error (and ideally self-heal the managed file it owns)
rather than failing the agent launch.
Suspected root cause
The [hooks.state] serializer appends a new table per shutdown instead of
replacing the existing entry keyed by the absolute hooks.json path + event +
indices.
A stale Orca/Codex process surviving window close (see optional second issue)
causes overlapping writes to the same config.toml, increasing the chance of
duplication.
Opened PR #3196 with a focused fix for the duplicate managed Codex hook-state tables: #3196
What I reproduced:
a Windows-style managed codex-runtime-home\home\hooks.json:session_start:0:0 key duplicated in config.toml
current upsert replaced only the first matching table and left the later duplicate in place, so the malformed TOML never self-healed
What the PR changes:
the Codex trust writer now finds every matching [hooks.state."..."] block for a key
it replaces the first block, removes later duplicates, preserves unrelated hook-state tables, and keeps enabled = false if any duplicate copy had been disabled
This should repair already-duplicated managed config files on the next trust upsert/install path. #3191 may still need a separate Windows lifecycle fix if stale processes remain after window close, but this removes the deterministic config-corruption path.
Thanks for the detailed report @mubeda, I reproduced the important failure mode here: once the managed Codex config.toml contains duplicate [hooks.state."..."] tables, Orca’s trust writer was updating only the first matching table and leaving later duplicates behind, so the file stayed invalid and Codex could not start.
PR #3196 has been updated to make the managed trust writer self-heal this state. On the next Codex hook install/trust sync, Orca now collapses duplicate trust tables for the same key, preserves unrelated hook state, and keeps enabled = false if any duplicate copy had been disabled. We also added regression coverage for the Windows-style codex-runtime-home\home\hooks.json:session_start:0:0 case and the restart-install path.
Hi there! You are welcome, just tried the latest version 1.4.38 , i updated current installation but still facing the same error:
\AppData\Roaming\orca\codex-runtime-home\launch\host\system\home\config.toml:152:14: duplicate key
\AppData\Roaming\orca\codex-runtime-home\home\hooks.json:session_start:0:0".
I uninstalled the application and installed it again.
Same problem.
Also i notice, not sure if related with this issue, that the app , after closed in windows do not starts again. i need to kill the orca process in other to launch it again
I'm looking into it! I do think there were a few separate PRs related to Codex account switching that were pretty involved that could have re-introduced some issues, sorry about that. We'll get a fix out in the next release.
Hi @mubeda , sorry about the delay - this was fixed in the latest release. Please let me know if you run into any more trouble. Appreciate your patience, we're actively working on increasing reliability for Windows.
i just cleanup and uninstall everything and removed manually the C:\Users\MYYSER\AppData\Roaming\orca (the uninstaller do not delete it so if you install and launch codex the error appears first start )
I installed the new version 1.4.48.0 . The first time works, the second time i open a codex terminal for a different project while the other is still open i got the error again.
I can confirm this issue is still present in V1.4.81-rc2. The duplicate [hooks.state.*] keys continue to accumulate, and I've encountered a new critical symptom that may be relevant to the ongoing fix in #4710:
New Symptom: batchWrite Persistence Failure
When users apply the read-only workaround (attrib +R) to prevent further duplicate key corruption, the TUI fails to persist legitimate hook trust updates with:
Failed to trust hooks: config/batchWrite failed while updating hook trust in TUI:
config/batchWrite failed: failed to persist config.toml (code -32603)
Read-only config → TUI cannot trust new hooks → batchWrite fails with -32603
Reproduction Context (V1.4.81-rc2)
OS: Windows
Trigger: Opening multiple Codex terminals for the same project concurrently (different from @mubeda's report above)
The serializer still appends double-quote escaped keys ([hooks.state."C:\\..."]) without deduplicating against existing single-quote literal keys ([hooks.state.'C:\...'])
yes, i still have this issue, the only way i avoided this problem is not trusting hooks anymore. Before ,I was fixing manually config.toml removing the duplicated hooks.
Activity
nwparker commentedon May 29, 2026
Opened PR #3196 with a focused fix for the duplicate managed Codex hook-state tables: #3196
What I reproduced:
codex-runtime-home\home\hooks.json:session_start:0:0key duplicated inconfig.tomlWhat the PR changes:
[hooks.state."..."]block for a keyenabled = falseif any duplicate copy had been disabledValidation:
pnpm exec vitest run --config config/vitest.config.ts src/main/codex/config-toml-trust.test.ts src/main/codex/hook-service.test.ts src/main/agent-hooks/installer-utils-remote.test.ts(89 tests)pnpm run typecheck:nodepnpm exec oxlint src/main/codex/config-toml-trust.ts src/main/codex/config-toml-trust.test.tsgit diff --checkgit merge-tree --write-tree origin/main HEADThis should repair already-duplicated managed config files on the next trust upsert/install path. #3191 may still need a separate Windows lifecycle fix if stale processes remain after window close, but this removes the deterministic config-corruption path.
nwparker commentedon May 30, 2026
Oh wait, @brennanb2025 might have fixed this one yesterday
nwparker commentedon May 30, 2026
@mubeda can you update to the latest Orca version?
brennanb2025 commentedon May 30, 2026
Thanks for the detailed report @mubeda, I reproduced the important failure mode here: once the managed Codex
config.tomlcontains duplicate[hooks.state."..."]tables, Orca’s trust writer was updating only the first matching table and leaving later duplicates behind, so the file stayed invalid and Codex could not start.PR #3196 has been updated to make the managed trust writer self-heal this state. On the next Codex hook install/trust sync, Orca now collapses duplicate trust tables for the same key, preserves unrelated hook state, and keeps
enabled = falseif any duplicate copy had been disabled. We also added regression coverage for the Windows-stylecodex-runtime-home\home\hooks.json:session_start:0:0case and the restart-install path.This will be included in the next stable release!
mubeda commentedon Jun 1, 2026
Hi there! You are welcome, just tried the latest version 1.4.38 , i updated current installation but still facing the same error:
\AppData\Roaming\orca\codex-runtime-home\launch\host\system\home\config.toml:152:14: duplicate key
\AppData\Roaming\orca\codex-runtime-home\home\hooks.json:session_start:0:0".
I uninstalled the application and installed it again.
Same problem.
mubeda commentedon Jun 1, 2026
Also i notice, not sure if related with this issue, that the app , after closed in windows do not starts again. i need to kill the orca process in other to launch it again
brennanb2025 commentedon Jun 1, 2026
I'm looking into it! I do think there were a few separate PRs related to Codex account switching that were pretty involved that could have re-introduced some issues, sorry about that. We'll get a fix out in the next release.
brennanb2025 commentedon Jun 5, 2026
Hi @mubeda , sorry about the delay - this was fixed in the latest release. Please let me know if you run into any more trouble. Appreciate your patience, we're actively working on increasing reliability for Windows.
mubeda commentedon Jun 5, 2026
i just cleanup and uninstall everything and removed manually the C:\Users\MYYSER\AppData\Roaming\orca (the uninstaller do not delete it so if you install and launch codex the error appears first start )
I installed the new version 1.4.48.0 . The first time works, the second time i open a codex terminal for a different project while the other is still open i got the error again.
\AppData\Roaming\orca\codex-runtime-home\home\config.toml:147:14: duplicate key
\AppData\Roaming\orca\codex-runtime-home\home\hooks.json:session_start:0:0"]
before installed i ask codex to review my .codex folder settings as well the one i have in the repo. No problem founds on my settings files.
beiton-06 commentedon Jun 20, 2026
@brennanb2025 @Jinwoo-H
I can confirm this issue is still present in V1.4.81-rc2. The duplicate
[hooks.state.*]keys continue to accumulate, and I've encountered a new critical symptom that may be relevant to the ongoing fix in #4710:New Symptom:
batchWritePersistence FailureWhen users apply the read-only workaround (
attrib +R) to prevent further duplicate key corruption, the TUI fails to persist legitimate hook trust updates with:This creates an unrecoverable UX trap:
batchWritefails with-32603Reproduction Context (V1.4.81-rc2)
[hooks.state."C:\\..."]) without deduplicating against existing single-quote literal keys ([hooks.state.'C:\...'])Suggestion for #4710
Please ensure the retry/self-heal logic in #4710 also handles:
-32603codeHappy to provide sanitized config files or test any upcoming patches. Thank you for your work on Windows reliability! 🙏
mubeda commentedon Jun 20, 2026
yes, i still have this issue, the only way i avoided this problem is not trusting hooks anymore. Before ,I was fixing manually config.toml removing the duplicated hooks.
AmethystLiang commentedon Aug 18, 2026
thanks for reporting. looking into it