Repository navigation
fix(agent-hooks): recognize Orca Codex, Cursor, Copilot, and Kiro hook commands - #50185
Merged
Merged
Conversation
dluxhu
pushed a commit
to dluxhu/orca
that referenced
this pull request
Nov 27, 2026
…k commands (stablyai#50185) (cherry picked from commit 36dcde4)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes a regression from #49456 (
2f8456fad66) wherecreateManagedCommandMatcherfailed to recognize Orca's own hook commands, causing repeated hook duplication on every reconcile pass — most visibly appending duplicateReporting status to Orcaentries to~/.codex/hooks.jsonwhilefindStaleOrcaApprovalsstrippedtrusted_hashfrom all earlier copies in~/.codex/config.toml(triggering Codex's "Hooks need review — N hooks are new or changed" prompt).Root causes fixed
posix-condition-clauses.ts):POSIX_ENV_GUARD_CLAUSEonly matched[ -n "${ORCA_PANE_KEY|ORCA_AGENT_PANE|HOME-}" ], rejecting[ -n "${ORCA_AGENT_HOOK_ROOT-}" ],[ -z "${ORCA_AGENT_HOOK_ROOT-}" ], and[ -n "${ORCA_AGENT_HOOK_PORT-}" ]emitted bybuildCodexHookCommand.posix-condition-clauses.ts):unquoteSinglePosixTokenonly unescaped'\'', rejecting portablequoteStartupArgfragments ("'"and"\\") used in Cursor's/bin/sh -c '...'wrapper (which caused~/.cursor/hooks.jsonto duplicate as well).managed-hook-command-ownership.ts): addedisManagedWindowsCmdCommandforcmd.exe --% /d /v:off /c @"<script>"(Codex) andcmd.exe /d /c <script> <event>(Copilot).managed-hook-command-ownership.ts): accepted the UTF-8 encoding prefix in Cursor's encoded PowerShell command and the leadingif defined ORCA_PANE_KEYguard in Kiro's standalone Windows command.Performance
Improves hook reconciliation and agent hook execution performance by stopping unbounded duplication of
~/.codex/hooks.jsonand~/.cursor/hooks.jsonentries (which otherwise grew on every reconcile pass and forced repeated file rewrites and hook spawns). The ownership check itself runs in linear time over short hook command strings during hook reconciliation only.Verification
planRealHomeCodexHookEntriesandremoveManagedCommandsagainst live duplicated~/.codex/hooks.json(34–36 entries/event → pruned to 1 Orca hook + all user hooks; pass 2 settled withchangedLabels=0) and~/.cursor/hooks.json(13–14 entries/event → all 13 Orca duplicates removed, all user hooks preserved).pnpm oxfmt,pnpm oxlint, andpnpm run typecheck:node.