Skip to content

rm git shim - #14141

Merged
nwparker merged 4 commits into
mainfrom
nwparker/git-attribution-shim-removal
Aug 13, 2026
Merged

nwparker merged 4 commits into
mainfrom
nwparker/git-attribution-shim-removal

Conversation

@nwparker

@nwparker nwparker commented Aug 13, 2026 •

Copy link
Copy Markdown
Contributor

Removes the terminal git/gh PATH shim wholesale.

The shim installed generated git and gh wrapper scripts into a PATH-prepended directory for Orca-managed PTYs, appending a commit trailer and a PR/issue body footer. This drops the feature, its enableGitHubAttribution setting, and the plumbing that carried it.

What's gone

  • src/main/attribution/ (the generated POSIX + PowerShell wrappers) and src/shared/orca-attribution.ts
  • The env injection in buildPtyHostEnv and the shim-dir PATH restore in the bash/zsh shell-ready rc files (both the daemon and local-provider copies)
  • The setting: GlobalSettings field, default, Git pane toggle, settings-search entries, and the renderer → RPC → runtime param chain. Removing the optional field from the zod schema is wire-safe — the schema is non-strict, so an older client still sending it is ignored rather than rejected.
  • 16 orphaned i18n keys across all five locales, plus the matching translation-override entries

Cleanup for existing installs

Installs that had the toggle on still have wrapper scripts on disk and the env that activates them. That mattered more than it first looked: a healthy daemon is deliberately kept alive across an upgrade when it has live sessions, and it uses its own process.env as the authoritative base for new PTYs. Without cleanup those panes would keep applying the trailer with no setting left to turn it off.

So src/main/pty/legacy-terminal-shim-dir.ts deletes the orphaned directory once at startup (above the serve branch, so remote/SSH hosts get it too) and scrubs the stale env and PATH entries per spawn — after the PATH prepends, since those re-read process.env when the daemon hands over a sparse env.

Also

  • getAttributionShellLaunchConfig → getMarkerlessShellLaunchConfig; it's still used by OpenCode, Codex, and agent-teams, but its only remaining meaning was "wrapped shell without a ready marker"
  • Dropped the now-unread BuildPtyHostEnvOptions.shellPath

Testing

typecheck and lint clean. Full suite: 50,858 passing. Remaining failures are pre-existing and reproduce identically on origin/main — agent-exec-handler (2), the cross-version-wire harness (needs local checkouts), and two load-flaky timeouts.

Generated shell wrappers were verified by extracting all 9 variants and running bash -n / zsh -n, checking for orphan calls and dangling guards. The new daemon-path regression test was mutation-tested: it fails on the previous placement and passes on the fix.

nwparker and others added 4 commits August 12, 2026 18:24
Drops the terminal git/gh PATH wrapper and its settings toggle. Renames the no-marker shell-ready launch config after what it does.

Co-authored-by: Orca <[email protected]>
Deletes the orphaned wrapper dir and scrubs inherited env/PATH, so a daemon that outlives the upgrade cannot keep seeding it. Drops a now-unread spawn option.

Co-authored-by: Orca <[email protected]>
Scrub after the PATH prepends (they re-read process.env on the sparse daemon env) and run the cleanup above the serve branch so remote hosts get it too. Retry a locked removal; match PATH case-insensitively.

Co-authored-by: Orca <[email protected]>
Refuse to re-prepend a legacy entry during agent-teams PATH promotion, which runs after the scrub. Cover the removal guard.

Co-authored-by: Orca <[email protected]>
@nwparker
nwparker requested a review from brennanb2025 as a code owner August 13, 2026 01:44
@coderabbitai

coderabbitai Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The change removes terminal GitHub attribution from settings, runtime contracts, PTY environment assembly, shell wrappers, shared prompts, tests, and localization data. It replaces attribution-specific shell launch configuration with markerless configuration. It adds startup and PTY cleanup for legacy terminal shim directories, environment variables, and PATH entries. It also updates Agent Teams environment handling and preserves unrelated PATH entries.

Mergeability Score: 🔵 Low · up to 91b74

The change removes terminal attribution and its setting, but some localized UI text still mentions the removed feature and Windows cleanup may miss case-variant legacy environment keys, allowing stale behavior for some installs. These are bounded follow-ups, so the PR is mergeable with explicit owner awareness.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description explains the implementation and testing, but it omits required template sections, including Linked Issue, Visual Proof, Review, and Checklist. Add the required template sections, provide an issue reference after “Fixes #”, mark Visual Proof as N/A with a reason if applicable, and complete the checklist.
Docstring Coverage ⚠️ Warning Docstring coverage is 22.22% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title directly identifies the main change: removing the Git shim, although its wording is terse.
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.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch

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: 2


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: d9aa9712-37d8-4327-a6aa-d0b10689f519

📥 Commits

Reviewing files that changed from the base of the PR and between d9b390f and 91b747a.

📒 Files selected for processing (55)
  • config/max-lines-baseline.txt
  • config/scripts/locale-ko-key-overrides.json
  • config/scripts/locale-ko-value-overrides.mjs
  • config/scripts/locale-search-keyword-overrides.mjs
  • config/scripts/locale-translation-policy.es-pr.test.mjs
  • config/scripts/locale-translation-policy.zh-round5.test.mjs
  • config/scripts/locale-zh-phrase-fixes-round5.mjs
  • config/scripts/locale-zh-value-overrides.mjs
  • src/main/attribution/terminal-attribution-path-env-casing.test.ts
  • src/main/attribution/terminal-attribution-win32-dash-argument.test.ts
  • src/main/attribution/terminal-attribution.test.ts
  • src/main/attribution/terminal-attribution.ts
  • src/main/codex-accounts/runtime-home-service.test.ts
  • src/main/codex-accounts/service.test.ts
  • src/main/daemon/pty-subprocess.test.ts
  • src/main/daemon/pty-subprocess.ts
  • src/main/daemon/shell-ready.test.ts
  • src/main/daemon/shell-ready.ts
  • src/main/index.ts
  • src/main/ipc/pty.test.ts
  • src/main/ipc/pty.ts
  • src/main/providers/local-pty-provider.test.ts
  • src/main/providers/local-pty-provider.ts
  • src/main/providers/local-pty-shell-ready.test.ts
  • src/main/providers/local-pty-shell-ready.ts
  • src/main/providers/ssh-pty-provider.test.ts
  • src/main/pty/legacy-terminal-shim-dir.test.ts
  • src/main/pty/legacy-terminal-shim-dir.ts
  • src/main/runtime/claude-agent-teams-shim-env.test.ts
  • src/main/runtime/claude-agent-teams-shim-env.ts
  • src/main/runtime/claude-agent-teams-tmux-dispatcher.ts
  • src/main/runtime/orca-runtime-git.test.ts
  • src/main/runtime/orca-runtime-git.ts
  • src/main/runtime/rpc/methods/git-params.ts
  • src/main/runtime/rpc/methods/git.test.ts
  • src/main/runtime/rpc/methods/git.ts
  • src/main/text-generation/commit-message-text-generation.test.ts
  • src/relay/pty-handler.test.ts
  • src/renderer/src/components/settings/GitPane.tsx
  • src/renderer/src/components/settings/Settings.tsx
  • src/renderer/src/components/settings/git-search.ts
  • src/renderer/src/hooks/useSettingsNavigationMetadata.ts
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/i18n/locales/es.json
  • src/renderer/src/i18n/locales/ja.json
  • src/renderer/src/i18n/locales/ko.json
  • src/renderer/src/i18n/locales/zh.json
  • src/renderer/src/runtime/runtime-git-client.test.ts
  • src/renderer/src/runtime/runtime-git-client.ts
  • src/shared/commit-message-prompt.ts
  • src/shared/constants.ts
  • src/shared/external-worktree-inbox.test.ts
  • src/shared/orca-attribution.ts
  • src/shared/types.ts
  • src/shared/worktree-ownership.test.ts
💤 Files with no reviewable changes (20)
  • src/main/runtime/rpc/methods/git.test.ts
  • config/scripts/locale-zh-phrase-fixes-round5.mjs
  • config/scripts/locale-search-keyword-overrides.mjs
  • config/max-lines-baseline.txt
  • src/main/codex-accounts/service.test.ts
  • src/main/attribution/terminal-attribution.test.ts
  • src/main/attribution/terminal-attribution.ts
  • src/main/attribution/terminal-attribution-path-env-casing.test.ts
  • src/shared/constants.ts
  • src/shared/worktree-ownership.test.ts
  • src/main/codex-accounts/runtime-home-service.test.ts
  • src/main/runtime/rpc/methods/git-params.ts
  • src/shared/external-worktree-inbox.test.ts
  • src/shared/types.ts
  • src/shared/orca-attribution.ts
  • src/main/text-generation/commit-message-text-generation.test.ts
  • config/scripts/locale-ko-key-overrides.json
  • src/renderer/src/components/settings/GitPane.tsx
  • src/main/runtime/rpc/methods/git.ts
  • src/main/attribution/terminal-attribution-win32-dash-argument.test.ts

Comment on lines +44 to +50
export function stripLegacyTerminalShimEnv(
env: Record<string, string>,
platform: NodeJS.Platform = process.platform
): void {
for (const key of LEGACY_SHIM_ENV_KEYS) {
delete env[key]
}

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.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🌐 Web query:

Does Node.js child_process spawn treat Windows environment variable names case-insensitively when an env object contains a mixed-case key such as orca_attribution_shim_dir?

💡 Result:

Yes, Node.js child_process spawn treats environment variable names case-insensitively on Windows [1][2]. When you provide an env object to spawn on Windows, Node.js performs a sanitization step to handle the fact that Windows environment variables are case-insensitive [3][4]. Specifically, it lexicographically sorts the keys in the provided env object and keeps only the first entry that matches a given name when compared case-insensitively [1][5]. If your env object contains multiple variants of the same key (e.g., ORCA_ATTRIBUTION_SHIM_DIR and orca_attribution_shim_dir), only the one that appears first lexicographically will be passed to the spawned subprocess [1][3]. This behavior is designed to prevent issues caused by duplicate environment variable keys with different casings, which can confuse some applications on Windows [3][4].

Citations:


🏁 Script executed:

#!/bin/bash
set -e
file=$(fd -t f 'legacy-terminal-shim-dir\.ts$' . | head -n 1)
printf '%s\n' "$file"
ast-grep outline "$file"
printf '\n--- implementation ---\n'
cat -n "$file"
printf '\n--- references ---\n'
rg -n -C 3 'stripLegacyTerminalShimEnv|LEGACY_SHIM_ENV_KEYS' .
printf '\n--- related tests ---\n'
fd -t f -i 'legacy.*shim|terminal.*shim' . | sort

Repository: stablyai/orca

Length of output: 9469


🏁 Script executed:

#!/bin/bash
set -e
printf '%s\n' '--- path-key resolver ---'
resolver=$(fd -t f 'windows-environment-path\.ts$' . | head -n 1)
printf '%s\n' "$resolver"
cat -n "$resolver"
printf '%s\n' '--- existing tests ---'
test_file=$(fd -t f 'legacy-terminal-shim-dir\.test\.ts$' . | head -n 1)
cat -n "$test_file"
printf '%s\n' '--- environment construction around the call site ---'
cat -n src/main/ipc/pty.ts | sed -n '1840,1910p'

Repository: stablyai/orca

Length of output: 21933


Delete legacy environment keys case-insensitively on Windows.

When platform === 'win32', remove every env key matching LEGACY_SHIM_ENV_KEYS without regard to case. Windows environment names are case-insensitive, so stale shim configuration can survive when only the uppercase spelling is deleted.

Add a test for a case-variant key.

"5235c215ca": "「タスク」ページとサイドバーに表示するタスクプロバイダーを選択します。",
"85f4fd7710": "タスクソース",
"ab4b21b58e": "ブランチの名前、基本参照、帰属、および Git AI 作成者。",
"ab4b21b58e": "ブランチの名前、基本参照、および Git AI 作成者。",

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.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Remove obsolete attribution text from localized Git descriptions. The attribution setting is removed, but the updated Japanese and Chinese descriptions still mention it. Remove that phrase from both entries so the settings and search UI describe only the remaining branch-naming and base-reference options.

📍 Affects 2 files
  • src/renderer/src/i18n/locales/ja.json#L789-L789 (this comment)
  • src/renderer/src/i18n/locales/zh.json#L789-L789

@nwparker
nwparker merged commit c86418e into main Aug 13, 2026
51 checks passed
@nwparker
nwparker deleted the nwparker/git-attribution-shim-removal branch August 13, 2026 01:54
eccosai2018 pushed a commit to eccosai2018/orca that referenced this pull request Aug 26, 2026
Upstream removed the terminal git/gh attribution shim (rm git shim
stablyai#14141, stablyai#14255) and actively scrubs it on every spawn. Restoring
terminal-attribution.ts and orca-attribution.ts as standalone source
for reference/later rework, without rewiring the ~119 other files
upstream touched to remove it (settings toggle, PTY spawn, RPC
methods, locales, protocol version) — full revival would fight
upstream's active cleanup logic.
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
* rm git shim

Drops the terminal git/gh PATH wrapper and its settings toggle. Renames the no-marker shell-ready launch config after what it does.

Co-authored-by: Orca <[email protected]>

* rm git shim: clear stale state from older installs

Deletes the orphaned wrapper dir and scrubs inherited env/PATH, so a daemon that outlives the upgrade cannot keep seeding it. Drops a now-unread spawn option.

Co-authored-by: Orca <[email protected]>

* rm git shim: cover the daemon and headless paths

Scrub after the PATH prepends (they re-read process.env on the sparse daemon env) and run the cleanup above the serve branch so remote hosts get it too. Retry a locked removal; match PATH case-insensitively.

Co-authored-by: Orca <[email protected]>

* rm git shim: keep the scrub final

Refuse to re-prepend a legacy entry during agent-teams PATH promotion, which runs after the scrub. Cover the removal guard.

Co-authored-by: Orca <[email protected]>

---------

Co-authored-by: Orca <[email protected]>
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