Skip to content

[Bug]: native-codex-toggle off/on regression fails on clean dev with service-home refusal #6776

Closed

Description

@thisisjun786

Client or integration

Other

Area

Other

Summary

The existing tests/codex-integration/native-codex-toggle.test.ts regression test turning Codex off > the status read follows an off-then-on round trip against the same stale server config fails on clean dev commit e6c6e13a22e465812f509a423990e9f09e32b1d0 (2.82.0 development version).

It expects the Codex status row to report state: "current", desiredEnabled: true after OFF then ON, but gets state: "absent", desiredEnabled: true. The run logs a service-home ownership refusal during enable. This report is about a reproducible test failure; it does not establish that the production ownership check is wrong. The fixture or host isolation may need correction rather than relaxing the ownership boundary.

The same failure occurs while reviewing an unrelated /v1/messages response-header change and in a separate pristine git archive HEAD copy without that source change. Each focused run reports 12 pass / 1 fail.

Reproduction

  1. Use a checkout of dev at e6c6e13a22e465812f509a423990e9f09e32b1d0 with dependencies installed.
  2. Start Bun with a fresh fake HOME (mandatory due to the separately tracked test-home hazard [Bug]: bare bun test prunes the real ~/.claude/agents/ocx-*.md (Bun homedir() ignores the preload's HOME sandbox) #6775):
FH=$(mktemp -d)
mkdir -p "$FH/.claude"
env -u HTTPS_PROXY -u NODE_EXTRA_CA_CERTS HOME="$FH" CLAUDE_CONFIG_DIR="$FH/.claude" \
  "$BUN_BIN" test --cwd "$CHECKOUT" tests/codex-integration/native-codex-toggle.test.ts

Here BUN_BIN is the absolute Bun executable path and CHECKOUT is the clean repository directory.

  1. Observe the failure at line 167. The test creates synthetic OPENCODEX_HOME and CODEX_HOME fixtures plus a matching v2 service-state.json, dispatches OFF and ON to /api/native-integrations/codex, then reads /api/native-integrations against the original in-memory config.
  2. To rule out an uncommitted patch, repeat from a pristine git archive HEAD extraction with the same installed dependencies. This independently reproduces the same 12 pass / 1 fail result.

No real user configuration or live service was modified for these reproductions. No provider calls are needed.

Version

2.82.0-dev, commit e6c6e13

Operating system

Linux x86_64, kernel 7.0.0-38-generic; Bun 1.4.0 (34cbb9a40)

Provider and model

Not provider-specific; local integration fixture only.

Logs or error output

[opencodex] Codex write refused (service-home): this proxy could not prove it owns the installed service homes, so catalog sync and Codex config injection were skipped. POST /api/sync returns the specific reason.

167 | expect(body.clients.find(client => client.clientId === "codex")).toMatchObject({
error: expect(received).toMatchObject(expected)

  {
    "desiredEnabled": true,
-   "state": "current",
+   "state": "absent",
  }

(fail) turning Codex off > the status read follows an off-then-on round trip against the same stale server config
12 pass
1 fail
Ran 13 tests across 1 file.

Screenshots and supporting files

No screenshots. The reproduction uses the existing committed test and no additional fixture files.

Redacted configuration

{
  "port": 10100,
  "providers": {
    "openai": {
      "adapter": "openai-responses",
      "baseUrl": "https://chatgpt.com/backend-api/codex",
      "authMode": "forward"
    }
  },
  "defaultProvider": "openai"
}

Checks

  • I searched existing issues and documentation.
  • I removed secrets, tokens, account details, request credentials, and personal data.

Activity

  1. added
    bug
    on Oct 8, 2026
  2. lidge-jun commented on Oct 9, 2026

    @lidge-jun
    Owner

    Fixed on dev by #6834 (merge commit c4baa30).

    The fixture's service-state.json was read correctly. The refusal came from inspectServiceManagerInstallation, which asks the real service manager (launchctl on macOS, systemctl --user on Linux), something HOME cannot redirect. On a machine with a registered opencodex service, that live registration made ownership unprovable. The test now stubs the manager probe to absent and asserts it is still consulted during enable. The production ownership boundary is unchanged. Thanks for keeping the report to what the evidence showed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions