oh-my-opencode 4.16.2 → 4.16.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (133) hide show
  1. package/.agents/skills/pre-publish-review/SKILL.md +3 -0
  2. package/README.md +2 -2
  3. package/dist/agents/hephaestus/agent.d.ts +1 -1
  4. package/dist/agents/hephaestus/gpt-5-6.d.ts +2 -0
  5. package/dist/agents/momus-gpt-5-6.d.ts +1 -0
  6. package/dist/agents/types.d.ts +2 -0
  7. package/dist/cli/index.js +800 -536
  8. package/dist/cli-node/index.js +800 -536
  9. package/dist/features/background-agent/error-classifier.d.ts +5 -0
  10. package/dist/features/builtin-commands/templates/refactor-sections/intro-and-analysis.d.ts +1 -1
  11. package/dist/features/builtin-commands/templates/remove-ai-slops.d.ts +1 -1
  12. package/dist/index.js +416 -37
  13. package/dist/shared/live-server-route.d.ts +1 -1
  14. package/dist/skills/review-work/SKILL.md +1 -1
  15. package/dist/skills/ulw-plan/references/full-workflow.md +1 -1
  16. package/dist/skills/ulw-research/SKILL.md +2 -2
  17. package/dist/skills/visual-qa/SKILL.md +1 -1
  18. package/dist/tui.js +125 -13
  19. package/package.json +13 -13
  20. package/packages/omo-codex/plugin/.codex-plugin/plugin.json +1 -1
  21. package/packages/omo-codex/plugin/components/bootstrap/dist/cli.js +398 -246
  22. package/packages/omo-codex/plugin/components/bootstrap/hooks/hooks.json +1 -1
  23. package/packages/omo-codex/plugin/components/bootstrap/package.json +1 -1
  24. package/packages/omo-codex/plugin/components/codegraph/package.json +1 -1
  25. package/packages/omo-codex/plugin/components/comment-checker/hooks/hooks.json +1 -1
  26. package/packages/omo-codex/plugin/components/comment-checker/package.json +1 -1
  27. package/packages/omo-codex/plugin/components/git-bash/hooks/hooks.json +2 -2
  28. package/packages/omo-codex/plugin/components/git-bash/package.json +1 -1
  29. package/packages/omo-codex/plugin/components/lazycodex-executor-verify/hooks/hooks.json +1 -1
  30. package/packages/omo-codex/plugin/components/lazycodex-executor-verify/package.json +1 -1
  31. package/packages/omo-codex/plugin/components/lsp/hooks/hooks.json +2 -2
  32. package/packages/omo-codex/plugin/components/lsp/package.json +1 -1
  33. package/packages/omo-codex/plugin/components/rules/bundled-rules/hephaestus/gpt-5.6.md +93 -0
  34. package/packages/omo-codex/plugin/components/rules/dist/cli.js +43 -24
  35. package/packages/omo-codex/plugin/components/rules/hooks/hooks.json +4 -4
  36. package/packages/omo-codex/plugin/components/rules/package.json +1 -1
  37. package/packages/omo-codex/plugin/components/rules/src/codex-hook.ts +2 -1
  38. package/packages/omo-codex/plugin/components/rules/src/dynamic-target-fingerprints.ts +15 -6
  39. package/packages/omo-codex/plugin/components/rules/src/rules-engine-factory.ts +7 -2
  40. package/packages/omo-codex/plugin/components/rules/src/static-injection.ts +2 -2
  41. package/packages/omo-codex/plugin/components/rules/test/codex-hook.test.ts +32 -0
  42. package/packages/omo-codex/plugin/components/rules/test/hephaestus-model-variant.test.ts +106 -0
  43. package/packages/omo-codex/plugin/components/start-work-continuation/hooks/hooks.json +2 -2
  44. package/packages/omo-codex/plugin/components/start-work-continuation/package.json +1 -1
  45. package/packages/omo-codex/plugin/components/teammode/AGENTS.md +12 -9
  46. package/packages/omo-codex/plugin/components/teammode/hooks/hooks.json +1 -1
  47. package/packages/omo-codex/plugin/components/teammode/package.json +1 -1
  48. package/packages/omo-codex/plugin/components/teammode/skills/teammode/SKILL.md +136 -76
  49. package/packages/omo-codex/plugin/components/teammode/skills/teammode/scripts/team-guide.mjs +94 -23
  50. package/packages/omo-codex/plugin/components/teammode/skills/teammode/scripts/team-state.mjs +94 -14
  51. package/packages/omo-codex/plugin/components/teammode/skills/teammode/scripts/team-transport.mjs +55 -0
  52. package/packages/omo-codex/plugin/components/teammode/skills/teammode/scripts/team.mjs +72 -18
  53. package/packages/omo-codex/plugin/components/teammode/test/thread-title-hook.test.ts +23 -0
  54. package/packages/omo-codex/plugin/components/telemetry/hooks/hooks.json +1 -1
  55. package/packages/omo-codex/plugin/components/telemetry/package.json +1 -1
  56. package/packages/omo-codex/plugin/components/ultrawork/agents/explorer.toml +24 -41
  57. package/packages/omo-codex/plugin/components/ultrawork/agents/lazycodex-clone-fidelity-reviewer.toml +1 -1
  58. package/packages/omo-codex/plugin/components/ultrawork/agents/lazycodex-code-reviewer.toml +1 -1
  59. package/packages/omo-codex/plugin/components/ultrawork/agents/lazycodex-executor.toml +2 -2
  60. package/packages/omo-codex/plugin/components/ultrawork/agents/lazycodex-gate-reviewer.toml +1 -1
  61. package/packages/omo-codex/plugin/components/ultrawork/agents/lazycodex-qa-executor.toml +1 -1
  62. package/packages/omo-codex/plugin/components/ultrawork/agents/librarian.toml +21 -49
  63. package/packages/omo-codex/plugin/components/ultrawork/agents/metis.toml +17 -29
  64. package/packages/omo-codex/plugin/components/ultrawork/agents/momus.toml +20 -50
  65. package/packages/omo-codex/plugin/components/ultrawork/agents/plan.toml +18 -39
  66. package/packages/omo-codex/plugin/components/ultrawork/hooks/hooks.json +1 -1
  67. package/packages/omo-codex/plugin/components/ultrawork/package.json +1 -1
  68. package/packages/omo-codex/plugin/components/ultrawork/skills/ulw-plan/references/full-workflow.md +1 -1
  69. package/packages/omo-codex/plugin/components/ulw-loop/hooks/hooks.json +2 -2
  70. package/packages/omo-codex/plugin/components/ulw-loop/package.json +1 -1
  71. package/packages/omo-codex/plugin/components/ulw-loop/skills/ulw-loop/references/full-workflow.md +1 -1
  72. package/packages/omo-codex/plugin/hooks/post-compact-resetting-git-bash-mcp-reminder.json +1 -1
  73. package/packages/omo-codex/plugin/hooks/post-compact-resetting-lsp-diagnostics-cache.json +1 -1
  74. package/packages/omo-codex/plugin/hooks/post-compact-resetting-project-rule-cache.json +1 -1
  75. package/packages/omo-codex/plugin/hooks/post-tool-use-checking-codegraph-init-guidance.json +1 -1
  76. package/packages/omo-codex/plugin/hooks/post-tool-use-checking-comments.json +1 -1
  77. package/packages/omo-codex/plugin/hooks/post-tool-use-checking-lsp-diagnostics.json +1 -1
  78. package/packages/omo-codex/plugin/hooks/post-tool-use-checking-thread-title-hygiene.json +1 -1
  79. package/packages/omo-codex/plugin/hooks/post-tool-use-matching-project-rules.json +1 -1
  80. package/packages/omo-codex/plugin/hooks/pre-tool-use-enforcing-unlimited-goal-budget.json +1 -1
  81. package/packages/omo-codex/plugin/hooks/pre-tool-use-recommending-git-bash-mcp.json +1 -1
  82. package/packages/omo-codex/plugin/hooks/session-start-checking-auto-update.json +1 -1
  83. package/packages/omo-codex/plugin/hooks/session-start-checking-bootstrap-provisioning.json +1 -1
  84. package/packages/omo-codex/plugin/hooks/session-start-checking-codegraph-bootstrap.json +1 -1
  85. package/packages/omo-codex/plugin/hooks/session-start-loading-project-rules.json +1 -1
  86. package/packages/omo-codex/plugin/hooks/session-start-recording-session-telemetry.json +1 -1
  87. package/packages/omo-codex/plugin/hooks/stop-checking-start-work-continuation.json +1 -1
  88. package/packages/omo-codex/plugin/hooks/subagent-stop-checking-start-work-continuation.json +1 -1
  89. package/packages/omo-codex/plugin/hooks/subagent-stop-verifying-lazycodex-executor-evidence.json +1 -1
  90. package/packages/omo-codex/plugin/hooks/user-prompt-submit-checking-ultrawork-trigger.json +1 -1
  91. package/packages/omo-codex/plugin/hooks/user-prompt-submit-checking-ulw-loop-steering.json +1 -1
  92. package/packages/omo-codex/plugin/hooks/user-prompt-submit-loading-project-rules.json +1 -1
  93. package/packages/omo-codex/plugin/package-lock.json +13 -13
  94. package/packages/omo-codex/plugin/package.json +1 -1
  95. package/packages/omo-codex/plugin/scripts/auto-update.mjs +9 -2
  96. package/packages/omo-codex/plugin/scripts/entry-guard.mjs +26 -0
  97. package/packages/omo-codex/plugin/scripts/materialize-shared-upstreams.mjs +3 -1
  98. package/packages/omo-codex/plugin/scripts/migrate-codex-config/multi-agent-v2-guard.mjs +39 -4
  99. package/packages/omo-codex/plugin/scripts/migrate-codex-config/subagent-limit-guard.mjs +24 -4
  100. package/packages/omo-codex/plugin/scripts/migrate-codex-config.mjs +3 -3
  101. package/packages/omo-codex/plugin/scripts/migrate-omo-sot.mjs +2 -2
  102. package/packages/omo-codex/plugin/scripts/sync-hook-status-messages.mjs +2 -2
  103. package/packages/omo-codex/plugin/scripts/sync-skills.mjs +6 -4
  104. package/packages/omo-codex/plugin/scripts/sync-version.mjs +4 -2
  105. package/packages/omo-codex/plugin/skills/init-deep/SKILL.md +1 -1
  106. package/packages/omo-codex/plugin/skills/refactor/SKILL.md +1 -1
  107. package/packages/omo-codex/plugin/skills/remove-ai-slops/SKILL.md +1 -1
  108. package/packages/omo-codex/plugin/skills/review-work/SKILL.md +1 -1
  109. package/packages/omo-codex/plugin/skills/start-work/SKILL.md +1 -1
  110. package/packages/omo-codex/plugin/skills/teammode/SKILL.md +136 -76
  111. package/packages/omo-codex/plugin/skills/teammode/scripts/team-guide.mjs +94 -23
  112. package/packages/omo-codex/plugin/skills/teammode/scripts/team-state.mjs +94 -14
  113. package/packages/omo-codex/plugin/skills/teammode/scripts/team-transport.mjs +55 -0
  114. package/packages/omo-codex/plugin/skills/teammode/scripts/team.mjs +72 -18
  115. package/packages/omo-codex/plugin/skills/ulw-loop/references/full-workflow.md +1 -1
  116. package/packages/omo-codex/plugin/skills/ulw-plan/references/full-workflow.md +1 -1
  117. package/packages/omo-codex/plugin/skills/ulw-research/SKILL.md +2 -2
  118. package/packages/omo-codex/plugin/skills/visual-qa/SKILL.md +2 -2
  119. package/packages/omo-codex/plugin/test/aggregate-agents.test.mjs +47 -1
  120. package/packages/omo-codex/plugin/test/aggregate-skills.test.mjs +4 -2
  121. package/packages/omo-codex/plugin/test/auto-update-restart-notice.test.mjs +33 -0
  122. package/packages/omo-codex/plugin/test/migrate-codex-config.test.mjs +146 -9
  123. package/packages/omo-codex/plugin/test/multi-agent-v2-regression.test.mjs +71 -0
  124. package/packages/omo-codex/plugin/test/subagent-limit-migration.test.mjs +32 -0
  125. package/packages/omo-codex/plugin/test/sync-skills-orchestration.test.mjs +9 -2
  126. package/packages/omo-codex/plugin/test/teammode-transport.test.mjs +345 -0
  127. package/packages/omo-codex/scripts/install-dist/install-local.mjs +436 -284
  128. package/packages/omo-codex/scripts/install-generated-bundle.test.mjs +111 -1
  129. package/packages/shared-skills/skills/review-work/SKILL.md +1 -1
  130. package/packages/shared-skills/skills/ulw-plan/references/full-workflow.md +1 -1
  131. package/packages/shared-skills/skills/ulw-research/SKILL.md +2 -2
  132. package/packages/shared-skills/skills/visual-qa/SKILL.md +1 -1
  133. /package/packages/omo-codex/plugin/components/rules/bundled-rules/{hephaestus.md → hephaestus/gpt-5.5.md} +0 -0
@@ -7,7 +7,7 @@
7
7
  "type": "command",
8
8
  "command": "node \"${PLUGIN_ROOT}/dist/cli.js\" hook user-prompt-submit --with-ultrawork",
9
9
  "timeout": 10,
10
- "statusMessage": "(OmO 4.16.2) Checking Ulw-Loop Steering"
10
+ "statusMessage": "(OmO 4.16.3) Checking Ulw-Loop Steering"
11
11
  }
12
12
  ]
13
13
  }
@@ -20,7 +20,7 @@
20
20
  "type": "command",
21
21
  "command": "node \"${PLUGIN_ROOT}/dist/cli.js\" hook pre-tool-use",
22
22
  "timeout": 5,
23
- "statusMessage": "(OmO 4.16.2) Enforcing Unlimited Ulw-Loop Budget"
23
+ "statusMessage": "(OmO 4.16.3) Enforcing Unlimited Ulw-Loop Budget"
24
24
  }
25
25
  ]
26
26
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@code-yeongyu/codex-ulw-loop",
3
- "version": "4.16.2",
3
+ "version": "4.16.3",
4
4
  "description": "Codex plugin: durable repo-native multi-goal orchestration with embedded success criteria and observable evidence audit.",
5
5
  "type": "module",
6
6
  "packageManager": "npm@11.12.1",
@@ -161,7 +161,7 @@ Loop per goal. Cap at 5 cycles per goal. Cap identical same-criterion failures a
161
161
  2. Register atomic todos via `update_plan` — one ultra-granular step per action, `path: <action> for <criterion> - verify by <check>`. Call `update_plan` on every transition (start → `in_progress`, finish → `completed`); exactly one `in_progress`, mark completed immediately, never batch, never let the rendered plan lag behind reality.
162
162
  3. DELEGATE-IN-PARALLEL: dispatch every independent task in the wave at once via right-sized `multi_agent_v1.spawn_agent` workers (Delegation table). Each worker captures evidence failing-first: when the task touches EXISTING behavior, PIN it FIRST — a characterization test that asserts the current observable behavior and PASSES on the unchanged code, as rigorous as the new-behavior scenario (exact inputs, exact observable, exact assertion). Then RED through the cheapest faithful channel — a unit test where a seam exists, an integration/e2e test where the behavior lives in wiring, or the criterion's scenario captured failing when no test seam exists — failing for the RIGHT reason (no syntax/import error). A test that mirrors its implementation (mock-call assertions, pinned constants, cannot fail under plausible regression) is not evidence; use the scenario as the failing proof instead. Then the SMALLEST GREEN change; before GREEN work that depends on external review, PR, issue, or branch state, refresh current branch/PR/issue state, preserve existing ordering/policy, and separate compatibility detection from policy changes unless the goal explicitly asks to change policy. A GREEN far larger than the criterion implies means the proof was too coarse — instruct a split. Serialize only on a NAMED dependency.
163
163
  4. INTEGRATE + CRITICAL SELF-QA + GIT CHECKPOINT (EVERY WORKER RETURN): do NOT trust the worker's report. Read the diff yourself, re-run its tests, and run LSP diagnostics on the changed files. Treat "done" as a claim to disprove. If the diff drifts, the test is hollow, or evidence is missing, RESPAWN the worker with the specific failure context. Once the work unit is verified, use `git-master` before staging: inspect recent repository commits and touched-path history to infer commit language, Conventional Commit scope, message shape, and unit size. Stage only that unit's files and commit in the observed style; do not carry verified work forward into a later omnibus commit. If no git-tracked files changed or committing is unsafe, record the no-commit reason as evidence. Forward every finding/learning to subsequent workers.
164
- 5. EXECUTE-AS-SCENARIO: ACTUALLY run the Manual-QA scenario the criterion named (channel table above). Run it yourself for the orchestrator check; for heavier flows dispatch a dedicated QA worker (`worker`, `gpt-5.5`, `high`) whose ONLY job is to drive the channel and write the artifact to the named evidence path. If the scenario FAILS, respawn the implementing worker with the captured failure — do not hand-patch around it.
164
+ 5. EXECUTE-AS-SCENARIO: ACTUALLY run the Manual-QA scenario the criterion named (channel table above). Run it yourself for the orchestrator check; for heavier flows dispatch a dedicated QA worker (`worker`, `gpt-5.6-sol`, `xhigh`) whose ONLY job is to drive the channel and write the artifact to the named evidence path. If the scenario FAILS, respawn the implementing worker with the captured failure — do not hand-patch around it.
165
165
  6. CAPTURE: collect the observable artifact path: transcript, stdout, screenshot, assertion, status+body, diff, or parsed dump. No artifact written at the evidence path — not done; record BLOCKED and respawn QA.
166
166
  7. CLEAN (PAIRED, NEVER SKIP): tear down every runtime artifact step 5 spawned BEFORE recording — server PIDs (`kill`, verify `kill -0` fails), `tmux` sessions (`tmux kill-session -t ulw-qa-<criterion>`; confirm `tmux ls`), browser / Playwright contexts (`.close()`), containers (`docker rm -f`), bound ports (`lsof -i :<port>` empty), temp sockets / files / dirs (`rm -rf` the `mktemp` paths), QA-only env vars, AND `multi_agent_v1.close_agent` on every finished worker. Register each teardown as its own todo the moment the QA spawns the resource (scripts, tmux assets, browsers / agent-browser sessions, PIDs, ports) so none is forgotten. Embed a one-line cleanup receipt in the evidence string, e.g. `cleanup: killed 12345; tmux kill-session ulw-qa-foo; rm -rf /tmp/ulw.aB12cD; multi_agent_v1.close_agent w-3`. Missing receipt → record BLOCKED, not PASS.
167
167
  8. RECORD exactly one result:
@@ -7,7 +7,7 @@
7
7
  "type": "command",
8
8
  "command": "node \"${PLUGIN_ROOT}/components/git-bash/dist/cli.js\" hook post-compact",
9
9
  "timeout": 5,
10
- "statusMessage": "(OmO 4.16.2) Resetting Git Bash MCP Reminder",
10
+ "statusMessage": "(OmO 4.16.3) Resetting Git Bash MCP Reminder",
11
11
  "commandWindows": "powershell -NoProfile -ExecutionPolicy Bypass -File \"${PLUGIN_ROOT}\\components\\bootstrap\\scripts\\node-dispatch.ps1\" \"${PLUGIN_ROOT}\\components\\git-bash\\dist\\cli.js\" hook post-compact"
12
12
  }
13
13
  ],
@@ -7,7 +7,7 @@
7
7
  "type": "command",
8
8
  "command": "node \"${PLUGIN_ROOT}/components/lsp/dist/cli.js\" hook post-compact",
9
9
  "timeout": 5,
10
- "statusMessage": "(OmO 4.16.2) Resetting LSP Diagnostics Cache",
10
+ "statusMessage": "(OmO 4.16.3) Resetting LSP Diagnostics Cache",
11
11
  "commandWindows": "powershell -NoProfile -ExecutionPolicy Bypass -File \"${PLUGIN_ROOT}\\components\\bootstrap\\scripts\\node-dispatch.ps1\" \"${PLUGIN_ROOT}\\components\\lsp\\dist\\cli.js\" hook post-compact"
12
12
  }
13
13
  ],
@@ -7,7 +7,7 @@
7
7
  "type": "command",
8
8
  "command": "node \"${PLUGIN_ROOT}/components/rules/dist/cli.js\" hook post-compact",
9
9
  "timeout": 10,
10
- "statusMessage": "(OmO 4.16.2) Resetting Project Rule Cache",
10
+ "statusMessage": "(OmO 4.16.3) Resetting Project Rule Cache",
11
11
  "commandWindows": "powershell -NoProfile -ExecutionPolicy Bypass -File \"${PLUGIN_ROOT}\\components\\bootstrap\\scripts\\node-dispatch.ps1\" \"${PLUGIN_ROOT}\\components\\rules\\dist\\cli.js\" hook post-compact"
12
12
  }
13
13
  ],
@@ -7,7 +7,7 @@
7
7
  "type": "command",
8
8
  "command": "node \"${PLUGIN_ROOT}/components/codegraph/dist/cli.js\" hook post-tool-use",
9
9
  "timeout": 5,
10
- "statusMessage": "(OmO 4.16.2) Checking CodeGraph Init Guidance",
10
+ "statusMessage": "(OmO 4.16.3) Checking CodeGraph Init Guidance",
11
11
  "commandWindows": "powershell -NoProfile -ExecutionPolicy Bypass -File \"${PLUGIN_ROOT}\\components\\bootstrap\\scripts\\node-dispatch.ps1\" \"${PLUGIN_ROOT}\\components\\codegraph\\dist\\cli.js\" hook post-tool-use"
12
12
  }
13
13
  ],
@@ -7,7 +7,7 @@
7
7
  "type": "command",
8
8
  "command": "node \"${PLUGIN_ROOT}/components/comment-checker/dist/cli.js\" hook post-tool-use",
9
9
  "timeout": 30,
10
- "statusMessage": "(OmO 4.16.2) Checking Comments",
10
+ "statusMessage": "(OmO 4.16.3) Checking Comments",
11
11
  "commandWindows": "powershell -NoProfile -ExecutionPolicy Bypass -File \"${PLUGIN_ROOT}\\components\\bootstrap\\scripts\\node-dispatch.ps1\" \"${PLUGIN_ROOT}\\components\\comment-checker\\dist\\cli.js\" hook post-tool-use"
12
12
  }
13
13
  ],
@@ -7,7 +7,7 @@
7
7
  "type": "command",
8
8
  "command": "node \"${PLUGIN_ROOT}/components/lsp/dist/cli.js\" hook post-tool-use",
9
9
  "timeout": 60,
10
- "statusMessage": "(OmO 4.16.2) Checking LSP Diagnostics",
10
+ "statusMessage": "(OmO 4.16.3) Checking LSP Diagnostics",
11
11
  "commandWindows": "powershell -NoProfile -ExecutionPolicy Bypass -File \"${PLUGIN_ROOT}\\components\\bootstrap\\scripts\\node-dispatch.ps1\" \"${PLUGIN_ROOT}\\components\\lsp\\dist\\cli.js\" hook post-tool-use"
12
12
  }
13
13
  ],
@@ -8,7 +8,7 @@
8
8
  "type": "command",
9
9
  "command": "node \"${PLUGIN_ROOT}/components/teammode/dist/cli.js\" hook post-tool-use",
10
10
  "timeout": 10,
11
- "statusMessage": "(OmO 4.16.2) Checking Thread Title Hygiene",
11
+ "statusMessage": "(OmO 4.16.3) Checking Thread Title Hygiene",
12
12
  "commandWindows": "powershell -NoProfile -ExecutionPolicy Bypass -File \"${PLUGIN_ROOT}\\components\\bootstrap\\scripts\\node-dispatch.ps1\" \"${PLUGIN_ROOT}\\components\\teammode\\dist\\cli.js\" hook post-tool-use"
13
13
  }
14
14
  ]
@@ -7,7 +7,7 @@
7
7
  "type": "command",
8
8
  "command": "node \"${PLUGIN_ROOT}/components/rules/dist/cli.js\" hook post-tool-use",
9
9
  "timeout": 10,
10
- "statusMessage": "(OmO 4.16.2) Matching Project Rules",
10
+ "statusMessage": "(OmO 4.16.3) Matching Project Rules",
11
11
  "commandWindows": "powershell -NoProfile -ExecutionPolicy Bypass -File \"${PLUGIN_ROOT}\\components\\bootstrap\\scripts\\node-dispatch.ps1\" \"${PLUGIN_ROOT}\\components\\rules\\dist\\cli.js\" hook post-tool-use"
12
12
  }
13
13
  ],
@@ -7,7 +7,7 @@
7
7
  "type": "command",
8
8
  "command": "node \"${PLUGIN_ROOT}/components/ulw-loop/dist/cli.js\" hook pre-tool-use",
9
9
  "timeout": 5,
10
- "statusMessage": "(OmO 4.16.2) Enforcing Unlimited Goal Budget",
10
+ "statusMessage": "(OmO 4.16.3) Enforcing Unlimited Goal Budget",
11
11
  "commandWindows": "powershell -NoProfile -ExecutionPolicy Bypass -File \"${PLUGIN_ROOT}\\components\\bootstrap\\scripts\\node-dispatch.ps1\" \"${PLUGIN_ROOT}\\components\\ulw-loop\\dist\\cli.js\" hook pre-tool-use"
12
12
  }
13
13
  ],
@@ -7,7 +7,7 @@
7
7
  "type": "command",
8
8
  "command": "node \"${PLUGIN_ROOT}/components/git-bash/dist/cli.js\" hook pre-tool-use",
9
9
  "timeout": 5,
10
- "statusMessage": "(OmO 4.16.2) Recommending Git Bash MCP",
10
+ "statusMessage": "(OmO 4.16.3) Recommending Git Bash MCP",
11
11
  "commandWindows": "powershell -NoProfile -ExecutionPolicy Bypass -File \"${PLUGIN_ROOT}\\components\\bootstrap\\scripts\\node-dispatch.ps1\" \"${PLUGIN_ROOT}\\components\\git-bash\\dist\\cli.js\" hook pre-tool-use"
12
12
  }
13
13
  ],
@@ -7,7 +7,7 @@
7
7
  "type": "command",
8
8
  "command": "node \"${PLUGIN_ROOT}/scripts/auto-update.mjs\" hook session-start",
9
9
  "timeout": 5,
10
- "statusMessage": "(OmO 4.16.2) Checking Auto Update",
10
+ "statusMessage": "(OmO 4.16.3) Checking Auto Update",
11
11
  "commandWindows": "powershell -NoProfile -ExecutionPolicy Bypass -File \"${PLUGIN_ROOT}\\components\\bootstrap\\scripts\\node-dispatch.ps1\" \"${PLUGIN_ROOT}\\scripts\\auto-update.mjs\" hook session-start"
12
12
  }
13
13
  ],
@@ -8,7 +8,7 @@
8
8
  "command": "node \"${PLUGIN_ROOT}/components/bootstrap/dist/cli.js\" hook session-start",
9
9
  "commandWindows": "powershell -NoProfile -ExecutionPolicy Bypass -File \"${PLUGIN_ROOT}\\components\\bootstrap\\scripts\\bootstrap.ps1\"",
10
10
  "timeout": 30,
11
- "statusMessage": "(OmO 4.16.2) Checking Bootstrap Provisioning"
11
+ "statusMessage": "(OmO 4.16.3) Checking Bootstrap Provisioning"
12
12
  }
13
13
  ]
14
14
  }
@@ -7,7 +7,7 @@
7
7
  "type": "command",
8
8
  "command": "node \"${PLUGIN_ROOT}/components/codegraph/dist/cli.js\" hook session-start",
9
9
  "timeout": 5,
10
- "statusMessage": "(OmO 4.16.2) Checking CodeGraph Bootstrap",
10
+ "statusMessage": "(OmO 4.16.3) Checking CodeGraph Bootstrap",
11
11
  "commandWindows": "powershell -NoProfile -ExecutionPolicy Bypass -File \"${PLUGIN_ROOT}\\components\\bootstrap\\scripts\\node-dispatch.ps1\" \"${PLUGIN_ROOT}\\components\\codegraph\\dist\\cli.js\" hook session-start"
12
12
  }
13
13
  ]
@@ -7,7 +7,7 @@
7
7
  "type": "command",
8
8
  "command": "node \"${PLUGIN_ROOT}/components/rules/dist/cli.js\" hook session-start",
9
9
  "timeout": 10,
10
- "statusMessage": "(OmO 4.16.2) Loading Project Rules",
10
+ "statusMessage": "(OmO 4.16.3) Loading Project Rules",
11
11
  "commandWindows": "powershell -NoProfile -ExecutionPolicy Bypass -File \"${PLUGIN_ROOT}\\components\\bootstrap\\scripts\\node-dispatch.ps1\" \"${PLUGIN_ROOT}\\components\\rules\\dist\\cli.js\" hook session-start"
12
12
  }
13
13
  ]
@@ -7,7 +7,7 @@
7
7
  "type": "command",
8
8
  "command": "node \"${PLUGIN_ROOT}/components/telemetry/dist/cli.js\" hook session-start",
9
9
  "timeout": 5,
10
- "statusMessage": "(OmO 4.16.2) Recording Session Telemetry",
10
+ "statusMessage": "(OmO 4.16.3) Recording Session Telemetry",
11
11
  "commandWindows": "powershell -NoProfile -ExecutionPolicy Bypass -File \"${PLUGIN_ROOT}\\components\\bootstrap\\scripts\\node-dispatch.ps1\" \"${PLUGIN_ROOT}\\components\\telemetry\\dist\\cli.js\" hook session-start"
12
12
  }
13
13
  ]
@@ -7,7 +7,7 @@
7
7
  "type": "command",
8
8
  "command": "node \"${PLUGIN_ROOT}/components/start-work-continuation/dist/cli.js\" hook stop",
9
9
  "timeout": 10,
10
- "statusMessage": "(OmO 4.16.2) Checking Start-Work Continuation",
10
+ "statusMessage": "(OmO 4.16.3) Checking Start-Work Continuation",
11
11
  "commandWindows": "powershell -NoProfile -ExecutionPolicy Bypass -File \"${PLUGIN_ROOT}\\components\\bootstrap\\scripts\\node-dispatch.ps1\" \"${PLUGIN_ROOT}\\components\\start-work-continuation\\dist\\cli.js\" hook stop"
12
12
  }
13
13
  ]
@@ -7,7 +7,7 @@
7
7
  "type": "command",
8
8
  "command": "node \"${PLUGIN_ROOT}/components/start-work-continuation/dist/cli.js\" hook subagent-stop",
9
9
  "timeout": 10,
10
- "statusMessage": "(OmO 4.16.2) Checking Start-Work Continuation",
10
+ "statusMessage": "(OmO 4.16.3) Checking Start-Work Continuation",
11
11
  "commandWindows": "powershell -NoProfile -ExecutionPolicy Bypass -File \"${PLUGIN_ROOT}\\components\\bootstrap\\scripts\\node-dispatch.ps1\" \"${PLUGIN_ROOT}\\components\\start-work-continuation\\dist\\cli.js\" hook subagent-stop"
12
12
  }
13
13
  ]
@@ -7,7 +7,7 @@
7
7
  "type": "command",
8
8
  "command": "node \"${PLUGIN_ROOT}/components/lazycodex-executor-verify/dist/cli.js\" hook subagent-stop",
9
9
  "timeout": 10,
10
- "statusMessage": "(OmO 4.16.2) Verifying LazyCodex Executor Evidence",
10
+ "statusMessage": "(OmO 4.16.3) Verifying LazyCodex Executor Evidence",
11
11
  "commandWindows": "powershell -NoProfile -ExecutionPolicy Bypass -File \"${PLUGIN_ROOT}\\components\\bootstrap\\scripts\\node-dispatch.ps1\" \"${PLUGIN_ROOT}\\components\\lazycodex-executor-verify\\dist\\cli.js\" hook subagent-stop"
12
12
  }
13
13
  ],
@@ -7,7 +7,7 @@
7
7
  "type": "command",
8
8
  "command": "node \"${PLUGIN_ROOT}/components/ultrawork/dist/cli.js\" hook user-prompt-submit",
9
9
  "timeout": 5,
10
- "statusMessage": "(OmO 4.16.2) Checking Ultrawork Trigger",
10
+ "statusMessage": "(OmO 4.16.3) Checking Ultrawork Trigger",
11
11
  "commandWindows": "powershell -NoProfile -ExecutionPolicy Bypass -File \"${PLUGIN_ROOT}\\components\\bootstrap\\scripts\\node-dispatch.ps1\" \"${PLUGIN_ROOT}\\components\\ultrawork\\dist\\cli.js\" hook user-prompt-submit"
12
12
  }
13
13
  ]
@@ -7,7 +7,7 @@
7
7
  "type": "command",
8
8
  "command": "node \"${PLUGIN_ROOT}/components/ulw-loop/dist/cli.js\" hook user-prompt-submit",
9
9
  "timeout": 10,
10
- "statusMessage": "(OmO 4.16.2) Checking Ulw-Loop Steering",
10
+ "statusMessage": "(OmO 4.16.3) Checking Ulw-Loop Steering",
11
11
  "commandWindows": "powershell -NoProfile -ExecutionPolicy Bypass -File \"${PLUGIN_ROOT}\\components\\bootstrap\\scripts\\node-dispatch.ps1\" \"${PLUGIN_ROOT}\\components\\ulw-loop\\dist\\cli.js\" hook user-prompt-submit"
12
12
  }
13
13
  ]
@@ -7,7 +7,7 @@
7
7
  "type": "command",
8
8
  "command": "node \"${PLUGIN_ROOT}/components/rules/dist/cli.js\" hook user-prompt-submit",
9
9
  "timeout": 10,
10
- "statusMessage": "(OmO 4.16.2) Loading Project Rules",
10
+ "statusMessage": "(OmO 4.16.3) Loading Project Rules",
11
11
  "commandWindows": "powershell -NoProfile -ExecutionPolicy Bypass -File \"${PLUGIN_ROOT}\\components\\bootstrap\\scripts\\node-dispatch.ps1\" \"${PLUGIN_ROOT}\\components\\rules\\dist\\cli.js\" hook user-prompt-submit"
12
12
  }
13
13
  ]
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@sisyphuslabs/omo-codex-plugin",
3
- "version": "4.16.1",
3
+ "version": "4.16.2",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@sisyphuslabs/omo-codex-plugin",
9
- "version": "4.16.1",
9
+ "version": "4.16.2",
10
10
  "workspaces": [
11
11
  "components/codegraph",
12
12
  "components/comment-checker",
@@ -93,7 +93,7 @@
93
93
  },
94
94
  "components/codegraph": {
95
95
  "name": "@sisyphuslabs/codex-codegraph",
96
- "version": "4.16.1",
96
+ "version": "4.16.2",
97
97
  "bin": {
98
98
  "omo-codegraph": "dist/cli.js"
99
99
  },
@@ -112,7 +112,7 @@
112
112
  },
113
113
  "components/comment-checker": {
114
114
  "name": "@code-yeongyu/codex-comment-checker",
115
- "version": "4.16.1",
115
+ "version": "4.16.2",
116
116
  "license": "MIT",
117
117
  "bin": {
118
118
  "omo-comment-checker": "dist/cli.js"
@@ -133,7 +133,7 @@
133
133
  },
134
134
  "components/git-bash": {
135
135
  "name": "@sisyphuslabs/codex-git-bash-hook",
136
- "version": "4.16.1",
136
+ "version": "4.16.2",
137
137
  "bin": {
138
138
  "omo-git-bash-hook": "dist/cli.js"
139
139
  },
@@ -148,7 +148,7 @@
148
148
  },
149
149
  "components/lazycodex-executor-verify": {
150
150
  "name": "@code-yeongyu/codex-lazycodex-executor-verify",
151
- "version": "4.16.1",
151
+ "version": "4.16.2",
152
152
  "license": "MIT",
153
153
  "bin": {
154
154
  "lazycodex-executor-verify": "dist/cli.js"
@@ -165,7 +165,7 @@
165
165
  },
166
166
  "components/lsp": {
167
167
  "name": "@code-yeongyu/codex-lsp",
168
- "version": "4.16.1",
168
+ "version": "4.16.2",
169
169
  "license": "MIT",
170
170
  "dependencies": {
171
171
  "@code-yeongyu/lsp-daemon": "file:../../../../lsp-daemon"
@@ -185,7 +185,7 @@
185
185
  },
186
186
  "components/rules": {
187
187
  "name": "@code-yeongyu/codex-rules",
188
- "version": "4.16.1",
188
+ "version": "4.16.2",
189
189
  "license": "MIT",
190
190
  "dependencies": {
191
191
  "picomatch": "^4.0.3"
@@ -207,7 +207,7 @@
207
207
  },
208
208
  "components/start-work-continuation": {
209
209
  "name": "@code-yeongyu/codex-start-work-continuation",
210
- "version": "4.16.1",
210
+ "version": "4.16.2",
211
211
  "license": "MIT",
212
212
  "bin": {
213
213
  "omo-start-work-continuation": "dist/cli.js"
@@ -224,7 +224,7 @@
224
224
  },
225
225
  "components/teammode": {
226
226
  "name": "@sisyphuslabs/codex-teammode",
227
- "version": "4.16.1",
227
+ "version": "4.16.2",
228
228
  "devDependencies": {
229
229
  "@types/node": "^25.9.3",
230
230
  "bun-types": "^1.3.1",
@@ -237,7 +237,7 @@
237
237
  },
238
238
  "components/telemetry": {
239
239
  "name": "@code-yeongyu/codex-telemetry",
240
- "version": "4.16.1",
240
+ "version": "4.16.2",
241
241
  "license": "MIT",
242
242
  "bin": {
243
243
  "omo-telemetry": "dist/cli.js"
@@ -255,7 +255,7 @@
255
255
  },
256
256
  "components/ultrawork": {
257
257
  "name": "@code-yeongyu/codex-ultrawork",
258
- "version": "4.16.1",
258
+ "version": "4.16.2",
259
259
  "license": "MIT",
260
260
  "bin": {
261
261
  "omo-ultrawork": "dist/cli.js"
@@ -273,7 +273,7 @@
273
273
  },
274
274
  "components/ulw-loop": {
275
275
  "name": "@code-yeongyu/codex-ulw-loop",
276
- "version": "4.16.1",
276
+ "version": "4.16.2",
277
277
  "license": "MIT",
278
278
  "bin": {
279
279
  "omo-ulw-loop": "dist/cli.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sisyphuslabs/omo-codex-plugin",
3
- "version": "4.16.2",
3
+ "version": "4.16.3",
4
4
  "description": "Aggregate Codex plugin root for OMO components.",
5
5
  "type": "module",
6
6
  "packageManager": "npm@11.12.1",
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  import { spawn, spawnSync } from "node:child_process";
4
- import { pathToFileURL } from "node:url";
4
+ import { isCliEntry } from "./entry-guard.mjs";
5
5
  import {
6
6
  DEFAULT_LOCK_STALE_MS,
7
7
  acquireLock,
@@ -296,8 +296,15 @@ function resolveUpdateContext({ env }) {
296
296
 
297
297
  async function runConfigMigration({ env, sessionModel = null, requireSessionModel = false }) {
298
298
  if (env.LAZYCODEX_CONFIG_MIGRATION_DISABLED === "1" || env.OMO_CODEX_CONFIG_MIGRATION_DISABLED === "1") return [];
299
+ // The two migrations are independent; a SoT seeding failure must never
300
+ // block the config.toml repair (which can be the difference between a
301
+ // working and a fully broken GPT-5.6 session).
299
302
  try {
300
303
  await migrateOmoSotConfig({ env, seed: true });
304
+ } catch (error) {
305
+ if (!(error instanceof Error)) throw error;
306
+ }
307
+ try {
301
308
  const result = await migrateCodexConfig({ env, sessionModel, requireSessionModel });
302
309
  if (result.modeChanged.length === 0) return [];
303
310
  return [
@@ -309,7 +316,7 @@ async function runConfigMigration({ env, sessionModel = null, requireSessionMode
309
316
  }
310
317
  }
311
318
 
312
- if (process.argv[1] !== undefined && import.meta.url === pathToFileURL(process.argv[1]).href) {
319
+ if (isCliEntry(import.meta.url)) {
313
320
  (async () => {
314
321
  const sessionModel = await readSessionModelFromStdin(process.stdin);
315
322
  const { notices } = await runAutoUpdateCheck({
@@ -0,0 +1,26 @@
1
+ import { realpathSync } from "node:fs";
2
+ import { pathToFileURL } from "node:url";
3
+
4
+ /**
5
+ * True when the module identified by `importMetaUrl` is the process CLI
6
+ * entrypoint (`node <script>`).
7
+ *
8
+ * A plain `import.meta.url === pathToFileURL(process.argv[1]).href` check
9
+ * breaks when the script is reached through a symlink: Node resolves
10
+ * `import.meta.url` to the real path by default, while `process.argv[1]`
11
+ * keeps the symlinked spelling, so the two never match and the CLI body is
12
+ * silently skipped (exit 0, no output). Seen in the wild with a symlinked
13
+ * plugin cache dir, which turned every SessionStart hook into a no-op.
14
+ *
15
+ * @param {string} importMetaUrl the caller's `import.meta.url`
16
+ */
17
+ export function isCliEntry(importMetaUrl) {
18
+ const argv1 = process.argv[1];
19
+ if (argv1 === undefined) return false;
20
+ if (importMetaUrl === pathToFileURL(argv1).href) return true;
21
+ try {
22
+ return importMetaUrl === pathToFileURL(realpathSync(argv1)).href;
23
+ } catch {
24
+ return false;
25
+ }
26
+ }
@@ -2,6 +2,8 @@ import { execFileSync } from "node:child_process";
2
2
  import { dirname, join } from "node:path";
3
3
  import { fileURLToPath, pathToFileURL } from "node:url";
4
4
 
5
+ import { isCliEntry } from "./entry-guard.mjs";
6
+
5
7
  const pluginScriptsDir = dirname(fileURLToPath(import.meta.url));
6
8
  const repoRoot = join(pluginScriptsDir, "..", "..", "..", "..");
7
9
  const sharedSkillsScripts = join(repoRoot, "packages", "shared-skills", "scripts");
@@ -35,7 +37,7 @@ export async function materializeSharedUpstreams({ strict }) {
35
37
  return materializeFrontendRefs({ strict });
36
38
  }
37
39
 
38
- if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) {
40
+ if (isCliEntry(import.meta.url)) {
39
41
  // The root build materializes once up front and sets this so downstream codex-plugin
40
42
  // builds in the same run do not re-run it; concurrent runs would contend on git's
41
43
  // submodule index.lock and race writes into packages/shared-skills/skills.
@@ -24,7 +24,7 @@
24
24
  */
25
25
  import { readFileSync } from "node:fs";
26
26
  import { homedir } from "node:os";
27
- import { join } from "node:path";
27
+ import { dirname, isAbsolute, join } from "node:path";
28
28
 
29
29
  const MANAGED_COMMENT_MARKER = "openai/codex#26753";
30
30
  const MANAGED_DISABLE_COMMENT = [
@@ -42,6 +42,7 @@ const MANAGED_DISABLE_COMMENT = [
42
42
  * requireSessionModel?: boolean,
43
43
  * env?: NodeJS.ProcessEnv,
44
44
  * modelsCachePath?: string,
45
+ * configPath?: string,
45
46
  * }} [options]
46
47
  */
47
48
  export function forceDisableMultiAgentV2(config, options = {}) {
@@ -55,8 +56,9 @@ export function forceDisableMultiAgentV2(config, options = {}) {
55
56
  options.multiAgentVersion !== undefined
56
57
  ? options.multiAgentVersion
57
58
  : resolveMultiAgentVersionFromConfig(normalized, options);
59
+ const effectiveModel = sessionModel || readRootModel(normalized);
58
60
 
59
- if (prefersMultiAgentV2(multiAgentVersion, sessionModel)) {
61
+ if (prefersMultiAgentV2(multiAgentVersion, effectiveModel)) {
60
62
  return clearMultiAgentV2DisableForReservedSchema(normalized);
61
63
  }
62
64
 
@@ -68,6 +70,15 @@ export function forceDisableMultiAgentV2(config, options = {}) {
68
70
  return normalized;
69
71
  }
70
72
 
73
+ // No model evidence at all (no session model AND no root `model` in
74
+ // config.toml — Codex Desktop selects the model in the UI): config alone
75
+ // cannot prove the session is not a GPT-5.6 reserved-schema model, and
76
+ // writing `enabled = false` would 400 every turn on those sessions
77
+ // (#6002). Leave the enable state untouched.
78
+ if (multiAgentVersion == null && !sessionModel && !readRootModel(normalized)) {
79
+ return normalized;
80
+ }
81
+
71
82
  // Unknown catalog entry for an explicit session model: skip force-disable
72
83
  // rather than assume the legacy encrypted-V2 failure mode.
73
84
  if (sessionModel && multiAgentVersion == null) {
@@ -92,13 +103,17 @@ export function prefersMultiAgentV2(multiAgentVersion, sessionModel) {
92
103
  * Resolve the effective model against Codex `models_cache.json`.
93
104
  * Prefers SessionStart `model` over the root `model` in config.toml.
94
105
  * @param {string} config
95
- * @param {{ sessionModel?: string | null, env?: NodeJS.ProcessEnv, modelsCachePath?: string }} [options]
106
+ * @param {{ sessionModel?: string | null, env?: NodeJS.ProcessEnv, modelsCachePath?: string, configPath?: string }} [options]
96
107
  * @returns {"v1" | "v2" | null}
97
108
  */
98
109
  export function resolveMultiAgentVersionFromConfig(config, options = {}) {
99
110
  const model = normalizeModel(options.sessionModel) || readRootModel(config);
100
111
  if (!model) return null;
101
- return resolveMultiAgentVersionForModel(model, options);
112
+ const version = resolveMultiAgentVersionForModel(model, {
113
+ ...options,
114
+ modelsCachePath: options.modelsCachePath?.trim() || resolveModelCatalogPath(readRootModelCatalogPath(config), options) || undefined,
115
+ });
116
+ return version ?? (isGpt56Family(model) ? "v2" : null);
102
117
  }
103
118
 
104
119
  /**
@@ -130,6 +145,26 @@ export function readRootModel(config) {
130
145
  return single?.[1] ?? null;
131
146
  }
132
147
 
148
+ // Codex documents `model_catalog_json` as a COMPLETE replacement for the
149
+ // fetched models_cache.json (codex-rs/core/src/config/mod.rs load_model_catalog
150
+ // -> load_catalog_json -> ModelsResponse). When set, Codex resolves the model
151
+ // only from that file, so the guard must too — otherwise Codex and the guard
152
+ // disagree on the multi-agent version (lazycodex#120).
153
+ export function readRootModelCatalogPath(config) {
154
+ const double = config.match(/^\s*model_catalog_json\s*=\s*"([^"]+)"/m);
155
+ if (double) return double[1];
156
+ const single = config.match(/^\s*model_catalog_json\s*=\s*'([^']+)'/m);
157
+ return single?.[1] ?? null;
158
+ }
159
+
160
+ function resolveModelCatalogPath(configuredPath, options) {
161
+ const trimmed = normalizeModel(configuredPath);
162
+ if (!trimmed) return null;
163
+ if (isAbsolute(trimmed)) return trimmed;
164
+ const baseDir = options.configPath ? dirname(options.configPath) : options.env?.CODEX_HOME?.trim() || join(homedir(), ".codex");
165
+ return join(baseDir, trimmed);
166
+ }
167
+
133
168
  function normalizeModel(value) {
134
169
  if (typeof value !== "string") return null;
135
170
  const trimmed = value.trim();
@@ -1,4 +1,4 @@
1
- import { prefersMultiAgentV2, resolveMultiAgentVersionFromConfig } from "./multi-agent-v2-guard.mjs";
1
+ import { prefersMultiAgentV2, readRootModel, resolveMultiAgentVersionFromConfig } from "./multi-agent-v2-guard.mjs";
2
2
 
3
3
  const CODEX_AGENTS_HEADER = "[agents]";
4
4
  const CODEX_MULTI_AGENT_V2_HEADER = "[features.multi_agent_v2]";
@@ -11,6 +11,12 @@ const CODEX_SUBAGENT_THREAD_LIMIT = "1000";
11
11
  * enabled in config, skip `agents.max_threads` because Codex rejects that key
12
12
  * while features.multi_agent_v2 is enabled.
13
13
  *
14
+ * When no model is resolvable at all (no session model and no root `model`
15
+ * in config.toml — Codex Desktop selects the model in the UI), never
16
+ * introduce `agents.max_threads`: it hard-fails thread/start on
17
+ * MultiAgentV2 sessions. An existing cap is still raised in place so the
18
+ * legacy low-cap repair keeps working and a hand-removed key stays removed.
19
+ *
14
20
  * @param {string} config
15
21
  * @param {{ multiAgentVersion?: string | null, sessionModel?: string | null, env?: NodeJS.ProcessEnv, modelsCachePath?: string }} [options]
16
22
  */
@@ -22,20 +28,34 @@ export function ensureSubagentConcurrencyLimit(config, options = {}) {
22
28
  const v2Preferred = prefersMultiAgentV2(multiAgentVersion, options.sessionModel) || isMultiAgentV2Enabled(config);
23
29
 
24
30
  let result = config;
25
- if (!v2Preferred) {
26
- result = ensureAgentsMaxThreads(result);
27
- } else {
31
+ if (v2Preferred) {
28
32
  result = removeAgentsMaxThreads(result);
33
+ } else if (multiAgentVersion == null && !hasModelEvidence(config, options)) {
34
+ result = raiseExistingAgentsMaxThreads(result);
35
+ } else {
36
+ result = ensureAgentsMaxThreads(result);
29
37
  }
30
38
  return ensureMultiAgentV2ThreadLimit(result);
31
39
  }
32
40
 
41
+ function hasModelEvidence(config, options) {
42
+ const sessionModel = typeof options.sessionModel === "string" ? options.sessionModel.trim() : "";
43
+ return sessionModel.length > 0 || readRootModel(config) !== null;
44
+ }
45
+
33
46
  function isMultiAgentV2Enabled(config) {
34
47
  const section = findSection(config, CODEX_MULTI_AGENT_V2_HEADER);
35
48
  if (!section) return false;
36
49
  return /^\s*enabled\s*=\s*true[ \t]*(?:#[^\n]*)?$/m.test(section.text);
37
50
  }
38
51
 
52
+ function raiseExistingAgentsMaxThreads(config) {
53
+ const section = findSection(config, CODEX_AGENTS_HEADER);
54
+ if (!section) return config;
55
+ if (!/^\s*max_threads\s*=/m.test(section.text)) return config;
56
+ return replaceOrInsertSetting(config, section, "max_threads", CODEX_SUBAGENT_THREAD_LIMIT);
57
+ }
58
+
39
59
  function ensureAgentsMaxThreads(config) {
40
60
  const section = findSection(config, CODEX_AGENTS_HEADER);
41
61
  if (!section) return appendBlock(config, `${CODEX_AGENTS_HEADER}\nmax_threads = ${CODEX_SUBAGENT_THREAD_LIMIT}\n`);