Skip to content

codex: honor --cwd when reporting session runtime#35

Open
VOIDXAI wants to merge 2 commits intoopenai:mainfrom
VOIDXAI:voidxai/issue-30-cwd-runtime
Open

codex: honor --cwd when reporting session runtime#35
VOIDXAI wants to merge 2 commits intoopenai:mainfrom
VOIDXAI:voidxai/issue-30-cwd-runtime

Conversation

@VOIDXAI
Copy link
Copy Markdown
Contributor

@VOIDXAI VOIDXAI commented Mar 31, 2026

Summary

  • resolve shared-session runtime against the target workspace instead of the invocation directory
  • thread the resolved workspace through setup, status, and getSessionRuntimeStatus(...)
  • add regression coverage for the cross-workspace --cwd case

Why

Closes #30.

setup --cwd and status --cwd can misreport direct startup when a shared broker exists for the target workspace but the command is invoked from a different directory.

Validation

  • added a regression test for setup/status --cwd workspace resolution
  • manually reproduced the bug by persisting broker state in workspace A, invoking from workspace B, and verifying getSessionRuntimeStatus(process.env, targetWorkspace) reports shared

@VOIDXAI VOIDXAI requested a review from a team March 31, 2026 03:38
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment on lines +677 to +678
const workspaceRoot = resolveWorkspaceRoot(cwd);
const endpoint = env?.[BROKER_ENDPOINT_ENV] ?? loadBrokerSession(workspaceRoot)?.endpoint ?? null;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

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.

setup --cwd and status --cwd read broker state from the invocation directory instead of the target workspace

1 participant