Add PR creation action to pane git controls - #392
Conversation
parsakhaz
left a comment
There was a problem hiding this comment.
Verdict: Request changes. The create-PR path has two command-construction defects and malformed user-facing output.
The required .claude/agents/code-reviewer.md file is absent from this checkout, so the named skill could not be run under its own contract. I completed the correctness and security review directly using the available review schema.
Must Fix
-
MF-1: The handler resolves the PR base with
getSessionComparisonBranch, which can intentionally returnsession.baseCommitfor legacy panes (main/src/services/__tests__/worktreeManager.test.ts:224-240). That value is then sent togh pr create --base(main/src/ipc/git.ts:1464-1476,main/src/services/worktreeManager.ts:1294-1300). GitHub CLI requires a branch name for--base, so affected legacy panes cannot create a PR. Use the local base-branch resolver intended for write targets and test the legacy-session case. -
MF-2 (security): The new shell command escapes refs with host-platform rules (
main/src/services/worktreeManager.ts:1294-1300). On Windows,escapeShellArgproduces double-quoted arguments, but a WSLCommandRunnerexecutes the result through Linux Bash. Git accepts refs such asrefs/heads/$(touch-pwned)and backtick forms, and Bash expands those inside double quotes. Clicking PR in a WSL-backed repository can therefore execute command substitutions embedded in a crafted valid branch name. Use Bash-specific single-quote escaping whenevercommandRunner.wslContextis set, and cover shell-sensitive refs in a unit test. -
MF-3: The new start, success, and failure messages contain mojibake (
main/src/ipc/git.ts:1466,main/src/ipc/git.ts:1480,main/src/ipc/git.ts:1505). Users receiveðŸ...andâœ...instead of the intended symbols. Replace them with the same Unicode strings used by adjacent git operations.
Should Fix
- SF-1: No behavior test exercises
createPullRequest; the only added test assertion checks channel registration (main/src/ipc/daemonRegistryBindings.test.ts:197). Add focused tests for command construction, URL extraction, WSL escaping, and error metadata. These tests are also needed to prove the security and base-branch fixes.
Security checks
- Session and worktree existence are validated before process execution.
- The URL opened in the renderer is derived from a GitHub-only regex in the main process.
- No secrets are added to logs or IPC payloads.
Final verification addendum at 8bed17bWindows CI exposed a platform-specific test assertion: native Windows correctly uses double-quoted shell arguments, while the test expected Unix single quotes. Commit 8bed17b makes the normalized-base behavior test deterministic without changing product behavior. Current verification:
All three requested passes and their product changes remain as documented in the detailed QA comment. The branch is pushed to styrse/pr. No merge was performed. Left for parsa: let the new CI run finish, optionally exercise one real authenticated PR creation on a disposable branch, then merge when satisfied. |


Description
Adds a PR action to worktree pane git controls. The action creates a GitHub pull request with
gh pr create --fill, refreshes PR status, and opens the created PR URL. Also fixes a daemon IPC channel ownership mismatch forsessions:set-active-session.Type of Change
Checklist
pnpm typecheckandpnpm lintlocallypnpm electron-devCritical Areas Modified
Automated QA
Status: Passed at
8bed17ba.Real GitHub PR creation was intentionally not executed against an external repository. Parsa may optionally verify that mutation with a disposable branch before merge.