Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions extensions/acpx/src/codex-auth-bridge.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,15 @@ describe("prepareAcpxCodexAuthConfig", () => {
expect(wrapper).not.toMatch(
/forceKillTimer = setTimeout\(\(\) => killChildTree\("SIGKILL"\), 1_500\);\s*forceKillTimer\.unref\?\.\(\);\s*process\.exit\(1\);/s,
);
// Orphan detection must trigger on any PPID change, not only when the new
// PPID is init (1). Systemd user services and container init reparent
// orphaned processes to a session manager or container init (PID != 1),
// and the older `process.ppid !== 1` guard would silently leak the codex
// adapter tree there.
expect(wrapper).not.toContain("process.ppid !== 1");
expect(wrapper).toMatch(
/setInterval\(\(\) => \{[\s\S]*?if \(process\.ppid === originalParentPid\) \{\s*return;\s*\}/,
);
});

it("uses the bundled Claude ACP dependency by default when it is installed", async () => {
Expand Down
8 changes: 7 additions & 1 deletion extensions/acpx/src/codex-auth-bridge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,13 @@ const parentWatcher =
process.platform === "win32"
? undefined
: setInterval(() => {
if (process.ppid === originalParentPid || process.ppid !== 1) {
// Orphan detection: parent PID changed means our original parent died.
// The new parent could be PID 1 (init) on bare-metal hosts, OR a
// systemd user-session manager, OR a container init, OR a session
// leader — depending on environment. Previously this only triggered
// on PPID == 1, which missed all systemd-managed deployments and
// leaked codex-acp adapter trees on every gateway restart.
if (process.ppid === originalParentPid) {
return;
}
if (orphanCleanupStarted) {
Expand Down
1 change: 1 addition & 0 deletions test/scripts/ci-workflow-guards.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -658,6 +658,7 @@ describe("ci workflow guards", () => {
expect(generateJob.if).toBe("${{ inputs.qa_evidence_run_id == '' }}");
expect(generateJob.uses).toBe("./.github/workflows/qa-profile-evidence.yml");
expect(generateJob.with).toMatchObject({
// Keep the caller's ref while the callee verifies it against expected_sha.
ref: "${{ inputs.ref }}",
expected_sha: "${{ needs.validate_selected_ref.outputs.selected_revision }}",
qa_profile: "release",
Expand Down
Loading