Skip to content

Start AI commit messages from the same shell environment chats use - #26808

Merged
Jinwoo-H merged 3 commits into
mainfrom
commit-message-login-shell-env
Oct 9, 2026
Merged

Jinwoo-H merged 3 commits into
mainfrom
commit-message-login-shell-env

Conversation

@Jinwoo-H

@Jinwoo-H Jinwoo-H commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​174 $\color{#cf222e}{\Huge{\mathbf{−}}}$​2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​172
Prod 5 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​67 $\color{#cf222e}{\Huge{\mathbf{−}}}$​32 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​35

ELI5

When Orca is opened from the Dock, the AI commit message didn't see anything you set in your shell startup file (like a Claude proxy address and key), so it failed with "Not logged in" while chats and terminals in the same Orca worked. It now starts from the same shell environment chats already use.

What Changed

  • Before: on a Dock or Finder launch, local AI text generation (commit message, PR text, model discovery, branch and chat naming) started agents from Orca's own process environment. That environment only takes PATH from the login shell, so anything else exported in .zshrc and the like was missing.
  • After: on the host, those features start from the cached login-shell environment chats use. It goes through the same "inherit shell environment" setting (nativeChatShellEnvironmentPolicy), with Orca's own overrides on top in the same order as chats: managed Codex home, Claude account patch, and the OpenCode/Pi/OMP/Grok config folders. No extra shell is started; the result is the chats' cached one. If the shell environment can't be read, it falls back to Orca's own environment, which was the old behaviour.
  • Mechanism: the chat helper moved to resolveHostAgentBaseEnvironment in structured-agent-shell-environment.ts, and both chats and text generation call it.
  • Unchanged: WSL keeps Orca's environment, and SSH/remote never reaches this code. On Windows it matches chats: no change with cmd; with PowerShell or Git Bash configured, it gets that profile's environment, as chats do.

Why

Chats and the commit message should see the same environment. Reusing the chats' cached shell environment fixes it with no new shell spawn and no new setting. The alternative was a separate shell lookup just for text generation, which would duplicate what chats already do and could drift from it.

Linked Issue

Follow-up found while re-landing Claude per-account folders (STA-3698, #26769 and #26801). The bug is already on main.

Visual Proof

N/A: no UI change. Reproduced in a sandboxed build: with a proxy and key set only in the sandbox's .zshrc and Orca launched with a clean environment, terminal and chat reached the proxy, but the commit message said "Not logged in" on both main and the re-land branch.

Testing

  • New unit tests:

    • Claude picks up a proxy address and token that only exist in the shell environment.
    • A managed account's settings still win over the shell.
    • The managed CODEX_HOME wins over the shell's.
    • Agents with no account settings get the shell environment.
    • WSL and SSH never call the new lookup.
    • A failed lookup falls back to Orca's environment.
  • An IPC test checks that local generation gets a login-shell-only variable.

  • pnpm tc, the targeted suites (225 tests) and check:code-quality:changed pass.

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

Review

An independent agent review found no must-fix issues. Worth knowing:

  • Every agent: all local agents' text generation now gets the login-shell environment, PATH included, the same way chats do. Before, they got Orca's own merged PATH.
  • Keys exported in the shell: a key exported in the shell rc is now used by commit messages on System default, the same as chats and terminals.
  • Per-agent environment settings: these still aren't applied to text generation. They weren't before either; that's out of scope here.
  • Windows with Git Bash: that PATH format applies here too, as it already does for chats. Not verified on Windows.

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

Ensure no issues in: Security, Cross-platform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

A Dock-launched Orca only takes PATH from the user's shell, so variables
exported in the shell rc (proxy base URL, auth token) never reached the
commit-message agent even though chats and terminals saw them. Local host
generation now starts from the same cached login-shell base env as chats,
with account overrides applied on top; WSL and SSH paths are unchanged.
@coderabbitai

coderabbitai Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 89692267-9161-4a88-99fd-f64b72c2a681

📥 Commits

Reviewing files that changed from the base of the PR and between 0f9f91b and 91cb4f2.


📒 Files selected for processing (2)
  • src/main/text-generation/commit-message-agent-environment.test.ts
  • src/main/text-generation/commit-message-agent-environment.ts

🚧 Files skipped from review as they are similar to previous changes (2)
  • src/main/text-generation/commit-message-agent-environment.ts
  • src/main/text-generation/commit-message-agent-environment.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.



📝 Walkthrough

Walkthrough

The changes add a shared resolver for host agent base environments and use it in structured-agent launch checks and commit-message services. For non-WSL targets, commit-message preparation applies the resolved environment to shell-config and agent-specific settings. WSL targets skip host environment resolution. Tests cover environment overrides, resolution failures, and local versus SSH generation.


Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to 91cb4

No merge-blocking issue is established; the change is ready for normal checks.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 40.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 10 functions across 7 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check Passed The title clearly and concisely identifies the main change: aligning AI commit-message generation with the shell environment used by chats.
Description check Passed The description is complete and directly addresses the user impact, implementation, rationale, testing, compatibility considerations, and scope. It includes the required visual-proof exception and lin…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.


  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR


  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: a47d3b1b-b343-4da3-bee8-9f3a2bbaba2a
📥 Commits

Reviewing files that changed from the base of the PR and between 39a01f9 and 1b51695.

📒 Files selected for processing (7)
  • src/main/ipc/filesystem-commit-message-generation.test.ts
  • src/main/runtime/structured-agent-launch-support.ts
  • src/main/runtime/structured-agent-shell-environment.ts
  • src/main/startup/main-process-runtime-service.ts
  • src/main/startup/main-window-core-services.ts
  • src/main/text-generation/commit-message-agent-environment.test.ts
  • src/main/text-generation/commit-message-agent-environment.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 4 remain after this review.

Comment thread src/main/text-generation/commit-message-agent-environment.ts
…shell-env

# Conflicts:
#	src/main/startup/main-process-runtime-service.ts
@Jinwoo-H
Jinwoo-H merged commit 65b2fcf into main Oct 9, 2026
30 checks passed
brennanb2025 pushed a commit that referenced this pull request Oct 15, 2026
…26808)

* Start AI commit messages from the login-shell environment chats use

A Dock-launched Orca only takes PATH from the user's shell, so variables
exported in the shell rc (proxy base URL, auth token) never reached the
commit-message agent even though chats and terminals saw them. Local host
generation now starts from the same cached login-shell base env as chats,
with account overrides applied on top; WSL and SSH paths are unchanged.

* Prefer the login shell's config directory over Orca's inherited one for commit messages

(cherry picked from commit 65b2fcf)
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