Skip to content

fix: synchronize plugin pane pwd - #2985

Merged
ogulcancelik merged 4 commits into
masterfrom
akbash/2984-popup-pwd
Aug 19, 2026
Merged

fix: synchronize plugin pane pwd#2985
ogulcancelik merged 4 commits into
masterfrom
akbash/2984-popup-pwd

Conversation

@akbash-bot

@akbash-bot akbash-bot commented Aug 19, 2026

Copy link
Copy Markdown
Collaborator

Issue

Opening a plugin popup with --cwd starts the process in the requested directory, but PWD can still point to the server's old directory. Applications that read PWD may then open in the wrong place.

Problem

Herdr changed the process directory without updating PWD. Shells correct PWD when they start, which hid the bug. Direct applications kept the old value.

How did we fix it?

On Unix, plugin panes now set PWD to the launch directory unless the caller supplied its own value. This applies to popup, overlay, split, zoomed, and tab placements. Regular panes and other platforms are unchanged.

Verification

Before the fix, a Python popup started in /var/tmp/akbash-2984-target, but PWD still pointed to /var/tmp/akbash-2984-repro. After the fix, both values point to the target directory in fresh sessions.

The focused regression test and all 54 plugin API tests pass. Linux, macOS, Windows, and ConPTY CI pass. CodeRabbit and Greptile completed their reviews. The local suite passed 3477 of 3478 tests. The remaining live-handoff test starts its replacement process, but cannot find Kennel's build directory outside the checkout.

refs #2984

@kangal-bot kangal-bot added the ai-review Trigger automated AI reviews for pull requests admitted by the PR gate label Aug 19, 2026
@coderabbitai

coderabbitai Bot commented Aug 19, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 0188bfe2-040c-4ff5-891d-571db6d48a45

📥 Commits

Reviewing files that changed from the base of the PR and between 63e8aa8 and 413eeae.

📒 Files selected for processing (1)
  • docs/next/CHANGELOG.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • docs/next/CHANGELOG.md

Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review.


📝 Walkthrough

Walkthrough

Plugin pane launches now reuse one resolved working directory for command and environment construction. Unix environments add PWD only when it is absent. Unix CLI output now manages SIGPIPE disposition through platform helpers.

Changes

Plugin pane PWD handling

Layer / File(s) Summary
Resolve and pass pane working directories
src/app/api/plugins/panes.rs
Popup, overlay, split, and tab launches pass the resolved working directory to environment construction and pane commands.
Set and validate platform-specific PWD
src/app/api/plugins/panes.rs, src/platform/*.rs, docs/next/CHANGELOG.md
Environment construction delegates PWD handling to platform code. Unix inserts PWD only when absent. Non-Unix platforms use no-op implementations. Tests cover both cases. The changelog places the fix under Unreleased.

Unix CLI output handling

Layer / File(s) Summary
Manage SIGPIPE during CLI output
src/platform/unix_common.rs
CLI output helpers change SIGPIPE handling before and after output.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: ⚪ Minimal · up to 413ee

This localized change synchronizes plugin-pane PWD with the requested launch directory on Unix while preserving caller-provided values and leaving regular panes and other platforms unchanged. No actionable merge-blocking risk remains after normal checks and review.

Sequence Diagram(s)

sequenceDiagram
  participant PaneLaunch
  participant plugin_pane_launch_env
  participant PlatformPwdHelper
  participant PluginPaneCommand
  PaneLaunch->>plugin_pane_launch_env: pass resolved working directory
  plugin_pane_launch_env->>PlatformPwdHelper: set default PWD when absent
  PlatformPwdHelper->>PluginPaneCommand: provide environment
  PaneLaunch->>PluginPaneCommand: launch with resolved working directory
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. 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 describes the primary change: synchronizing plugin pane PWD values.
Description check ✅ Passed The description explains the stale PWD issue, the Unix fix, affected pane placements, and verification results.
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
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch akbash/2984-popup-pwd

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

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: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: e790bcea-af02-4ea6-94e9-0a54c318e26d

📥 Commits

Reviewing files that changed from the base of the PR and between a5c69be and 784c799.

📒 Files selected for processing (2)
  • docs/next/CHANGELOG.md
  • src/app/api/plugins/panes.rs

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.

Comment thread docs/next/CHANGELOG.md Outdated
Comment thread src/app/api/plugins/panes.rs Outdated
@greptile-apps

greptile-apps Bot commented Aug 19, 2026

Copy link
Copy Markdown

Greptile Summary

The PR synchronizes PWD with the resolved working directory for Unix plugin panes while preserving an explicitly supplied value.

  • Resolves the plugin pane cwd before constructing its launch environment across popup, overlay, split, zoomed, and tab placements.
  • Adds a Unix platform helper that defaults PWD to that cwd, with no-op implementations on other platforms.
  • Adds focused helper coverage and documents the fix in the changelog.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
src/app/api/plugins/panes.rs Passes each resolved plugin pane cwd into centralized launch-environment construction before spawning every supported placement.
src/platform/unix_common.rs Adds the Unix policy that supplies PWD from cwd only when the caller did not provide PWD, with focused unit coverage.
src/platform/fallback.rs Exposes the new platform function through matching Unix reexport and non-Unix no-op cfg branches.
src/platform/linux.rs Reexports the shared Unix PWD helper through the Linux platform surface.
src/platform/macos.rs Reexports the shared Unix PWD helper through the macOS platform surface.
src/platform/windows.rs Adds the intentional Windows no-op required to keep the platform function surface uniform.
docs/next/CHANGELOG.md Documents Unix plugin pane PWD synchronization and explicit-value preservation.

Reviews (3): Last reviewed commit: "docs: fix changelog conflict resolution" | Re-trigger Greptile

@ogulcancelik
ogulcancelik merged commit 7d35ebe into master Aug 19, 2026
7 checks passed
@kangal-bot kangal-bot removed the ai-review Trigger automated AI reviews for pull requests admitted by the PR gate label Aug 19, 2026
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.

3 participants