Skip to content

feat(desktop): support usage push and version-independent compatibility - #7368

Closed
luvs01 wants to merge 3 commits into
devfrom
codex/desktop-compat-usage-contract
Closed

luvs01 wants to merge 3 commits into
devfrom
codex/desktop-compat-usage-contract

Conversation

@luvs01

@luvs01 luvs01 commented Oct 19, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Codex can disable its composer when the signed-in account is exhausted even though OpenCodex can route through another pool account or provider. The existing compatibility relay also rejects every package version except its historical reference and only handles GET/SSE usage, allowing newer subscription or push responses to restore the blocked cache.

  • Identify the official Windows package independently of its version, and enforce the known usage contract on each response. Keep diagnostic package identity separate from native UI recovery proof.
  • Cover GET/SSE, POST usage subscriptions and the exact usage topic on the realtime broker. Preserve unrelated messages, real quota windows, credits, spending restrictions, authentication and provider-side limits. Broker transport retains ordered async delivery, binary/text kind, heartbeat, cancellation and cleanup; its bounded 100 MiB transport ceiling is separate from the 256 KiB rewrite limit.
  • Retain the three-minute trial. Add a separately consented, nonpersistent runtime-session lifetime that handles recovery and later exhaustion until withdrawal, identity/routing invalidation, runtime stop or the certificate safety deadline. Legacy requests remain trials; older servers never silently receive the new mode.
  • Reuse completed package proof for at most 60 seconds while checking routing and identity for each candidate output. Start, launch and activation check fresh. There is no model call or per-version source analysis in the production path.

The relay adds only the fixed ws.chatgpt.com:443 destination beside chatgpt.com:443; the existing constrained CA already covers that subdomain. HTTP remains restricted to chatgpt.com. The static npm alias desktop-ws selects the tested ws implementation rather than Bun's incompatible built-in shim.

Verification

  • Refreshed onto dev 12025981e without rewriting the published history. All 34 feature-change files are preserved; the three overlapping files combine the existing changes with current dev, including version 2.90.0.
  • Windows, Bun 1.4.3: bun scripts/test.ts --changed=12025981e5a304cdb6b1b54f525ba8554f623977 with 12 explicit file filters selected 11 affected files: 259 passed, 0 failed, 1,844 assertions. The unchanged layout-only file passed in the preceding direct run. Full repository and Linux coverage remain CI work.
  • Both Bun 1.4.2 (runtime dependency) and 1.4.3: transport regression runs passed. The final policy-error follow-up passed 17 WebSocket cases on each, including original-byte preservation, connection-local correction suspension, refresh exclusion and late cancellation. These earlier runtime-specific checks remain evidence for the unchanged relay code. A compiled Bun 1.4.2 executable importing the production relay passed its isolated loopback smoke test with no remaining sockets, handles or requests.
  • GUI: 38 passed, 0 failed, 722 assertions, with Vite build and i18n lint passing. Fresh app/node TypeScript checks also passed with separate task-local caches, avoiding shared incremental-cache reuse.
  • Backend TypeScript, test layout, structure SSOT, privacy scan and diff checks passed. The full local file-size scan could not complete because this sparse checkout omits the tracked dist/bin/ocx.mjs; the full-checkout repository-scan assertion passed in hosted CI. An initially missing inventory fixture was materialized before the layout tooling case passed; no test logic was weakened.
  • Docs site built 585 pages and checked 83,063 internal links. English and Korean user guidance plus owning structure contracts are updated.
  • Independent boundary review found and reproduced a recovery-then-exhaustion batch bug; the consent-epoch fix and original reproducer passed before publication. Review covered fixed destinations, verified TLS, credential separation, async races and default-off/consent behavior.
  • A prior read-only diagnostic extracted the then-installed app's pure gate/cache/submit expressions and passed 59 synthetic cases. This establishes the current logical connection, not live network delivery or a real exhausted-account UI submission.

No live app, proxy, trust-store, account or configuration change was performed. Real exhaustion recovery and native Chat/mobile/remote-connection behavior remain unverified for this candidate. Runtime status continues to report cache/source-process/composer confirmation as false rather than infer it from response counts.

Screenshot: actual candidate panel and CSS, rendered headlessly against synthetic data; no account secrets or live dashboard calls.

Desktop compatibility service-session consent

The original Linux CI failure was remote_auth_failed in the messaging forgery fixture. Matched isolated Linux/Bun 1.4.3 base/HEAD tests subsequently passed, but did not explain that failure. One rerun of the old CI job stopped earlier at the release-version guard because version 2.89.0 had since shipped; it did not reach the authentication test. Hosted CI on dc84c0adb passed all four test shards, desktop shell, and the final ci gate. The original authentication test actually ran and passed in test 2/4 (46.93 ms); authentication assertions are unchanged. The old failure did not recur in this run, but its original cause remains unknown.

Checklist

  • Scope stays focused and avoids unrelated cleanup.
  • Docs or release notes were updated when needed.
  • Security-sensitive changes were reviewed for secrets, auth, and unsafe defaults.

Required CI is green. This remains a draft pending the requested maintainer transport/dependency and owner GUI/consent disposition. Local tests do not constitute deployment or authorization to activate service-session correction.

@github-actions github-actions Bot added the intake: hygiene-blocked Deterministic PR hygiene checks failed label Oct 19, 2026
@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Deterministic hygiene checks failed.

  • empty_catch — An empty catch block was added. Handle, report, or deliberately propagate the error. Paths: src/codex/desktop-compatibility/usage-websocket-relay.ts.

@github-actions github-actions Bot added the enhancement New feature or request label Oct 19, 2026
@github-actions

github-actions Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

✅ READY

  • all PR quality gates passed.

Hygiene

✅ Deterministic PR hygiene checks passed.

@coderabbitai

coderabbitai Bot commented Oct 19, 2026

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot removed the intake: hygiene-blocked Deterministic PR hygiene checks failed label Oct 19, 2026
@Ingwannu

Copy link
Copy Markdown
Owner

Scoped intake at e698b702c7ad763ad33cc51ff3bc28f8611ecaaf: the fixed ws.chatgpt.com destination, npm desktop-ws alias, TLS/credential separation and service-session correction consent require explicit transport/dependency and owner review. Your current-head CI failure disclosure is accurate: run 39225198470 failed test 1/4 on authenticated machine-name and sender-field forgery never reaches native queue / remote_auth_failed. An untouched file does not establish a baseline failure; please provide paired Linux/Bun 1.4.3 base/head evidence or fix the demonstrated regression. Do not weaken the authentication assertion or infer a clean run from Windows-only receipts. Keep Draft pending that CI result and owner GUI/consent disposition; no real trust-store, Desktop, proxy or account operation was performed here.

@luvs01

luvs01 commented Oct 19, 2026

Copy link
Copy Markdown
Collaborator Author

The original failure remains open at e698b702c7ad763ad33cc51ff3bc28f8611ecaaf. Additional unmodified-source Linux evidence is available, with one comparison limit still outstanding:

  • In an isolated official Ubuntu 24.04.5 container with Bun 1.4.3+c6da4a4d3, non-root UID 1000, normal root-owned ancestors, read-only source, and no external network, the named test passed 101/101 executions. The original eight-file batch passed five runs (86 tests per run), and the preceding CI batch followed by that batch also passed (212 then 86 tests).
  • HEAD and the CI merge commit 486f3469309b26055a3fae9b48e5ade074a1b25a have the same tree ceac6388ef2a0ac06ca66e353bf1121c3020d0bf.
  • The full base 52c326b479d0d5a7549d35663042f0731861202d has a passing target in CI run 39221379295. That base evidence is from hosted CI, not a direct base/head pair in the isolated container. The requested same-environment comparison is therefore not yet complete.

The failed job has 467 assertions versus 498 in the passing batch. The missing 31 are the named test's entire assertion count; failure occurs in the outer fixture authentication before the forged-envelope assertions. The logs do not identify the socket-close cause. Passing repetitions and unchanged source do not prove the failure is fixed or establish a baseline defect.

Earlier host-only runs encountered an ownership-layout mismatch; diagnostic changes used during that investigation are excluded from the evidence above. No authentication assertion was weakened in the accepted runs. Keeping Draft and the original CI failure disclosure while the paired comparison and owner transport/dependency/GUI-consent review remain outstanding.

@luvs01

luvs01 commented Oct 19, 2026

Copy link
Copy Markdown
Collaborator Author

The missing direct base/HEAD comparison is now available. Both revisions pass the focused test and the original eight-file batch under the matched Linux/Bun constraints:

Revision Focused test Original eight-file batch
Base 52c326b479d0d5a7549d35663042f0731861202d 1 pass, 0 fail, 31 assertions 86 pass, 0 fail, 498 assertions
HEAD e698b702c7ad763ad33cc51ff3bc28f8611ecaaf 1 pass, 0 fail, 31 assertions 86 pass, 0 fail, 498 assertions

The base was executed once for each test shape; the preserved matching HEAD runs were reused. Conditions: official Ubuntu 24.04.5, Bun 1.4.3+c6da4a4d3, UID/GID 1000:1000, read-only root filesystem, network disabled, capabilities dropped, no-new-privileges, and private root-owned sticky /tmp tmpfs. Both source checkouts were clean before image creation, and each revision used its own committed frozen lockfiles. The base/HEAD trees are 99b3f420c3d5a0e26d1a3d7f04550ae153d6d9d4 and ceac6388ef2a0ac06ca66e353bf1121c3020d0bf; the CI merge tree matches HEAD.

The focused command was bun test --isolate --timeout 60000 --test-name-pattern "authenticated machine-name and sender-field forgery never reaches native queue" tests/codex-integration/messaging-remote-gaps.test.ts. The batch used the original eight files in the same command order with the same Bun flags. All four selected command results exited 0; the target assertions and production authentication checks were unmodified.

After the completed tests, additional provenance commands were prevented from starting by bwrap: Can't create file /workspace/.git: No space left on device. This limits post-test environment inspection; the exact consuming object and byte-versus-inode cause were not established. It is not counted as a test failure or hidden as a clean environment result.

The original CI failure remains unreproduced, not fixed or converted to a passing result. The pair establishes that both revisions pass these test shapes under the documented constraints; it does not identify the original failure mechanism or prove a baseline defect. No source/authentication changes or CI reruns were made. Keeping Draft pending the existing transport/dependency and owner GUI/consent review.

Merge refs/heads/dev @ 1202598 into the
published PR head e698b70 (merge base
52c326b). Local base-refresh candidate;
published history preserved, no rebase.
@luvs01

luvs01 commented Oct 20, 2026

Copy link
Copy Markdown
Collaborator Author

Refreshed the branch onto dev 1202598 in dc84c0a, preserving the published history and all 34 feature-change files. Local changed-file checks passed 259 tests; GUI checks passed 38, and fresh app/node typechecks used separate caches. The old-job rerun stopped at the release-version guard before reaching the original authentication failure, so that issue is not claimed fixed. Fresh CI will test the updated branch; the PR remains Draft pending CI and the requested transport/dependency and GUI/consent review.

@luvs01

luvs01 commented Oct 20, 2026

Copy link
Copy Markdown
Collaborator Author

CI at dc84c0a is green, including desktop shell and the final gate. In test 2/4, the original authentication/forgery test actually ran and passed (46.93 ms), and the repository file-size scan passed. This establishes non-reproduction on this head, not the old failure's root cause. The PR remains Draft for the requested transport/dependency and GUI/consent disposition.

@Ingwannu

Copy link
Copy Markdown
Owner

Follow-up intake at dc84c0adb962ed3c58dc967cce64acef196283f2 against dev 12025981e5a304cdb6b1b54f525ba8554f623977. Current-head hosted CI passes, so I am not carrying the earlier Desktop fixture failure forward as a current failure. The patch still adds a WebSocket dependency/lock surface, authenticated Desktop relay/session/usage lifecycle and GUI controls. Keep independent boundary/sponsorship and owner UI/consent review separate from green Ubuntu tests. Required scope includes credential/destination ownership, upgrade/unknown-build decline, cancellation/EOF, reconnect/subscription cleanup and stale usage handling. No installed Desktop, paid upstream session, macOS/Windows acceptance or dependency execution is certified by this scoped intake.

@lidge-jun

Copy link
Copy Markdown
Owner

Thank you for the work here. We're closing this to keep the review queue manageable: it adds a dependency and desktop UI, which need a separate design and security review before code. You're welcome to reopen this or open a smaller PR against dev.

@lidge-jun lidge-jun closed this Oct 22, 2026
@github-actions
github-actions Bot deleted the codex/desktop-compat-usage-contract branch November 6, 2026 06:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants