From fc2e748de76a24f3b4b4cb06069e6d9b5aeec796 Mon Sep 17 00:00:00 2001 From: DreamCoder08 Date: Tue, 29 Sep 2026 18:10:25 -0500 Subject: [PATCH] fix(gga): put the pin shim ahead of the real codex in fish fish keeps fish_user_paths ahead of the rest of PATH, and config.fish adds ~/.local/bin (where the real codex lives) to it. The shim directory was added with --path from a conf.d snippet, so in a fresh shell it sat at position 8 behind the real codex at 6: the model pin then relied only on the block in the gga config, which gentle-ai sync rewrites. Add the shim directory to fish_user_paths from config.fish, after the other fish_add_path calls, and move it to the front. The conf.d snippet now only exports GGA_PROVIDER. A test checks the order (it fails without the change). --- .../fish/conf.d/27-dreamcoder-gga-pin.fish | 12 ++++---- DreamcoderShell/.config/fish/config.fish | 7 +++++ tests/shell/test_gga_pin.bats | 30 +++++++++++++++++++ 3 files changed, 42 insertions(+), 7 deletions(-) diff --git a/DreamcoderShell/.config/fish/conf.d/27-dreamcoder-gga-pin.fish b/DreamcoderShell/.config/fish/conf.d/27-dreamcoder-gga-pin.fish index 40f541ec..631878ad 100644 --- a/DreamcoderShell/.config/fish/conf.d/27-dreamcoder-gga-pin.fish +++ b/DreamcoderShell/.config/fish/conf.d/27-dreamcoder-gga-pin.fish @@ -1,9 +1,7 @@ -# gga reviews: Codex provider with the pinned model shim first on PATH. -# The shim only changes `codex exec` calls made by gga (docs/configuration/gga.md). +# gga reviews use the Codex provider. The model itself is pinned by the shim in +# ~/.config/gga/bin (docs/configuration/gga.md); putting that directory on PATH happens in +# config.fish, because conf.d runs before it and config.fish prepends ~/.local/bin, which +# would leave the real codex ahead of the shim. set -l _dc_config_home $HOME/.config set -q XDG_CONFIG_HOME[1]; and test -n "$XDG_CONFIG_HOME"; and set _dc_config_home $XDG_CONFIG_HOME -set -l _dc_gga_bin $_dc_config_home/gga/bin -if test -d $_dc_gga_bin - set -gx GGA_PROVIDER codex - fish_add_path --global --move --path $_dc_gga_bin -end +test -d $_dc_config_home/gga/bin; and set -gx GGA_PROVIDER codex diff --git a/DreamcoderShell/.config/fish/config.fish b/DreamcoderShell/.config/fish/config.fish index 35951116..fcda5d6e 100644 --- a/DreamcoderShell/.config/fish/config.fish +++ b/DreamcoderShell/.config/fish/config.fish @@ -20,6 +20,13 @@ if test -d "$HOME/.bun/bin" fish_add_path -g "$BUN_INSTALL/bin" end +# gga model pin: the shim must come before ~/.local/bin (the real codex). fish keeps +# fish_user_paths ahead of the rest of PATH, so the shim has to join that list (no --path) and +# move to its front. Keep this after the block above: each fish_add_path puts its entries first. +set -l _dc_gga_config_home $HOME/.config +set -q XDG_CONFIG_HOME[1]; and test -n "$XDG_CONFIG_HOME"; and set _dc_gga_config_home $XDG_CONFIG_HOME +test -d $_dc_gga_config_home/gga/bin; and fish_add_path --global --move $_dc_gga_config_home/gga/bin + if status is-interactive command -q zoxide; and zoxide init fish | source end diff --git a/tests/shell/test_gga_pin.bats b/tests/shell/test_gga_pin.bats index e4d22a39..0d173aec 100644 --- a/tests/shell/test_gga_pin.bats +++ b/tests/shell/test_gga_pin.bats @@ -189,3 +189,33 @@ shim() { PATH="${SHIM_DIR}:${REAL_BIN}:${PATH}" "$@"; } run -127 env PATH="${SHIM_DIR}:/usr/bin:/bin" codex exec x [[ "$output" == *"real codex CLI was not found"* ]] } + +# ── fish PATH order ────────────────────────────────────────────────── + +# fish keeps fish_user_paths ahead of the rest of PATH, and config.fish adds ~/.local/bin (where +# the real codex lives) to it. A shim directory added with --path, or only from conf.d, ends up +# behind the real codex, so a config rewrite by gentle-ai would silently drop the model pin. +@test "fish: the gga shim directory precedes ~/.local/bin in fish_user_paths after config.fish" { + command -v fish >/dev/null || skip "fish not installed" + gga_setup + mkdir -p "${HOME}/.local/bin" "${SHIM_DIR}" + run env -u XDG_CONFIG_HOME HOME="${HOME}" fish --no-config -c ' + source '"${DREAMCODER_DOTS_DIR}"'/DreamcoderShell/.config/fish/conf.d/27-dreamcoder-gga-pin.fish + source '"${DREAMCODER_DOTS_DIR}"'/DreamcoderShell/.config/fish/config.fish + set -l shim (contains -i -- $HOME/.config/gga/bin $fish_user_paths) + set -l real (contains -i -- $HOME/.local/bin $fish_user_paths) + test -n "$shim" -a -n "$real" -a "$shim" -lt "$real"; and echo ordered + ' 2>/dev/null + [[ "$output" == *ordered* ]] +} + +@test "fish: GGA_PROVIDER is exported when the shim directory exists" { + command -v fish >/dev/null || skip "fish not installed" + gga_setup + mkdir -p "${SHIM_DIR}" + run env -u XDG_CONFIG_HOME -u GGA_PROVIDER HOME="${HOME}" fish --no-config -c ' + source '"${DREAMCODER_DOTS_DIR}"'/DreamcoderShell/.config/fish/conf.d/27-dreamcoder-gga-pin.fish + echo "provider=$GGA_PROVIDER" + ' 2>/dev/null + [[ "$output" == *"provider=codex"* ]] +}