Skip to content

Split Codex hook service responsibilities - #17260

Merged
nwparker merged 62 commits into
mainfrom
ra/max-lines-bottom-27-codex-hook-service
Aug 30, 2026
Merged

nwparker merged 62 commits into
mainfrom
ra/max-lines-bottom-27-codex-hook-service

Conversation

@nwparker

@nwparker nwparker commented Aug 29, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 0 0 0 0
Prod 16 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​2024 $\color{#cf222e}{\Huge{\mathbf{−}}}$​1742 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​282

Summary

  • split the 1,755-line Codex hook service into a 29-line public facade plus 13 focused definition, script, trust, mirroring, cleanup, WSL, status, install, maintenance, and implementation modules
  • preserve local, per-account, WSL, and SSH install behavior; trust ownership and queue order; WSL reconciliation generations and in-flight serialization; remote POSIX path handling; and the exact public facade and _internals contract
  • reduce the max-lines baseline from 60 entries to 59; every new TypeScript module is at most 228 lines

Stacked on #17253.

Validation

  • pnpm tc
  • focused Codex hook/trust suite: 14 files, 161 tests passed, 5 skipped
  • broader account-migration, remote/lifecycle/timeout/interpreter, IPC, and runtime-RPC consumer suite: 11 files, 84 tests passed, 3 skipped
  • direct Oxlint across all 14 split/facade modules
  • pnpm run check:code-quality:changed
  • pnpm run check:max-lines-ratchet — 59 grandfathered suppressions
  • pnpm run check:runtime-electron-ratchet
  • pnpm run check:reliability-gates
  • max-lines ratchet characterization: 15 tests
  • changed-file formatting and git diff --check
  • exact 8-symbol facade, _internals property identity/order, 53 moved top-level declarations, 16 class members, 5 delegated method bodies, runtime literals, 138 comments, singleton sweep state, per-instance WSL maps, and 14-node/38-edge acyclic graph reconciliation
  • two independent final refactor audits: clean

Visual proof is N/A because this is an internal Codex hook-service decomposition with no intended rendered UI change.

…lines-bottom-20-cdp-bridge

# Conflicts:
#	src/main/browser/cdp-bridge.ts
…ax-lines-bottom-25-remote-terminal-multiplexer
…7-codex-hook-service

# Conflicts:
#	config/max-lines-baseline.txt
#	src/renderer/src/hooks/automation-dispatch-completion.ts
@nwparker
nwparker changed the base branch from ra/max-lines-bottom-26-git-worktree to main August 30, 2026 03:21
@nwparker
nwparker merged commit 1369821 into main Aug 30, 2026
4 of 20 checks passed
@coderabbitai

coderabbitai Bot commented Aug 30, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

Next included review available in 10 minutes.

View limit details

Limit details: You’ve used all 10 included reviews currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 769166c0-0a52-4809-895d-58e391281c5b

📥 Commits

Reviewing files that changed from the base of the PR and between 037cc2e and f2710cb.

📒 Files selected for processing (16)
  • config/max-lines-baseline.txt
  • config/tsconfig.cli.json
  • src/main/codex/codex-hook-definition.ts
  • src/main/codex/codex-hook-legacy-cleanup.ts
  • src/main/codex/codex-hook-local-install.ts
  • src/main/codex/codex-hook-local-maintenance.ts
  • src/main/codex/codex-hook-remote-install.ts
  • src/main/codex/codex-hook-script.ts
  • src/main/codex/codex-hook-service-implementation.ts
  • src/main/codex/codex-hook-status.ts
  • src/main/codex/codex-hook-system-trust.ts
  • src/main/codex/codex-hook-trust-cleanup.ts
  • src/main/codex/codex-hook-trust-queue.ts
  • src/main/codex/codex-hook-user-mirroring.ts
  • src/main/codex/codex-hook-wsl-runtime.ts
  • src/main/codex/hook-service.ts
ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 48fe35d0-80e8-44a4-907d-9272a2c82bab

📥 Commits

Reviewing files that changed from the base of the PR and between 037cc2e and f2710cb.

📒 Files selected for processing (16)
  • config/max-lines-baseline.txt
  • config/tsconfig.cli.json
  • src/main/codex/codex-hook-definition.ts
  • src/main/codex/codex-hook-legacy-cleanup.ts
  • src/main/codex/codex-hook-local-install.ts
  • src/main/codex/codex-hook-local-maintenance.ts
  • src/main/codex/codex-hook-remote-install.ts
  • src/main/codex/codex-hook-script.ts
  • src/main/codex/codex-hook-service-implementation.ts
  • src/main/codex/codex-hook-status.ts
  • src/main/codex/codex-hook-system-trust.ts
  • src/main/codex/codex-hook-trust-cleanup.ts
  • src/main/codex/codex-hook-trust-queue.ts
  • src/main/codex/codex-hook-user-mirroring.ts
  • src/main/codex/codex-hook-wsl-runtime.ts
  • src/main/codex/hook-service.ts

📝 Walkthrough

Walkthrough

The Codex hook service was split into focused modules for hook definitions, scripts, trust management, local and remote installation, WSL reconciliation, status reporting, and legacy cleanup. CodexHookService now orchestrates these modules through the existing facade. The CLI TypeScript configuration includes the new source files. The existing public exports remain available.

✨ Finishing Touches 💡 1
⚔️ Resolve merge conflicts 💡
  • Resolve merge conflict in branch ra/max-lines-bottom-27-codex-hook-service
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

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.

maxmilian added a commit to maxmilian/orca that referenced this pull request Oct 1, 2026
Codex fails closed on a hook whose stdout is not valid JSON, so every session
started from an Orca terminal reported "invalid session start/stop hook JSON
output" even though the POST to Orca's listener succeeded (stablyai#16356).

The managed Codex script never wrote anything to stdout. Its siblings all do:
claude (stablyai#14818), gemini, copilot and antigravity each emit neutral JSON as the
first line, before any early-exit guard. Codex was the only one without it.

Rebased onto the module split from stablyai#17260: the builder moved from
hook-service.ts to codex-hook-script.ts, so the two lines land there instead.

hook-script-outside-orca.test.ts (added in stablyai#16685, after this PR was opened)
asserted the managed Codex hook stays silent outside an Orca terminal. Silence
is exactly the failure stablyai#16356 reports, and every sibling hook already prints
"{}" unconditionally, so the stdout assertions now expect the neutral JSON.
The inertness those tests really guard - exit 0, empty stderr, no spool tree
written - is unchanged and still asserted.
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
* Split speech session lifecycle

* Split terminal output scheduler pipeline

* Split mobile browser pane modules

* Prune resolved max-lines suppressions

* Split pane tree equalization logic

* Extract mobile troubleshoot screen styles

* Split external automation manager

* Split main window service attachments

* Split hosted review creation checks

* Split automation dispatch event handling

* Split settings navigation metadata

* Split daemon initialization lifecycle

* Split GitLab item dialog

* Split relay dispatcher layers

* Split mobile host screen

* Retarget mobile view settings source test

* Split runtime file client layers

* Split ports panel layers

* Split runtime environments pane layers

* Split local PTY provider responsibilities

* Split CDP bridge responsibilities

* Split relay Git handler responsibilities

* Track moved relay Git fetch audit

* Split Linear item drawer responsibilities

* Split telemetry event schema responsibilities

* Split resource usage status responsibilities

* Split remote terminal multiplexer responsibilities

* Split Git worktree responsibilities

* Split Codex hook service responsibilities

* Keep mirrored hook trust type private

* Fix F3-speech for stablyai#17123

* Fix F1-cycle for stablyai#17131

* Fix F4-navtest for stablyai#17157

* Fix F2-allowlist for stablyai#17161
maxmilian added a commit to maxmilian/orca that referenced this pull request Oct 26, 2026
Codex fails closed on a hook whose stdout is not valid JSON, so every session
started from an Orca terminal reported "invalid session start/stop hook JSON
output" even though the POST to Orca's listener succeeded (stablyai#16356).

The managed Codex script never wrote anything to stdout. Its siblings all do:
claude (stablyai#14818), gemini, copilot and antigravity each emit neutral JSON as the
first line, before any early-exit guard. Codex was the only one without it.

Rebased onto the module split from stablyai#17260: the builder moved from
hook-service.ts to codex-hook-script.ts, so the two lines land there instead.

hook-script-outside-orca.test.ts (added in stablyai#16685, after this PR was opened)
asserted the managed Codex hook stays silent outside an Orca terminal. Silence
is exactly the failure stablyai#16356 reports, and every sibling hook already prints
"{}" unconditionally, so the stdout assertions now expect the neutral JSON.
The inertness those tests really guard - exit 0, empty stderr, no spool tree
written - is unchanged and still asserted.
maxmilian added a commit to maxmilian/orca that referenced this pull request Nov 8, 2026
Codex fails closed on a hook whose stdout is not valid JSON, so every session
started from an Orca terminal reported "invalid session start/stop hook JSON
output" even though the POST to Orca's listener succeeded (stablyai#16356).

The managed Codex script never wrote anything to stdout. Its siblings all do:
claude (stablyai#14818), gemini, copilot and antigravity each emit neutral JSON as the
first line, before any early-exit guard. Codex was the only one without it.

Rebased onto the module split from stablyai#17260: the builder moved from
hook-service.ts to codex-hook-script.ts, so the two lines land there instead.

hook-script-outside-orca.test.ts (added in stablyai#16685, after this PR was opened)
asserted the managed Codex hook stays silent outside an Orca terminal. Silence
is exactly the failure stablyai#16356 reports, and every sibling hook already prints
"{}" unconditionally, so the stdout assertions now expect the neutral JSON.
The inertness those tests really guard - exit 0, empty stderr, no spool tree
written - is unchanged and still asserted.
maxmilian added a commit to maxmilian/orca that referenced this pull request Nov 18, 2026
Codex fails closed on a hook whose stdout is not valid JSON, so every session
started from an Orca terminal reported "invalid session start/stop hook JSON
output" even though the POST to Orca's listener succeeded (stablyai#16356).

The managed Codex script never wrote anything to stdout. Its siblings all do:
claude (stablyai#14818), gemini, copilot and antigravity each emit neutral JSON as the
first line, before any early-exit guard. Codex was the only one without it.

Rebased onto the module split from stablyai#17260: the builder moved from
hook-service.ts to codex-hook-script.ts, so the two lines land there instead.

hook-script-outside-orca.test.ts (added in stablyai#16685, after this PR was opened)
asserted the managed Codex hook stays silent outside an Orca terminal. Silence
is exactly the failure stablyai#16356 reports, and every sibling hook already prints
"{}" unconditionally, so the stdout assertions now expect the neutral JSON.
The inertness those tests really guard - exit 0, empty stderr, no spool tree
written - is unchanged and still asserted.
maxmilian added a commit to maxmilian/orca that referenced this pull request Nov 22, 2026
Codex fails closed on a hook whose stdout is not valid JSON, so every session
started from an Orca terminal reported "invalid session start/stop hook JSON
output" even though the POST to Orca's listener succeeded (stablyai#16356).

The managed Codex script never wrote anything to stdout. Its siblings all do:
claude (stablyai#14818), gemini, copilot and antigravity each emit neutral JSON as the
first line, before any early-exit guard. Codex was the only one without it.

Rebased onto the module split from stablyai#17260: the builder moved from
hook-service.ts to codex-hook-script.ts, so the two lines land there instead.
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.

1 participant