Skip to content

(Regression) PTY config overlay source dirs#1694

Merged
brennanb2025 merged 6 commits into
stablyai:mainfrom
P-de-Jong:P-de-Jong/opencode-dir-regression
May 12, 2026
Merged

(Regression) PTY config overlay source dirs#1694
brennanb2025 merged 6 commits into
stablyai:mainfrom
P-de-Jong:P-de-Jong/opencode-dir-regression

Conversation

@P-de-Jong
Copy link
Copy Markdown
Contributor

Summary

Fixes a regression where Orca created a per-PTY OpenCode/Pi overlay, but could lose the user's original config directory as the source to mirror.

The overlay creation itself was working when Orca already knew the real config dir: the user config contents were mirrored and Orca's plugin was added. The broken case was source discovery/preservation. If Orca launched without inheriting OPENCODE_CONFIG_DIR / PI_CODING_AGENT_DIR, but the user's shell startup file later exported them, .zshrc could overwrite the PTY-scoped overlay after spawn. Also, nested Orca terminals could inherit an overlay as the public env var and accidentally re-mirror the overlay instead of the user's real config.

This patch preserves the original source dir in internal ORCA_*_SOURCE_* env vars before replacing the public env vars with the PTY overlay, and adds a POSIX startup-file fallback for simple exported config-dir assignments.

Fixes #1534

Screenshots

No visual change.

Testing

  • pnpm lint
  • pnpm typecheck
  • pnpm test src/main/ipc/pty.test.ts src/main/opencode/hook-service.test.ts src/main/pi/titlebar-extension-service.test.ts
  • pnpm build
  • Added regression tests for nested overlay source preservation and startup-file-only config exports.

AI Review Report

Reviewed the PTY env injection path for local, daemon, fallback shell, and SSH behavior. The fix is scoped to host-local PTY env construction; SSH paths continue to skip host-local OpenCode/Pi overlay injection.

Cross-platform review: POSIX startup-file parsing is guarded off on Windows. Existing PowerShell and shell wrapper restore behavior remains unchanged. Path handling uses Node path utilities.

Security Audit

Reviewed input/path handling around config-dir discovery. The new startup-file reader only reads known shell startup files under the user home directory and extracts simple env assignments; it does not execute shell code. No new IPC surface, command execution, auth, secrets, or dependency changes.

@P-de-Jong
Copy link
Copy Markdown
Contributor Author

P-de-Jong commented May 11, 2026

@brennanb2025 i tested the new 1.3.48 release, but it seems i missed something. Fix seemed to work fine with existing workspaces but not with new workspaces.

This should fix that.

@nwparker nwparker requested a review from brennanb2025 May 12, 2026 06:21
P-de-Jong and others added 5 commits May 12, 2026 00:28
Co-authored-by: Orca <help@stably.ai>
…on' into P-de-Jong/opencode-dir-regression

# Conflicts:
#	src/main/ipc/pty.test.ts
#	src/main/ipc/pty.ts
#	src/main/pty/shell-startup-env.ts
Co-authored-by: Orca <help@stably.ai>
@brennanb2025 brennanb2025 merged commit 3bfc871 into stablyai:main May 12, 2026
2 checks passed
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.

[Feature]: Show OpenCode agent state in workspace sidebar

2 participants