Skip to content

fix(daemon): roll Codex no-daemon shell launch into a fresh v37 daemon - #23907

Merged
Jinwoo-H merged 1 commit into
mainfrom
jinwoo/daemon-v37-codex-no-daemon
Sep 29, 2026
Merged

Jinwoo-H merged 1 commit into
mainfrom
jinwoo/daemon-v37-codex-no-daemon

Conversation

@Jinwoo-H

@Jinwoo-H Jinwoo-H commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

Orca keeps a background terminal service running so your terminals survive an app update. That service also writes the small startup scripts every new terminal runs. #23900 changed those scripts so codex typed in an Orca terminal runs without its shared background server, but it didn't bump the service's version, so after updating, the old service kept writing the old scripts. This PR bumps the version so updated apps start a new service for new tabs.

What Changed

How it works: PROTOCOL_VERSION in src/main/daemon/daemon-protocol-version.ts goes from 36 to 37. It also gets a one-line reason and a named CODEX_NO_DAEMON_SHELL_LAUNCH_DAEMON_PROTOCOL_VERSION marker. 36 is added to PREVIOUS_DAEMON_PROTOCOL_VERSIONS, so createLegacyDaemonAdapters keeps a legacy adapter for a running v36 service. The local-build compatibility contract (JSON + TS) and the two version tests are updated to match. There are no other code changes.

Why

The terminal service survives app updates on purpose. The app decides which service owns new tabs only by protocol version: the socket is daemon-v<N>.sock. An app with the same version keeps using the running service. It won't replace a service that still has live terminals, because replacing it would kill them. So a change to what the service generates only reaches users after they update if the version goes up. The comment at the top of the version file says exactly this.

We follow the precedent of #14326 ("Fix Codex hook trust before manual shell launches"), which bumped v33 to v34 for a similar Codex shell-launch change and touched the same files. We considered two alternatives and rejected both:

  • Forcing the running service to restart would kill users' open terminals.
  • Generating the wrappers in the app instead of the service would be a much larger redesign.

This must be cherry-picked together with #23900. Without #23900, the version bump rolls terminals onto a new service for nothing. Without this PR, #23900 doesn't reach users who update with terminals open.

Linked Issue

Follow-up to #23900 (fixes #22873 for users who update with terminals open).

Visual Proof

N/A. This changes which background service starts new terminals; there is no UI change. The live upgrade evidence is under Testing.

Testing

  • vitest --config config/vitest.config.ts over src/main/daemon, src/main/providers, src/main/pty, src/main/ipc/pty, src/main/orcad, and the local-build contract: 4838 passed. The only 2 failures are in repro-13767-shell-ready-marker-lost-to-exec, which already fails on macOS without this change.
  • The local-build contract and electron-builder config tests: 43 passed.
  • pnpm tc, oxlint, oxfmt, and the changed-code quality gate all pass.

Live upgrade check (macOS, headless dev runtimes, one isolated profile with a sandboxed HOME):

  1. We built the commit just before fix(terminal): run Codex in Orca terminals without the shared background server #23900 (3c1af16e8b9, v36) and ran it on the profile. We opened terminal A. Its shell (pid 98281) is a child of a daemon started with --socket …/daemon-v36.sock. In that shell, functions codex shows the older preflight-only function, with no --no-daemon. We used the pre-fix(terminal): run Codex in Orca terminals without the shared background server #23900 build so the old service is really "old", like the 1.4.213 service on the affected machine.
  2. We quit that app. The v36 service (pid 97917) kept running under launchd, and terminal A stayed alive.
  3. We ran this branch (v37) on the same profile and opened terminal B. The app started a new service, pid 114, with --socket …/daemon-v37.sock and --entry-path …/orca-main/out/main/daemon-entry.js. Its ancestry:
    1088  -/bin/zsh -l
    1085  /usr/bin/login -flpq … /bin/zsh -l
     114  Electron Helper …/daemon-entry.js --socket …/prof/daemon/daemon-v37.sock …
    
    In B, type codex prints codex is a shell function, and the function body carries the fix(terminal): run Codex in Orca terminals without the shared background server #23900 --no-daemon logic (functions codex | grep -c -- --no-daemon → 2).
  4. The v37 app still lists terminal A as connected: true. Text sent to A through the v37 app ran in the same shell (A-ALIVE-UNDER-V37 pid=98281), which is still a child of the v36 service. So old tabs keep working on the old service.

--app-version was 1.4.214 for both services, because both dev trees share one package version. What separates them is the protocol socket and the entry path. On a real update, the app version would also differ.

  • I manually tested these changes locally
  • Automated tests added/updated, or explained why not below

Review

Agent skill upstream boundary

  • Not applicable, or this change follows docs/reference/agent-skill-sharing-upstream-boundary.md and copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

Terminal daemons survive app updates, so new tabs keep spawning from the
old v36 daemon and never get #23900's Codex shell function. Bump to v37
so new tabs move to a fresh daemon; v36 owners stay attachable.
@greptile-apps

greptile-apps Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 5/5

[Critical risk] Bumps daemon protocol version and compatibility contract.

The PR appears safe to merge.

Summary

The PR advances the local terminal daemon to v37 so new terminals use a fresh daemon while existing v36 terminals remain attachable.

  • Updates the daemon version history, local-build compatibility contracts, and version assertions.
Diagram
%%{init: {'theme': 'neutral'}}%%
flowchart LR
  App[Updated app] --> New[v37 daemon]
  New --> NewTabs[New terminal tabs]
  App --> Legacy[v36 legacy adapter]
  Legacy --> Old[v36 daemon]
  Old --> Existing[Existing terminal sessions]
Loading

Reviews (1) · Last reviewed commit: "fix(daemon): roll Codex no-daemon shell ..."

@Jinwoo-H
Jinwoo-H merged commit 8f4a740 into main Sep 29, 2026
38 of 39 checks passed
Jinwoo-H added a commit that referenced this pull request Sep 29, 2026
#23907)

Terminal daemons survive app updates, so new tabs keep spawning from the
old v36 daemon and never get #23900's Codex shell function. Bump to v37
so new tabs move to a fresh daemon; v36 owners stay attachable.

(cherry picked from commit 8f4a740)

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ No new issues found.

Reviewed changes

  • Daemon protocol version bump — PROTOCOL_VERSION goes 36 → 37, adds the CODEX_NO_DAEMON_SHELL_LAUNCH_DAEMON_PROTOCOL_VERSION = 37 marker, appends 36 to PREVIOUS_DAEMON_PROTOCOL_VERSIONS, and updates the file's top comment to describe v37.
  • Compatibility contract — both local-build-compatibility-contract.json and .ts move daemonProtocolVersion to 37 and extend attachableDaemonProtocolVersions through 37.
  • Version tests — daemon-protocol-version.test.ts and daemon-foreground-confirmation-protocol.test.ts assert 37 and the extended previous-version list.

I traced the load-bearing claim end to end and it holds. Because the endpoint is version-namespaced (getDaemonSocketPath → daemon-v37.sock / orca-terminal-host-v37-… on Windows), the v37 app never sees a preserved v36 daemon in prepareDaemonReplacement, so it spawns a fresh v37 daemon; createLegacyDaemonAdapters keeps v36 listable/attachable via the extended PREVIOUS_DAEMON_PROTOCOL_VERSIONS; and DaemonPtyRouter.spawn sends new panes (no sessionId) to this.current, i.e. v37, while legacy adapters serve only known session ids. cleanupDaemonForProtocol is scoped to a single version, so the v36 daemon is left running. This matches the precedent in #14326 (v33→v34), which changed the same five files with the same daemon-protocol-version.ts shape, and #23900 is already merged on main.

Pullfrog  | Fix it ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

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

Labels

None yet

Projects

None yet

1 participant