Skip to content

fix(launcher): address late review findings#23

Merged
nisavid merged 2 commits intomainfrom
codex/fix-pr-22-late-review
May 7, 2026
Merged

fix(launcher): address late review findings#23
nisavid merged 2 commits intomainfrom
codex/fix-pr-22-late-review

Conversation

@nisavid
Copy link
Copy Markdown
Owner

@nisavid nisavid commented May 7, 2026

Summary

  • Fixes late review findings that landed on merged PR chore(sync): merge upstream through 4468437 #22 after merge.
  • Keeps semantic launch-action fallback code expression-safe by wrapping fallback bindings in an IIFE and preserving a statement terminator.
  • Keeps launcher launch-action fallback sockets under the app state directory without duplicating the app id when XDG_RUNTIME_DIR is unset.
  • Aligns dependency-helper docs with the required Node.js/npm toolchain behavior.

Verification

  • git diff --check passed.
  • env -u 'BASH_FUNC_ml%%' -u 'BASH_FUNC_module%%' bash -n launcher/start.sh.template scripts/install-deps.sh tests/scripts_smoke.sh passed.
  • node --check scripts/patch-linux-window-ui.js passed.
  • node --test scripts/patch-linux-window-ui.test.js passed: 62 tests.
  • env -u 'BASH_FUNC_ml%%' -u 'BASH_FUNC_module%%' bash tests/scripts_smoke.sh passed.
  • stat -c '%n %Y %y' Codex.dmg and date -u '+%s %Y-%m-%dT%H:%M:%SZ' showed Codex.dmg 1778141935 2026-05-07 04:18:55.874873464 -0400 and 1778147882 2026-05-07T09:58:02Z, so the cached DMG was refreshed within 24 hours before the app/package gate.
  • env -u 'BASH_FUNC_ml%%' -u 'BASH_FUNC_module%%' ./install.sh Codex.dmg passed after rerunning outside the sandbox because sandboxed npm cache writes hit EROFS.
  • env -u 'BASH_FUNC_ml%%' -u 'BASH_FUNC_module%%' ./scripts/build-pacman.sh passed and produced dist/codex-app-26.429.61741-1-x86_64.pkg.tar.zst.
  • pacman -Qip dist/codex-app-26.429.61741-1-x86_64.pkg.tar.zst confirmed package codex-app version 26.429.61741-1.
  • bsdtar -tf dist/codex-app-26.429.61741-1-x86_64.pkg.tar.zst | rg 'opt/codex-app/start.sh$|usr/lib/codex-app/update-builder/scripts/patch-linux-window-ui.js$' confirmed the package contains opt/codex-app/start.sh and usr/lib/codex-app/update-builder/scripts/patch-linux-window-ui.js.

Current Status

  • Local readiness gates have passed on pushed head 7b18a20b3e52c14f75385ae27aa240076203c11d.
  • Ready for GitHub checks and reviewer refresh.

Summary by CodeRabbit

  • Documentation

    • Clarified Fedora build/run instructions with explicit details about required dependencies, toolchains, and automatic Rust bootstrap when missing.
  • Bug Fixes

    • Improved runtime directory selection and startup behavior on Linux for more reliable socket and path handling.
    • Centralized feature gating and tightened guards around tray, warm-start, and prompt/popup behaviors.
  • Tests

    • Added a unit test to ensure Linux launch-action patches remain syntactically valid.

Greptile Summary

This PR fixes three late review findings from merged PR #22: a duplicated app-ID path segment in the launcher when XDG_RUNTIME_DIR is unset, a ,let syntax error in the JS patch injector when the injection site is preceded by a comma expression, and a doc wording imprecision in the Fedora build guide.

  • launcher/start.sh.template: Replaces ${XDG_RUNTIME_DIR:-$APP_STATE_DIR}/$CODEX_LINUX_APP_ID (which appended the app ID twice under APP_STATE_DIR) with an explicit if/else that falls back to $APP_STATE_DIR unchanged; fix applied both at the top level and in refresh_runtime_paths.
  • scripts/patch-linux-window-ui.js: Prefixes the injected block with void 0;let so a preceding comma expression (E&&ce(),<injected>) terminates as E&&ce(),void 0; before the let declarations, preventing a parse error; a new regression test verifies idempotency and syntactic validity via new Function.
  • docs/usage/build-and-run.md: Clarifies that the dependency helper verifies or installs the Node.js/npm toolchain rather than just "optionally" touching system tooling.

Confidence Score: 5/5

Safe to merge — all three fixes are narrow, well-tested, and address confirmed bugs without introducing new code paths.

The launcher path fix removes a mechanical duplication (app-ID appended twice) that would have produced a non-existent socket directory on systems without XDG_RUNTIME_DIR. The JS injector fix is verified both by the new regression test and by node --test passing 62 tests per the PR description. The doc change is purely textual.

No files require special attention.

Important Files Changed

Filename Overview
launcher/start.sh.template Bug fix: replaces the single-expression fallback that doubled the app-ID segment when XDG_RUNTIME_DIR was unset with an explicit if/else that maps to $APP_STATE_DIR directly. Applied consistently in both the top-level assignment and refresh_runtime_paths.
scripts/patch-linux-window-ui.js Prefixes the injected fallback block with void 0;let so that a preceding comma expression terminates cleanly before the let declarations begin, preventing a ,let syntax error.
scripts/patch-linux-window-ui.test.js Adds a regression test that injects a comma expression before the setter call, applies both launch-action and prewarm patches twice (idempotency), and asserts syntactic validity via new Function(patched).
docs/usage/build-and-run.md Minor doc update: tightens the Fedora dependency helper description to accurately reflect that Node.js/npm is verified or installed rather than merely listed as optional system tooling.

Reviews (3): Last reviewed commit: "fix(patcher): keep semantic fallback exp..." | Re-trigger Greptile

Declare semantic launch-action fallback bindings, avoid duplicating the app id in launcher runtime fallback paths, and align dependency-helper docs with required Node tooling.

Co-authored-by: Codex <noreply@openai.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 7, 2026

Review Change Stack

📝 Walkthrough

Walkthrough

This PR updates the Linux launcher's runtime path selection logic, clarifies Fedora dependency installation docs, refactors the launch-action code generator to gate tray/warm-start/prompt-window behavior via persisted-setting helpers, and adds a unit test ensuring patcher output remains syntactically valid.

Changes

Linux Launcher Runtime and Launch-Action Configuration

Layer / File(s) Summary
Build and Dependency Documentation
docs/usage/build-and-run.md
Fedora section now explicitly documents that the dependency helper installs/verifies Python, 7z, curl, build tools, Node.js/npm toolchain, and bootstraps Rust via rustup when cargo is absent.
Launcher Runtime Directory Setup
launcher/start.sh.template
Conditional initialization of LAUNCH_ACTION_RUNTIME_DIR uses XDG_RUNTIME_DIR/$CODEX_LINUX_APP_ID when available, otherwise falls back to APP_STATE_DIR. Same logic is applied in both initial setup and in refresh_runtime_paths.
Linux Launch-Action Code Generation
scripts/patch-linux-window-ui.js
Launch-action patcher now generates code that derives feature enablement (tray, warm-start, prompt-window) from persisted settings via codexLinuxGetSetting helpers, adds codexLinuxGetHotkeyWindowController indirection, gates prompt-window through codexLinuxIsPromptWindowEnabled(), and strengthens warm-start socket bootstrap with codexLinuxIsWarmStartEnabled() guard.
Patcher Unit Test
scripts/patch-linux-window-ui.test.js
Adds a test that injects a comma-expression into the fixture, patches it, asserts no comma-prefixed insertion artifact for codexLinuxGetSetting, and verifies the patched output parses via new Function(...).

Possibly Related PRs

  • nisavid/codex-app-linux#18: Both PRs modify the same launcher/start.sh.template and scripts/patch-linux-window-ui.js files—introducing/adjusting Linux launcher/runtime/updater wiring and helper functions—so the changes are directly related at the code level.
  • nisavid/codex-app-linux#8: Both PRs modify the Linux window/UI patching logic in scripts/patch-linux-window-ui.js (including launch-action/hotkey/window guards) and its tests, so the changes are related.
  • nisavid/codex-app-linux#17: Both PRs modify the same files and the Linux launch-action/window UI patching and launcher startup scripts (scripts/patch-linux-window-ui.js and launcher/start.sh.template), altering how launch-action/hotkey/prompt behavior and runtime paths are injected or handled, so they are related at the code level.

Estimated Code Review Effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 Hopping through runtime trees,
XDG whispers on the breeze,
Settings gate the window's light,
Warm sockets wake in quiet night,
Patch tests pass — the rabbit's pleased.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title 'fix(launcher): address late review findings' is vague and overly broad. While it refers to real changes in the PR, it does not clearly convey the main technical issue being addressed (strict-mode ES module validity and socket path deduplication). Consider a more specific title that highlights the primary fix, such as 'fix(launcher): wrap semantic bindings in IIFE for strict-mode compatibility' or 'fix(launcher): deduplicate app ID in socket path and fix strict-mode syntax'.
✅ Passed checks (3 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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

@nisavid nisavid marked this pull request as ready for review May 7, 2026 09:37
Copilot AI review requested due to automatic review settings May 7, 2026 09:37
coderabbitai[bot]
coderabbitai Bot previously approved these changes May 7, 2026
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: 19d271e472

ℹ️ 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 thread scripts/patch-linux-window-ui.js Outdated
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR addresses follow-up review findings from the earlier upstream-sync work by tightening Linux launcher behavior and ensuring the Linux window UI patcher remains valid under strict-mode module execution, while also updating the build/run documentation to match the dependency helper’s actual Node.js/npm requirements.

Changes:

  • Fix scripts/patch-linux-window-ui.js semantic launch-action patch generation to declare fallback bindings with let (strict-mode safe).
  • Adjust launcher/start.sh.template so the launch-action socket path doesn’t redundantly append the app id when XDG_RUNTIME_DIR is unset.
  • Update Fedora dependency-helper documentation to reflect that the helper verifies/installs the required Node.js/npm toolchain.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
scripts/patch-linux-window-ui.js Declares semantic launch-action patch bindings with let to avoid strict-mode failures.
launcher/start.sh.template Refines runtime/socket directory selection to avoid duplicating the app id when falling back from XDG_RUNTIME_DIR.
docs/usage/build-and-run.md Aligns Fedora instructions with the dependency helper’s enforced Node.js/npm toolchain behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@scripts/patch-linux-window-ui.js`:
- Line 1594: The IIFE currently encloses helper functions (notably
codexLinuxIsTrayEnabled and codexLinuxPrewarmHotkeyWindow) so downstream patches
(applyLinuxTrayPatch, applyLinuxHotkeyWindowPrewarmPatch) that reference them
will throw ReferenceError; fix by moving those helpers out of the IIFE or
exposing them on a shared namespace object (e.g., attach codexLinuxIsTrayEnabled
and codexLinuxPrewarmHotkeyWindow to a global/shared object used by other
patches) so they are accessible across patches, and update any internal
references inside the IIFE to use the shared namespace if you choose exposure.

In `@scripts/patch-linux-window-ui.test.js`:
- Around line 422-432: The test currently only runs
applyLinuxLaunchActionArgsPatch in isolation; update it to feed the patched
output through the downstream launch-action-related patch functions used in the
real pipeline (i.e. after applyPatchTwice(applyLinuxLaunchActionArgsPatch,
source) also call the subsequent launch-action patches such as
applyLinuxLaunchActionPatch and applyLinuxLaunchActionHelpersPatch or whatever
downstream functions the repo uses), then assert the final output (after those
passes) does not contain external helper references (e.g., /,let
codexLinuxGetSetting/) and that new Function(finalPatched) does not throw; keep
references to applyLinuxLaunchActionArgsPatch and applyPatchTwice to locate the
change.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: cba02af7-eb3c-4a15-ac63-0345010dfc05

📥 Commits

Reviewing files that changed from the base of the PR and between 19d271e and 747d9e6.

📒 Files selected for processing (2)
  • scripts/patch-linux-window-ui.js
  • scripts/patch-linux-window-ui.test.js

Comment thread scripts/patch-linux-window-ui.js Outdated
Comment thread scripts/patch-linux-window-ui.test.js
Prefix semantic launch-action fallback declarations with a no-op expression so comma-expression insertion points stay parseable while downstream patch passes can still read the shared helpers.

Co-authored-by: Codex <noreply@openai.com>
Copilot AI review requested due to automatic review settings May 7, 2026 10:00
@nisavid nisavid force-pushed the codex/fix-pr-22-late-review branch from 747d9e6 to 7b18a20 Compare May 7, 2026 10:00
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.

@nisavid nisavid merged commit a2ca466 into main May 7, 2026
15 checks passed
@nisavid nisavid deleted the codex/fix-pr-22-late-review branch May 7, 2026 10:06
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.

2 participants