Mercurial
diff mrjunejune/inference_stack.sh @ 271:13d61401c57d
redirect Copilot cache to service state
Set XDG_CACHE_HOME from the configured inference state so the systemd service can extract Copilot outside its protected home directory.
Co-authored-by: Copilot <[email protected]>
| author | MrJuneJune <me@mrjunejune.com> |
|---|---|
| date | Fri, 07 Aug 2026 13:24:05 -0700 |
| parents | 056790c4fb0d |
| children |
line wrap: on
line diff
--- a/mrjunejune/inference_stack.sh Fri Aug 07 13:16:47 2026 -0700 +++ b/mrjunejune/inference_stack.sh Fri Aug 07 13:24:05 2026 -0700 @@ -106,6 +106,7 @@ litellm_port="${LITELLM_PORT:-4000}" default_state_root="${XDG_STATE_HOME:-$HOME/.local/state}/mrjunejune/inference" state_root="${MRJUNEJUNE_INFERENCE_STATE:-$default_state_root}" +copilot_cache_root="$state_root/cache" litellm_pid= server_pid= @@ -118,6 +119,7 @@ fi printf 'copilot_token_dir=%s\n' \ "${GITHUB_COPILOT_TOKEN_DIR:-$state_root/litellm-copilot}" + printf 'copilot_cache_dir=%s\n' "$copilot_cache_root" printf 'guest_inference=%s\n' \ "${MRJUNEJUNE_ALLOW_GUEST_INFERENCE:-false}" exit 0 @@ -125,8 +127,9 @@ if [[ "$mode" == "authenticate" ]]; then token_dir="${GITHUB_COPILOT_TOKEN_DIR:-$state_root/litellm-copilot}" - mkdir -p "$token_dir" - chmod 700 "$token_dir" + mkdir -p "$token_dir" "$copilot_cache_root" + chmod 700 "$token_dir" "$copilot_cache_root" + export XDG_CACHE_HOME="$copilot_cache_root" exec "$python" "$litellm_zip" --authenticate --token-dir "$token_dir" fi @@ -193,8 +196,8 @@ fi export LITELLM_MASTER_KEY token_dir="${GITHUB_COPILOT_TOKEN_DIR:-$state_root/litellm-copilot}" - mkdir -p "$state_root/copilot" "$token_dir" - chmod 700 "$state_root" "$state_root/copilot" "$token_dir" + mkdir -p "$state_root/copilot" "$token_dir" "$copilot_cache_root" + chmod 700 "$state_root" "$state_root/copilot" "$token_dir" "$copilot_cache_root" export GITHUB_COPILOT_TOKEN_DIR="$token_dir" if [[ ! -s "$GITHUB_COPILOT_TOKEN_DIR/access-token" ]]; then @@ -238,6 +241,7 @@ export MRJUNEJUNE_INFERENCE_SIDECAR_PATH="$sidecar_launcher" export MRJUNEJUNE_COPILOT_CLI_PATH="$copilot_cli" export COPILOT_SIDECAR_HOME="$state_root/copilot" + export XDG_CACHE_HOME="$copilot_cache_root" export LITELLM_BASE_URL="http://${litellm_host}:${litellm_port}/v1" export LITELLM_MODEL="${LITELLM_MODEL:-jrpg-copilot}" export LITELLM_WIRE_API="${LITELLM_WIRE_API:-completions}"