Skip to content

feat(app-server): expose CODEX_COMPANION_APP_SERVER_DISABLE_BROKER env var - #691

Open
tyoon10 wants to merge 2 commits into
openai:mainfrom
tyoon10:devin/disable-broker-env
Open

feat(app-server): expose CODEX_COMPANION_APP_SERVER_DISABLE_BROKER env var#691
tyoon10 wants to merge 2 commits into
openai:mainfrom
tyoon10:devin/disable-broker-env

Conversation

@tyoon10

@tyoon10 tyoon10 commented Aug 26, 2026

Copy link
Copy Markdown

Closes #602.

Summary

CodexAppServerClient.connect() already accepts options.disableBroker, but there is no supported way for an integrator to request direct app-server spawn from the environment. This adds CODEX_COMPANION_APP_SERVER_DISABLE_BROKER. When set to true, 1, or yes, the client skips broker discovery and spawns codex app-server directly, giving the caller strict per-job process lifetime without the malformed-endpoint workaround.

Pseudo-diff:

// app-server.mjs
+export const BROKER_DISABLE_ENV = "CODEX_COMPANION_APP_SERVER_DISABLE_BROKER";
+function resolveDisableBroker(options) {
+  if (options.disableBroker !== undefined) return Boolean(options.disableBroker);
+  const raw = options.env?.[BROKER_DISABLE_ENV] ?? process.env[BROKER_DISABLE_ENV];
+  return ["true", "1", "yes"].includes(String(raw).trim().toLowerCase());
+}

 static async connect(cwd, options = {}) {
-    if (!options.disableBroker) {
+    const disableBroker = resolveDisableBroker(options);
+    if (!disableBroker) {

options.disableBroker remains the explicit override. The existing CODEX_COMPANION_APP_SERVER_ENDPOINT behavior is unchanged. New unit tests in tests/app-server.test.mjs cover true, 1, and an explicit option override.

@tyoon10
tyoon10 requested a review from a team August 26, 2026 22:07

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

Copy link
Copy Markdown

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: a42211a662

ℹ️ 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".


export class CodexAppServerClient {
static async connect(cwd, options = {}) {
const disableBroker = resolveDisableBroker(options);

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 Honor the disable flag in runtime status

When this environment variable is enabled while either CODEX_COMPANION_APP_SERVER_ENDPOINT or a saved broker session exists, connect() correctly chooses the direct transport, but getSessionRuntimeStatus() in plugins/codex/scripts/lib/codex.mjs:906-914 still reports a “shared session” because it only checks for an endpoint. Consequently, /codex:status and setup output claim jobs are reusing the broker even though every connection bypasses it; apply the same disable-value resolution when determining the displayed runtime mode.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Applied: getSessionRuntimeStatus() now calls resolveDisableBroker() so /codex:status reports direct mode whenever CODEX_COMPANION_APP_SERVER_DISABLE_BROKER is set, even if a broker endpoint or saved session exists. Added tests/codex.test.mjs covering disable-wins-over-endpoint and the default cases.

@tyoon10
tyoon10 force-pushed the devin/disable-broker-env branch from a42211a to e297aae Compare August 26, 2026 22:11
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.

feat: expose disableBroker through an env var — there is no supported way to opt out of the shared app-server broker

1 participant