Skip to content
Open
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
2 changes: 1 addition & 1 deletion plugins/codex/scripts/codex-companion.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ function buildSetupReport(cwd, actionsTaken = []) {
npm: npmStatus,
codex: codexStatus,
auth: authStatus,
sessionRuntime: getSessionRuntimeStatus(),
sessionRuntime: getSessionRuntimeStatus(process.env, workspaceRoot),
reviewGateEnabled: Boolean(config.stopReviewGate),
actionsTaken,
nextSteps
Expand Down
2 changes: 1 addition & 1 deletion plugins/codex/scripts/lib/job-control.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ export function buildStatusSnapshot(cwd, options = {}) {
return {
workspaceRoot,
config,
sessionRuntime: getSessionRuntimeStatus(options.env),
sessionRuntime: getSessionRuntimeStatus(options.env, workspaceRoot),
running,
latestFinished,
recent,
Expand Down
25 changes: 24 additions & 1 deletion tests/runtime.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { spawn } from "node:child_process";

import { buildEnv, installFakeCodex } from "./fake-codex-fixture.mjs";
import { initGitRepo, makeTempDir, run } from "./helpers.mjs";
import { loadBrokerSession } from "../plugins/codex/scripts/lib/broker-lifecycle.mjs";
import { loadBrokerSession, saveBrokerSession } from "../plugins/codex/scripts/lib/broker-lifecycle.mjs";
import { resolveStateDir } from "../plugins/codex/scripts/lib/state.mjs";

const ROOT = "/Users/dkundel/code/codex-plugin";
Expand Down Expand Up @@ -1698,3 +1698,26 @@ test("status reports shared session runtime when a lazy broker is active", () =>
assert.equal(result.status, 0, result.stderr);
assert.match(result.stdout, /Session runtime: shared session/);
});

test("setup and status honor --cwd when reading shared session runtime", () => {
const targetWorkspace = makeTempDir();
const invocationWorkspace = makeTempDir();

saveBrokerSession(targetWorkspace, {
endpoint: "unix:/tmp/fake-broker.sock"
});

const status = run("node", [SCRIPT, "status", "--cwd", targetWorkspace], {
cwd: invocationWorkspace
});
assert.equal(status.status, 0, status.stderr);
assert.match(status.stdout, /Session runtime: shared session/);

const setup = run("node", [SCRIPT, "setup", "--cwd", targetWorkspace, "--json"], {
cwd: invocationWorkspace
});
assert.equal(setup.status, 0, setup.stderr);
const payload = JSON.parse(setup.stdout);
assert.equal(payload.sessionRuntime.mode, "shared");
assert.equal(payload.sessionRuntime.endpoint, "unix:/tmp/fake-broker.sock");
});