Skip to content

Fix run.sh credentials path resolution#5799

Merged
kodjima33 merged 1 commit intomainfrom
fix/desktop-run-sh-creds-path
Mar 18, 2026
Merged

Fix run.sh credentials path resolution#5799
kodjima33 merged 1 commit intomainfrom
fix/desktop-run-sh-creds-path

Conversation

@kodjima33
Copy link
Copy Markdown
Collaborator

Summary

  • CREDS_PATH used $BACKEND_DIR (relative ./Backend-Rust) after the script had already cd'd into Backend-Rust/, causing it to look for Backend-Rust/Backend-Rust/google-credentials.json
  • Use $(pwd) instead since we're already in the right directory

🤖 Generated with Claude Code

CREDS_PATH used $BACKEND_DIR (relative) which broke after the script
cd'd into Backend-Rust, causing it to look for
Backend-Rust/Backend-Rust/google-credentials.json. Use $(pwd) instead.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@kodjima33 kodjima33 merged commit 3c634f6 into main Mar 18, 2026
@kodjima33 kodjima33 deleted the fix/desktop-run-sh-creds-path branch March 18, 2026 21:53
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Mar 18, 2026

Greptile Summary

This PR fixes a one-line bug in desktop/run.sh where the CREDS_PATH variable was constructed using $BACKEND_DIR — a relative path (e.g., ./Backend-Rust) — after the script had already cd'd into that directory. This caused the resolved path to be Backend-Rust/Backend-Rust/google-credentials.json (doubling the directory segment), leading to an immediate exit 1 with "Missing credentials file."

The fix replaces $BACKEND_DIR with $(pwd), which always yields the absolute path of the current working directory. Since the cd "$BACKEND_DIR" on line 151 has already changed the CWD to Backend-Rust/, $(pwd) correctly resolves to the credentials file.

Key observations:

  • The root cause is that BACKEND_DIR was set as a relative path ($(dirname "$0")/Backend-Rust) but was reused after a cd, where relative paths are resolved against the new CWD.
  • The fix is minimal, correct, and well-scoped.
  • A complementary long-term hardening approach would be to resolve BACKEND_DIR to an absolute path at declaration time (e.g., BACKEND_DIR="$(cd "$(dirname "$0")/Backend-Rust" && pwd)"), which would make all subsequent usages of $BACKEND_DIR safe regardless of cd calls — but this is a style concern, not a blocker.

Confidence Score: 5/5

  • This PR is safe to merge — it is a targeted, correct bug fix with no risk of regression.
  • The change is a single-line fix that replaces a relative-path variable with $(pwd) after a cd, which is the correct and standard shell idiom for this situation. The logic is straightforward and verifiable by reading the surrounding context. No new behaviour is introduced; only the broken credentials path resolution is corrected.
  • No files require special attention.

Important Files Changed

Filename Overview
desktop/run.sh Single-line fix: replaces $BACKEND_DIR/google-credentials.json with $(pwd)/google-credentials.json after the script has already cd'd into Backend-Rust/, correctly resolving the credentials path that was previously doubling the directory segment.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A["Script starts\nCWD = desktop/"] --> B["BACKEND_DIR = './Backend-Rust'\n(line 77)"]
    B --> C["cd '$BACKEND_DIR'\nCWD = desktop/Backend-Rust/\n(line 151)"]
    C --> D_OLD["❌ OLD: CREDS_PATH = '$BACKEND_DIR/google-credentials.json'\n= './Backend-Rust/google-credentials.json'\n(relative to CWD → Backend-Rust/Backend-Rust/google-credentials.json)"]
    C --> D_NEW["✅ NEW: CREDS_PATH = '$(pwd)/google-credentials.json'\n= '/abs/path/to/Backend-Rust/google-credentials.json'\n(absolute path — always correct)"]
    D_OLD --> E_OLD["❌ File not found → exit 1"]
    D_NEW --> E_NEW["✅ File found → export GOOGLE_APPLICATION_CREDENTIALS"]
    E_NEW --> F["Start Rust backend"]
Loading

Last reviewed commit: "fix(desktop): fix ru..."

Glucksberg pushed a commit to Glucksberg/omi-local that referenced this pull request Apr 28, 2026
## Summary
- `CREDS_PATH` used `$BACKEND_DIR` (relative `./Backend-Rust`) after the
script had already `cd`'d into `Backend-Rust/`, causing it to look for
`Backend-Rust/Backend-Rust/google-credentials.json`
- Use `$(pwd)` instead since we're already in the right directory

🤖 Generated with [Claude Code](https://claude.com/claude-code)
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.

1 participant