fix(codex): handle native Windows PIDs in bridge liveness checks#323
Open
Tlryd wants to merge 1 commit into
Open
fix(codex): handle native Windows PIDs in bridge liveness checks#323Tlryd wants to merge 1 commit into
Tlryd wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR improves Codex bridge robustness on Windows/MSYS by introducing cross-platform PID liveness/termination helpers, applying them to Codex bridge/app-server lifecycle checks, and making Codex bridge metadata comparisons tolerant of path aliases via canonicalization.
Changes:
- Add
compat_pid_alive/compat_kill_pidfor Windows-native PID handling under MSYS/Git Bash. - Use these helpers across Codex monitor/launcher/session-start/delivery status/stop paths.
- Canonicalize Codex bridge metadata
project=before comparing, with a new Bats test covering the alias-path case.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/test_delivery.bats | Adds a regression test ensuring canonicalized project metadata matches are accepted. |
| scripts/lib/compat.sh | Introduces PID liveness/kill helpers for MSYS/Windows native PIDs. |
| scripts/drivers/types/codex/codex-monitor.sh | Uses compat PID helpers when reusing/killing the Codex app-server. |
| scripts/drivers/types/codex/codex-bridge-launcher.sh | Sources compat and uses compat PID helpers for bridge reuse/teardown. |
| scripts/drivers/types/codex/_session-start.sh | Uses compat PID liveness checks when deciding whether to reuse an existing bridge. |
| scripts/drivers/types/codex/_delivery.sh | Canonicalizes metadata project paths; uses compat PID liveness for status. |
| scripts/delivery.sh | Uses compat PID helpers when stopping Codex bridge and app-server processes. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+80
to
+90
| local psw | ||
| psw=$(ps -W 2>/dev/null || true) | ||
| if [ -n "$psw" ]; then | ||
| printf '%s\n' "$psw" | awk -v pid="$pid" 'NR > 1 && $4 == pid { found=1 } END { exit found ? 0 : 1 }' && return 0 | ||
| return 1 | ||
| fi | ||
| psbin=$(_compat_powershell_bin) || return 1 | ||
| "$psbin" -NoProfile -Command \ | ||
| "\$p = Get-Process -Id $pid -ErrorAction SilentlyContinue; if (\$null -eq \$p) { exit 1 } else { exit 0 }" \ | ||
| >/dev/null 2>&1 | ||
| ;; |
Comment on lines
+103
to
+114
| local msys_pid psw | ||
| psw=$(ps -W 2>/dev/null || true) | ||
| if [ -n "$psw" ]; then | ||
| msys_pid=$(printf '%s\n' "$psw" | awk -v pid="$pid" 'NR > 1 && $4 == pid { print $1; exit }') | ||
| [ -n "$msys_pid" ] && kill "$msys_pid" 2>/dev/null && return 0 | ||
| return 1 | ||
| fi | ||
| psbin=$(_compat_powershell_bin) || return 1 | ||
| "$psbin" -NoProfile -Command \ | ||
| "Stop-Process -Id $pid -ErrorAction Stop" \ | ||
| >/dev/null 2>&1 | ||
| ;; |
Comment on lines
+1500
to
+1501
| local dead_pid=999999 | ||
| printf '%s\n' "$dead_pid" > "$TEST_SKILL_DIR/run/codex-bridge.team.alice.pid" |
Author
|
AI review comments are left unresolved for maintainers' judgment. |
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
Verification
git diff --cached --checkbash -non changed shell scriptsbats tests/because bats is not installed locallyhelper tests