codex: honor --cwd when reporting session runtime#35
codex: honor --cwd when reporting session runtime#35VOIDXAI wants to merge 2 commits intoopenai:mainfrom
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 42aa3e4b7b
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
plugins/codex/scripts/lib/codex.mjs
Outdated
| const workspaceRoot = resolveWorkspaceRoot(cwd); | ||
| const endpoint = env?.[BROKER_ENDPOINT_ENV] ?? loadBrokerSession(workspaceRoot)?.endpoint ?? null; |
There was a problem hiding this comment.
Preserve subdirectory broker session lookup
getSessionRuntimeStatus now always resolves cwd to the Git top-level before loading broker.json, but broker sessions are still persisted using the raw cwd passed to ensureBrokerSession (via CodexAppServerClient.connect(cwd) in review flows). In the scenario where a command is run from a repo subdirectory (or with --cwd pointing to one) and CODEX_COMPANION_APP_SERVER_ENDPOINT is not set, setup/status will now look in the workspace root and report direct startup even though a shared broker session exists under the subdirectory state path.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Addressed in 49d8d0c. I removed the extra workspace-root normalization inside getSessionRuntimeStatus(...) and kept the fix scoped to the callers that were actually wrong (setup and status now pass the resolved target workspace). That preserves the original lookup semantics for any other call sites while still fixing the cross-workspace --cwd bug.
Summary
setup,status, andgetSessionRuntimeStatus(...)--cwdcaseWhy
Closes #30.
setup --cwdandstatus --cwdcan misreportdirect startupwhen a shared broker exists for the target workspace but the command is invoked from a different directory.Validation
setup/status --cwdworkspace resolutiongetSessionRuntimeStatus(process.env, targetWorkspace)reportsshared