Skip to content

fix: install the Code Mode host alongside Codex - #443

Open
marksverdhei wants to merge 2 commits into
mainfrom
agent/fix-codex-code-mode-host
Open

marksverdhei wants to merge 2 commits into
mainfrom
agent/fix-codex-code-mode-host

Conversation

@marksverdhei

Copy link
Copy Markdown
Contributor

What

  • preserve the exact v-prefixed GitHub release tag in the Unleash self-updater
  • install the version-matched codex-code-mode-host alongside Codex in latest, source-build, and version-picker paths
  • install the companion host before exposing the new Codex CLI
  • run Claude authentication checks only when launching Claude

Why

Codex 0.147.0 can select code_mode_only models and fails closed when the separately published host executable is absent. Unleash previously installed only the main Codex archive. Separately, Unleash normalized its own release tag before passing it to gh release download, turning the real v0.1.98 tag into nonexistent 0.1.98.

This was reproduced on Crystal, repaired there with the official version-matched OpenAI release asset, and verified through a real Code Mode command.

Validation

  • cargo test --all-targets: 816 passed, 0 failed, 4 ignored
  • cargo clippy --all-targets -- -D warnings
  • cargo fmt --all -- --check
  • generated self-update script passes bash -n
  • isolated real updater install produced Codex 0.147.0 plus executable codex-code-mode-host
  • historical Codex release download behavior remains compatible when no host asset exists

Deployment verification

On Crystal, unleash codex performed a real shell tool call and returned CRYSTAL_CODE_MODE_OK without the Code Mode host warning or the unrelated Claude authentication warning.

@github-actions

github-actions Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Coverage report

Metric Coverage
Lines 58.34%
Functions 64.49%
Regions 58.98%
Per-file breakdown
Filename                           Regions    Missed Regions     Cover   Functions  Missed Functions  Executed       Lines      Missed Lines     Cover    Branches   Missed Branches     Cover
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
agents/custom_cli.rs                   221                37    83.26%          16                 4    75.00%         159                19    88.05%           0                 0         -
agents/definition.rs                   255                 6    97.65%          11                 1    90.91%         286                 5    98.25%           0                 0         -
agents/install.rs                      179                49    72.63%          12                 3    75.00%         121                36    70.25%           0                 0         -
agents/manager.rs                     1364              1125    17.52%          94                75    20.21%         892               737    17.38%           0                 0         -
agents/types.rs                        157                16    89.81%          16                 1    93.75%         104                15    85.58%           0                 0         -
ansi.rs                                374                62    83.42%          21                 0   100.00%         215                42    80.47%           0                 0         -
auth.rs                                291               129    55.67%          24                 4    83.33%         202               110    45.54%           0                 0         -
clanker.rs                             573               272    52.53%          37                18    51.35%         398               218    45.23%           0                 0         -
cli.rs                                1090               205    81.19%          56                15    73.21%         629               143    77.27%           0                 0         -
config.rs                             1315               112    91.48%          72                 9    87.50%         796                51    93.59%           0                 0         -
gateway/api.rs                        1508               149    90.12%          75                12    84.00%        1136               126    88.91%           0                 0         -
gateway/history.rs                    1092               365    66.58%          71                30    57.75%         804               243    69.78%           0                 0         -
gateway/mod.rs                         849               356    58.07%          45                21    53.33%         585               221    62.22%           0                 0         -
gateway/pty.rs                         219                82    62.56%          13                 4    69.23%         152                52    65.79%           0                 0         -
hooks.rs                              1713               162    90.54%         114                18    84.21%         891               104    88.33%           0                 0         -
hyprland.rs                            292               198    32.19%          36                28    22.22%         213               156    26.76%           0                 0         -
identity.rs                            116                18    84.48%           8                 2    75.00%         102                27    73.53%           0                 0         -
input.rs                               209                44    78.95%          18                 2    88.89%         153                31    79.74%           0                 0         -
interchange/claude.rs                 1630                68    95.83%          97                 5    94.85%         969                37    96.18%           0                 0         -
interchange/codex.rs                  1752               266    84.82%         112                20    82.14%        1095               183    83.29%           0                 0         -
interchange/crossload_index.rs         738                80    89.16%          36                 8    77.78%         414                46    88.89%           0                 0         -
interchange/gemini.rs                 1963               277    85.89%         105                10    90.48%        1212               175    85.56%           0                 0         -
interchange/helpers.rs                  20                 0   100.00%           4                 0   100.00%          11                 0   100.00%           0                 0         -
interchange/hermes.rs                 1425                67    95.30%          61                 8    86.89%         928                37    96.01%           0                 0         -
interchange/hub.rs                     143                 3    97.90%           4                 0   100.00%         126                 3    97.62%           0                 0         -
interchange/inject.rs                 3856              1448    62.45%         289                91    68.51%        2338               851    63.60%           0                 0         -
interchange/mod.rs                     457               438     4.16%          11                 9    18.18%         239               229     4.18%           0                 0         -
interchange/opencode.rs               2605               298    88.56%         221                29    86.88%        1775               190    89.30%           0                 0         -
interchange/passthrough.rs             333                25    92.49%          15                 2    86.67%         240                15    93.75%           0                 0         -
interchange/pi.rs                     2037               179    91.21%         122                 5    95.90%        1153                96    91.67%           0                 0         -
interchange/semantic_eq.rs             240                20    91.67%          14                 1    92.86%         106                20    81.13%           0                 0         -
interchange/sessions.rs               1377               727    47.20%          80                45    43.75%         837               441    47.31%           0                 0         -
json_output.rs                          15                15     0.00%           3                 3     0.00%          17                17     0.00%           0                 0         -
launcher.rs                            965               726    24.77%          57                33    42.11%         627               499    20.41%           0                 0         -
lib.rs                                2052              1737    15.35%          94                72    23.40%        1371              1162    15.24%           0                 0         -
pixel_art.rs                          1515               829    45.28%         122                65    46.72%         958               556    41.96%           0                 0         -
polyfill.rs                           1407                20    98.58%          76                 2    97.37%         821                 5    99.39%           0                 0         -
progress.rs                            376               216    42.55%          19                 6    68.42%         232               141    39.22%           0                 0         -
sandbox.rs                            1416               973    31.29%         103                70    32.04%         994               734    26.16%           0                 0         -
search.rs                             2706              2217    18.07%         129                94    27.13%        1667              1415    15.12%           0                 0         -
skillsync/agy.rs                        44                12    72.73%           6                 2    66.67%          29                 8    72.41%           0                 0         -
skillsync/claude.rs                     32                12    62.50%           7                 3    57.14%          24                 9    62.50%           0                 0         -
skillsync/codex.rs                     110                24    78.18%          10                 3    70.00%          71                13    81.69%           0                 0         -
skillsync/gemini.rs                    134                25    81.34%          14                 3    78.57%          90                12    86.67%           0                 0         -
skillsync/hermes.rs                     23                 6    73.91%           6                 2    66.67%          18                 6    66.67%           0                 0         -
skillsync/mod.rs                      1057               379    64.14%          78                26    66.67%         612               197    67.81%           0                 0         -
skillsync/opencode.rs                   23                 6    73.91%           6                 2    66.67%          18                 6    66.67%           0                 0         -
skillsync/pi.rs                         23                 6    73.91%           6                 2    66.67%          18                 6    66.67%           0                 0         -
stream/claude.rs                       555                32    94.23%          47                 4    91.49%         390                28    92.82%           0                 0         -
stream/codex.rs                        819                65    92.06%          73                 7    90.41%         533                37    93.06%           0                 0         -
stream/mod.rs                          375                16    95.73%          25                 4    84.00%         238                 9    96.22%           0                 0         -
stream/runtime.rs                      296               113    61.82%          19                 7    63.16%         192                58    69.79%           0                 0         -
text_input.rs                          690                59    91.45%          56                 6    89.29%         410                33    91.95%           0                 0         -
theme.rs                               675               169    74.96%          41                10    75.61%         390                91    76.67%           0                 0         -
token_count.rs                          98                98     0.00%           7                 7     0.00%          55                55     0.00%           0                 0         -
tui/app.rs                            9926              6073    38.82%         357               157    56.02%        5948              3550    40.32%           0                 0         -
tui/mod.rs                             443               443     0.00%          21                21     0.00%         316               316     0.00%           0                 0         -
tui/session_picker.rs                  440               282    35.91%          20                 9    55.00%         270               154    42.96%           0                 0         -
updater.rs                            2011              1478    26.50%         131                89    32.06%        1352              1004    25.74%           0                 0         -
version/antigravity.rs                  74                44    40.54%           6                 2    66.67%          58                39    32.76%           0                 0         -
version/cache.rs                       142                46    67.61%          13                 2    84.62%          93                30    67.74%           0                 0         -
version/claude.rs                      771               587    23.87%          37                25    32.43%         568               456    19.72%           0                 0         -
version/cli.rs                         277               277     0.00%          21                21     0.00%         193               193     0.00%           0                 0         -
version/codex.rs                       349               286    18.05%          15                10    33.33%         306               262    14.38%           0                 0         -
version/compare.rs                     150                 4    97.33%          10                 0   100.00%          70                 4    94.29%           0                 0         -
version/gemini.rs                      106                73    31.13%           6                 2    66.67%          91                73    19.78%           0                 0         -
version/hermes.rs                      121                60    50.41%          10                 6    40.00%         119                61    48.74%           0                 0         -
version/manager.rs                     309               222    28.16%          30                17    43.33%         200               132    34.00%           0                 0         -
version/opencode.rs                    155               115    25.81%           8                 2    75.00%         124               100    19.35%           0                 0         -
version/pi.rs                           76                43    43.42%           5                 1    80.00%          59                41    30.51%           0                 0         -
version/unleash_self.rs                 50                31    38.00%           6                 5    16.67%          40                21    47.50%           0                 0         -
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
TOTAL                                61199             25102    58.98%        3610              1282    64.49%       38863             16192    58.34%           0                 0         -

Raw lcov.info is attached as a workflow artifact.
Generated by cargo llvm-cov --lib.

@marksverdhei
marksverdhei marked this pull request as ready for review August 11, 2026 18:55
@marksverdhei

Copy link
Copy Markdown
Contributor Author

Reviewed and taken out of draft. All 17 checks green at head. Verified the parts most likely to be wrong:

  • No regression in the other release-tag callers. parse_release_tag now returns GitHub's raw tag, which is a behaviour change for every caller, not just the self-updater. The agent update path (updater.rs:632) still goes through get_latest_github_version, which now wraps the raw tag in sanitize_version, so its comparisons and display strings are unchanged. Only check_or_update_self takes the exact tag, which is the point of the fix.
  • self_update_script format arity. The third {} that consumed version was replaced by a static string and the trailing argument list dropped from three to two, so the substitutions still line up — the three surviving uses are gh release download, clone -b, and rev-list -n 1, all covered by self_update_script_preserves_exact_github_tag.
  • Shell quoting. shell_quote keeps the tag as one inert argument, and self_update_script_shell_quotes_release_tag pins it with an injection-shaped input. Good test to have written.
  • Version-picker path is genuinely backward compatible. gh release download with two --patterns succeeds as long as one matches, so historical releases without a codex-code-mode-host asset still install, and the code_mode_host_archive.exists() guards keep the rest conditional.

One thing the PR body overstates. "Historical Codex release download behavior remains compatible when no host asset exists" is true of src/version/codex.rs, but not of install_codex_prebuilt in src/agents/manager.rs, which now returns Err when the latest release lacks codex-code-mode-host-<triple>.tar.gz. That path previously installed fine with the CLI archive alone.

Failing closed there is defensible — the CLI itself fails closed without the host, so a clear installer error beats a runtime one — but it means unleash cannot install Codex at all if OpenAI ever stops publishing that asset, and the failure would be on our side of a dependency we do not control. Not blocking, and I would not change it in this PR, but the PR body should not claim compatibility that only one of the two paths has.

Acting-Agent: hai

@hai-pilgrim hai-pilgrim left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM — clean and targeted change. The Code Mode host should be installed alongside Codex; this was a gap in the installation sequence.

Acting-Agent: Pilgrim

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.

2 participants