Skip to content

Namespace agent hook CLI commands - #3298

Merged
lawrencecchen merged 5 commits into
mainfrom
task-document-cli-commands
Apr 30, 2026
Merged

lawrencecchen merged 5 commits into
mainfrom
task-document-cli-commands

Conversation

@lawrencecchen

@lawrencecchen lawrencecchen commented Apr 29, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Moves generated agent hook commands under cmux hooks ...
  • Keeps only the public main compatibility commands: cmux codex install-hooks|uninstall-hooks and cmux claude-hook ...
  • Updates Feed/CLI docs, bundled hook resources, localized settings notes, and hook tests

Testing

  • git diff --check
  • ./scripts/reload.sh --tag hookns2
  • Built CLI spot checks:
    • cmux hooks --help
    • cmux codex --help
    • cmux --help | rg 'codex-hook|feed-hook|hooks install|hooks remove|hooks .*install-hooks|hooks .*uninstall-hooks' (no matches)\n - cmux hooks codex install-hooks (errors, no alias)\n - printf '{}' | cmux hooks codex session-start\n - printf '{}' | cmux hooks feed --source codex\n - CMUX_SOCKET_PATH=/tmp/cmux-hookns2-missing.sock cmux codex-hook session-start (socket error, no pre-socket alias)\n - CMUX_SOCKET_PATH=/tmp/cmux-hookns2-missing.sock cmux feed-hook --source codex (socket error, no pre-socket alias)\n\n## Notes\n- codex-hook and feed-hook are intentionally not preserved as runnable aliases because they are not in the public main help surface.\n- Stale Codex hook config markers are still pruned when reinstalling or uninstalling, because the public cmux codex install-hooks command on main could have generated those config entries.

Summary by CodeRabbit

  • New Features

    • Added browser control commands: disable-browser, enable-browser, browser-status
  • Changes

    • Consolidated agent hook operations under a unified "hooks" namespace (e.g., hooks , hooks feed --source ); per-agent install/uninstall unified
    • Retained select legacy compatibility aliases for older hook invocations
  • Documentation

    • Updated CLI docs, in-app settings, localized strings, and help text to reflect the new hooks forms
  • Tests

    • Updated tests to expect the new hooks command formats

@vercel

vercel Bot commented Apr 29, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
cmux Ready Ready Preview, Comment Apr 30, 2026 1:10am
cmux-staging Building Building Preview, Comment Apr 30, 2026 1:10am

@coderabbitai

coderabbitai Bot commented Apr 29, 2026 •

Copy link
Copy Markdown

Warning

Rate limit exceeded

@lawrencecchen has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 6 minutes and 33 seconds before requesting another review.

To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 843164a8-5510-46fd-9f25-b4bd3721c9d0

📥 Commits

Reviewing files that changed from the base of the PR and between 583bc08 and 84d4251.

📒 Files selected for processing (2)
  • CLI/cmux.swift
  • cmuxTests/WorkspaceRemoteConnectionTests.swift
📝 Walkthrough

Walkthrough

Replaces legacy per-agent top-level hook commands with a unified cmux hooks namespace; consolidates runtime hook entrypoints and dispatch into hooks handlers; updates wrapper invocations, localized strings, docs, tests, and session argument parsing to the new command forms (compat aliases preserved).

Changes

Cohort / File(s) Summary
CLI Command Dispatch
CLI/cmux.swift
Consolidated per-agent hook routing into cmux hooks; moved socket/no-socket gating into runHooksSocketCommand/runHooksNoSocketCommand; added hooksCommandNeedsCmuxSurface gating and compatibility handling for legacy markers.
Localization & UI
Resources/Localizable.xcstrings, Sources/cmuxApp.swift
Updated user-facing instructions and Settings UI strings to reference cmux hooks <agent> install/uninstall.
Wrapper & Plugin Invocations
Resources/bin/claude, Resources/opencode-plugin.js
Replaced injected hook commands to call cmux hooks ... (e.g., hooks claude <event>, hooks feed --source <agent>); adjusted plugin docs/comments.
Session / Argument Parsing
Sources/RestorableAgentSession.swift
isHookSettingsOption now recognizes "hooks claude" (in both --settings=<v> and --settings <v>) so resume/skip logic drops the new settings markers.
Documentation
docs/cli-contract.md, docs/feed.md, docs/notifications.md
Doc contract and guides updated to add top-level hooks namespace and browser-control commands; removed many per-agent top-level installer commands; updated help-probe expectations and Feed wiring text.
Tests
tests/test_claude_wrapper_hooks.py, tests/test_codex_hook_agent_ports.py, tests/test_opencode_plugin_install.py
Test expectations and fake-launcher assertions updated to the cmux hooks <agent> <event> and cmux hooks feed --source <agent> patterns.
Resource: Hook metadata
Resources/...
Hook marker strings and generated shell command invocations updated so installed hooks invoke cmux hooks <agent> ... and Feed bridge hooks use cmux hooks feed --source <agent> ...; legacy markers retained for pruning/uninstall compatibility.

Sequence Diagram(s)

sequenceDiagram
  participant Agent as Agent process
  participant Wrapper as Injected wrapper
  participant CLI as cmux CLI
  participant Dispatcher as Hooks dispatcher
  participant Service as CMUX handler

  Agent->>Wrapper: lifecycle/event trigger
  Wrapper->>CLI: execute "cmux hooks <agent>|feed --source <agent> <event>"
  CLI->>Dispatcher: determine routing (no-socket vs socket)
  alt no-socket
    Dispatcher->>CLI: handle help/no-op locally
  else socket
    Dispatcher->>Service: deliver event to agent bridge/handler
    Service-->>Dispatcher: ack/result
  end
  Dispatcher-->>CLI: return status/output
  CLI-->>Wrapper: propagate exit/output
  Wrapper-->>Agent: return result
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Poem

🐰 I nibbled through code, stitched hooks into one,
Now "cmux hooks" gathers each dusk and each sun.
Wrappers now whisper a tidy new song,
The rabbit hops quick—dispatches belong. 🥕

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 24.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: moving agent hook CLI commands under a new cmux hooks namespace.
Description check ✅ Passed The description covers the core changes, testing approach, and design decisions, but lacks detailed UI/behavior documentation and demo video as specified in the template.
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.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch task-document-cli-commands

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
Review rate limit: 0/8 reviews remaining, refill in 6 minutes and 33 seconds.

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

@greptile-apps

greptile-apps Bot commented Apr 29, 2026 •

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR consolidates all agent hook CLI commands under a single cmux hooks namespace (e.g., cmux hooks codex session-start, cmux hooks feed --source claude), removing the previous per-agent top-level commands. Backward compatibility is preserved for the released main aliases cmux claude-hook and cmux codex install-hooks; old-format hook markers are also retained in uninstall/upgrade detection via hookMarkers(for:).

Confidence Score: 4/5

Safe to merge; logic is sound and backward-compat aliases are correctly wired.

No P0 or P1 findings. All three comments are P2: one style suggestion (static method), one clarification question about intentional --project behaviour in installHooksForAgent, and one defensive-coding note for runHooksSocketCommand. The two-marker backward-compat strategy (hookMarkers + feedHookMarkers) is thoughtfully handled, and the || echo '{}' in generated hook shell commands ensures graceful degradation for any users who haven't yet re-run install.

CLI/cmux.swift — specifically the new installHooksForAgent opencode branch and runHooksSocketCommand.

Important Files Changed

Filename Overview
CLI/cmux.swift Core refactoring: dispersed per-agent hook dispatch blocks replaced by runHooksNoSocketCommand, hooksCommandNeedsCmuxSurface, and runHooksSocketCommand; backward-compat markers added for uninstall detection; isClaudeHookSettingsOption updated for both old and new command formats.
Sources/RestorableAgentSession.swift Matching update to isHookSettingsOption to recognise both "claude-hook" and "hooks claude" substrings; purely additive and correct.
Resources/bin/claude Embedded HOOKS_JSON updated: claude-hook → hooks claude, feed-hook → hooks feed; no logic change.
Resources/opencode-plugin.js Comment and spawnSync args updated from opencode-hook to hooks opencode; straightforward.
tests/test_claude_wrapper_hooks.py Test assertions updated to match new hooks claude and hooks feed command strings; consistent with runtime changes.
tests/test_codex_hook_agent_ports.py E2E test updated to invoke hooks codex session-start instead of codex-hook session-start; correct.
tests/test_opencode_plugin_install.py Install command and arg-log assertions updated to new hooks opencode format; consistent.
docs/cli-contract.md Contract table and no-socket help probes updated; old per-agent commands replaced by hooks entry, compat aliases noted.
docs/feed.md All references to setup-hooks, feed-hook, and per-agent install commands updated to new hooks namespace; troubleshooting section updated too.
Sources/cmuxApp.swift Two SettingsCardNote default-value strings updated to cmux hooks cursor install and cmux hooks gemini install; mirrored correctly in Localizable.xcstrings.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A["cmux hooks &lt;args&gt;"] --> B["runHooksNoSocketCommand(commandArgs)"]

    B -->|"setup / install"| C["runSetupHooks(uninstall: false)"]
    B -->|"uninstall / remove"| D["runSetupHooks(uninstall: true)"]
    B -->|"help / --help"| E["print subcommandUsage('hooks')"]
    B -->|"&lt;agent&gt; install"| F["installHooksForAgent(def, arguments)"]
    B -->|"&lt;agent&gt; uninstall"| G["uninstallHooksForAgent(def, arguments)"]
    B -->|"feed / claude / &lt;agent&gt; &lt;event&gt;"| H{"returns false\n(needs socket)"}

    H --> I["hooksCommandNeedsCmuxSurface?"]
    I -->|"yes & no CMUX_SURFACE_ID"| J["print '{}' — graceful no-op"]
    I -->|"no / has CMUX_SURFACE_ID"| K["runHooksSocketCommand(commandArgs)"]

    K -->|"feed"| L["runFeedHook"]
    K -->|"claude"| M["runClaudeHook"]
    K -->|"&lt;agent&gt;"| N["runGenericAgentHook(def)"]

    F -->|"opencode + --project"| O["installOpenCodePlugin(projectLocal: true)"]
    F -->|"opencode (global)"| P["installAgentHooks + installOpenCodePlugin(global)"]
    F -->|"other agent"| Q["installAgentHooks(def)"]

    subgraph "Compat aliases (always dispatched)"
        R["cmux claude-hook &lt;event&gt;"] --> M
        S["cmux codex install-hooks"] --> Q
        T["cmux codex-hook &lt;event&gt;"] --> N
    end
Loading

Comments Outside Diff (3)

  1. CLI/cmux.swift, line 540-556 (link)

    P2 hooksCommandNeedsCmuxSurface should be static

    hooksCommandNeedsCmuxSurface is declared as an instance method but references no instance state — it only calls Self.agentDef(named:), which is already static. Marking it static (or private static) would make the intent clearer and avoid a misleading self capture in the call site.

  2. CLI/cmux.swift, line 558-579 (link)

    P2 cmux hooks opencode install --project skips session-hook installation

    When --project is passed, installHooksForAgent returns after calling installOpenCodePlugin(projectLocal: true) without first calling installAgentHooks(def). A user who runs cmux hooks opencode install --project will get the project-local JS plugin but will not get the session hooks written into the agent's config directory. If the intent is "project-local plugin only, no session hooks", a clarifying comment would prevent future confusion about whether this is intentional. Is skipping installAgentHooks when --project is passed intentional? Or should the session hooks also be installed in the project-local case?

  3. CLI/cmux.swift, line 581-628 (link)

    P2 runHooksSocketCommand has no "setup" / "install" / "uninstall" guard

    The default: branch in runHooksSocketCommand calls Self.agentDef(named: first) and throws "Unknown hooks target: \(first)" for unknown strings. "setup" and "install" can never reach here in practice because runHooksNoSocketCommand handles and returns true for those cases. However, there's no explicit guard or assertion making this invariant obvious. A defensive preconditionFailure or an early guard against those tokens would make the assumption explicit and would catch future callers that bypass the no-socket path.

Reviews (1): Last reviewed commit: "Namespace agent hook commands" | Re-trigger Greptile

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
tests/test_opencode_plugin_install.py (1)

211-216: Consider explicitly rejecting legacy hook tokens in args log.

Current checks ensure the new token exists once, but won’t fail if a legacy token appears alongside it.

Optional hardening patch
         if "hooks opencode session-start" not in args_log:
             print(f"FAIL: plugin did not invoke hooks opencode session-start, got {args_log!r}")
             return 1
+        if "opencode-hook session-start" in args_log:
+            print(f"FAIL: plugin emitted legacy opencode-hook command, got {args_log!r}")
+            return 1
         if args_log.count("hooks opencode session-start") != 1:
             print(f"FAIL: plugin invoked duplicate session-start hooks, got {args_log!r}")
             return 1
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tests/test_opencode_plugin_install.py` around lines 211 - 216, The test
currently only asserts that the new token "hooks opencode session-start" appears
exactly once in args_log; update the test to also explicitly reject legacy hook
tokens (e.g. "hooks session-start" or any older token form) by asserting those
legacy strings are not present in args_log and failing the test if they are
found; modify the block that inspects args_log (the same section using
args_log.count("hooks opencode session-start")) to add negative checks like `if
"hooks session-start" in args_log: fail` so the test fails when legacy tokens
accompany the new token.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@docs/feed.md`:
- Line 116: Update the sentence about the per-event timeout for Feed bridge
entries to avoid implying a universal 120000 ms value: either make it
agent-specific (mention that Claude’s PermissionRequest bridge is set to 125000
ms in the wrapper) or state a 120–125s range so readers know Claude uses 125s;
refer to the existing phrasing "Per-event timeout inside the agent's hook
config" and the "PermissionRequest bridge" to locate and edit the line
accordingly.

---

Nitpick comments:
In `@tests/test_opencode_plugin_install.py`:
- Around line 211-216: The test currently only asserts that the new token "hooks
opencode session-start" appears exactly once in args_log; update the test to
also explicitly reject legacy hook tokens (e.g. "hooks session-start" or any
older token form) by asserting those legacy strings are not present in args_log
and failing the test if they are found; modify the block that inspects args_log
(the same section using args_log.count("hooks opencode session-start")) to add
negative checks like `if "hooks session-start" in args_log: fail` so the test
fails when legacy tokens accompany the new token.
🪄 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: defaults

Review profile: CHILL

Plan: Pro

Run ID: b2022f8f-019b-4267-b87e-6591ad577513

📥 Commits

Reviewing files that changed from the base of the PR and between 31a27c3 and 8268492.

📒 Files selected for processing (12)
  • CLI/cmux.swift
  • Resources/Localizable.xcstrings
  • Resources/bin/claude
  • Resources/opencode-plugin.js
  • Sources/RestorableAgentSession.swift
  • Sources/cmuxApp.swift
  • docs/cli-contract.md
  • docs/feed.md
  • docs/notifications.md
  • tests/test_claude_wrapper_hooks.py
  • tests/test_codex_hook_agent_ports.py
  • tests/test_opencode_plugin_install.py

Comment thread docs/feed.md Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

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: 8268492e85

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread CLI/cmux.swift Outdated
@lawrencecchen
lawrencecchen force-pushed the task-document-cli-commands branch from 8268492 to 6beb3db Compare April 29, 2026 10:12

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

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: 6beb3dbe1c

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread CLI/cmux.swift

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

♻️ Duplicate comments (1)
docs/feed.md (1)

116-116: ⚠️ Potential issue | 🟡 Minor

Clarify the timeout wording to avoid implying a single universal value.

Line 116 still reads like all agents use 120 000 ms. Please make this agent-specific (or state a ~120–125s range) so Claude’s PermissionRequest timeout behavior is not misread.

Suggested doc tweak
-Per-event timeout inside the agent's hook config is bumped to 120 000 ms specifically for Feed bridge entries, so a user taking 30 seconds to approve something doesn't trip the agent's default 5 000 ms timeout.
+Per-event timeout inside agent hook configs is raised to roughly 120s for Feed bridge entries (Claude uses 125s for PermissionRequest), so a user taking 30 seconds to approve something doesn't trip default 5 000 ms hook timeouts.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/feed.md` at line 116, The sentence currently implies a universal 120000
ms timeout; update the wording in the docs to clarify this is agent-specific by
stating that the per-event timeout in the agent's hook config for Feed bridge
entries is increased to ~120000 ms (or a ~120–125s range) so it only affects
Feed bridge PermissionRequest handling and not all agents; mention "Feed bridge
entries", "agent's hook config", and "PermissionRequest" to make the scope
explicit.
🧹 Nitpick comments (2)
CLI/cmux.swift (1)

8364-8393: Consider generating the agent list in help text from agentDefs.

The hardcoded agent list in usage text can drift from Self.agentDefs. Building this section dynamically would reduce future maintenance misses.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@CLI/cmux.swift` around lines 8364 - 8393, The help text for the "hooks"
command hardcodes the Agents list and can drift from the canonical definitions;
instead, update the "hooks" usage branch (the "case \"hooks\"" return) to
programmatically build the Agents section from Self.agentDefs (or its member
name) when composing the multi-line usage string—generate a comma-separated list
from Self.agentDefs and inject it into the usage/help string so the printed
Agents line always reflects the current definitions.
docs/cli-contract.md (1)

291-292: Consider adding a no-socket probe for cmux hooks feed --help.

You now validate hooks --help and codex --help; adding a hooks feed probe would better lock the replacement path for the removed feed-hook surface.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/cli-contract.md` around lines 291 - 292, Add a no-socket probe entry for
the removed feed-hook surface by documenting the `cmux hooks feed --help` usage
string alongside the existing `cmux hooks --help` and `cmux codex --help` lines;
specifically add a line like ``- `cmux hooks feed --help` -> `Usage: cmux hooks
feed [--agent <name>] [--yes|-y]` `` in the same section so the docs lock the
replacement path for the old `feed-hook` command.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@CLI/cmux.swift`:
- Around line 18588-18593: The uninstall path in uninstallHooksForAgent
currently always calls uninstallAgentHooks(def) for the "opencode" agent,
causing global hooks to be removed even when the user passed "--project"; change
the logic so that uninstallAgentHooks(def) is only called when arguments does
NOT contain "--project", and when "--project" is present only call
uninstallOpenCodePlugin(projectLocal: true) (i.e., mirror the install path
behavior), so update uninstallHooksForAgent to check
arguments.contains("--project") before deciding between uninstallAgentHooks and
uninstallOpenCodePlugin.

---

Duplicate comments:
In `@docs/feed.md`:
- Line 116: The sentence currently implies a universal 120000 ms timeout; update
the wording in the docs to clarify this is agent-specific by stating that the
per-event timeout in the agent's hook config for Feed bridge entries is
increased to ~120000 ms (or a ~120–125s range) so it only affects Feed bridge
PermissionRequest handling and not all agents; mention "Feed bridge entries",
"agent's hook config", and "PermissionRequest" to make the scope explicit.

---

Nitpick comments:
In `@CLI/cmux.swift`:
- Around line 8364-8393: The help text for the "hooks" command hardcodes the
Agents list and can drift from the canonical definitions; instead, update the
"hooks" usage branch (the "case \"hooks\"" return) to programmatically build the
Agents section from Self.agentDefs (or its member name) when composing the
multi-line usage string—generate a comma-separated list from Self.agentDefs and
inject it into the usage/help string so the printed Agents line always reflects
the current definitions.

In `@docs/cli-contract.md`:
- Around line 291-292: Add a no-socket probe entry for the removed feed-hook
surface by documenting the `cmux hooks feed --help` usage string alongside the
existing `cmux hooks --help` and `cmux codex --help` lines; specifically add a
line like ``- `cmux hooks feed --help` -> `Usage: cmux hooks feed [--agent
<name>] [--yes|-y]` `` in the same section so the docs lock the replacement path
for the old `feed-hook` command.
🪄 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: defaults

Review profile: CHILL

Plan: Pro

Run ID: fb64a868-9a24-469b-8820-ca8307308c88

📥 Commits

Reviewing files that changed from the base of the PR and between 8268492 and 6beb3db.

📒 Files selected for processing (12)
  • CLI/cmux.swift
  • Resources/Localizable.xcstrings
  • Resources/bin/claude
  • Resources/opencode-plugin.js
  • Sources/RestorableAgentSession.swift
  • Sources/cmuxApp.swift
  • docs/cli-contract.md
  • docs/feed.md
  • docs/notifications.md
  • tests/test_claude_wrapper_hooks.py
  • tests/test_codex_hook_agent_ports.py
  • tests/test_opencode_plugin_install.py
✅ Files skipped from review due to trivial changes (6)
  • docs/notifications.md
  • Resources/opencode-plugin.js
  • tests/test_codex_hook_agent_ports.py
  • Sources/cmuxApp.swift
  • tests/test_claude_wrapper_hooks.py
  • Resources/Localizable.xcstrings
🚧 Files skipped from review as they are similar to previous changes (3)
  • Sources/RestorableAgentSession.swift
  • tests/test_opencode_plugin_install.py
  • Resources/bin/claude

Comment thread CLI/cmux.swift

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

♻️ Duplicate comments (1)
CLI/cmux.swift (1)

19252-19256: ⚠️ Potential issue | 🟠 Major

Project-local OpenCode uninstall still tears down the global integration.

This is still asymmetric with the install path: cmux hooks opencode uninstall --project removes the global hook config before removing the project-local plugin, so a local cleanup can break the user's global OpenCode setup.

Suggested fix
     private func uninstallHooksForAgent(_ def: AgentHookDef, arguments: [String]) throws {
         if def.name == "opencode" {
-            try uninstallAgentHooks(def)
-            try uninstallOpenCodePlugin(projectLocal: arguments.contains("--project"))
+            let projectLocal = arguments.contains("--project")
+            if projectLocal {
+                try uninstallOpenCodePlugin(projectLocal: true)
+                return
+            }
+            try uninstallAgentHooks(def)
+            try uninstallOpenCodePlugin(projectLocal: false)
             return
         }
         try uninstallAgentHooks(def)
     }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@CLI/cmux.swift` around lines 19252 - 19256, uninstallHooksForAgent currently
calls uninstallAgentHooks before uninstallOpenCodePlugin regardless of
project-local flag, which causes global OpenCode teardown when running "cmux
hooks opencode uninstall --project"; update uninstallHooksForAgent so that when
arguments.contains("--project") is true it skips calling uninstallAgentHooks and
only calls uninstallOpenCodePlugin(projectLocal: true), otherwise it should
perform the global uninstall by calling uninstallAgentHooks and
uninstallOpenCodePlugin(projectLocal: false) (or the existing call pattern).
Reference the functions uninstallHooksForAgent, uninstallAgentHooks, and
uninstallOpenCodePlugin to implement the conditional branching and preserve the
early return behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@CLI/cmux.swift`:
- Around line 8367-8370: The help text advertises the --project flag for all
"cmux hooks <agent> install|uninstall" commands even though the flag is only
honored for the opencode agent; update the usage/help strings in CLI/cmux.swift
so that the --project flag is scoped to OpenCode only (e.g., change "cmux hooks
<agent> install [--project]" and "cmux hooks <agent> uninstall [--project]" to
indicate the flag is for opencode only or only present for the opencode
subcommand). Locate the usage lines containing the exact strings "Usage: cmux
hooks <agent> install [--project]" and "Usage: cmux hooks <agent> uninstall
[--project]" and either remove the [--project] option there or replace it with a
parenthetical like "[--project (opencode only)]" so the help matches actual
behavior.

---

Duplicate comments:
In `@CLI/cmux.swift`:
- Around line 19252-19256: uninstallHooksForAgent currently calls
uninstallAgentHooks before uninstallOpenCodePlugin regardless of project-local
flag, which causes global OpenCode teardown when running "cmux hooks opencode
uninstall --project"; update uninstallHooksForAgent so that when
arguments.contains("--project") is true it skips calling uninstallAgentHooks and
only calls uninstallOpenCodePlugin(projectLocal: true), otherwise it should
perform the global uninstall by calling uninstallAgentHooks and
uninstallOpenCodePlugin(projectLocal: false) (or the existing call pattern).
Reference the functions uninstallHooksForAgent, uninstallAgentHooks, and
uninstallOpenCodePlugin to implement the conditional branching and preserve the
early return behavior.
🪄 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: defaults

Review profile: CHILL

Plan: Pro

Run ID: b0d954a3-25da-487c-955d-8126ecc93e71

📥 Commits

Reviewing files that changed from the base of the PR and between 6beb3db and f3a0ef4.

📒 Files selected for processing (3)
  • CLI/cmux.swift
  • Resources/Localizable.xcstrings
  • Sources/cmuxApp.swift
✅ Files skipped from review due to trivial changes (2)
  • Sources/cmuxApp.swift
  • Resources/Localizable.xcstrings

Comment thread CLI/cmux.swift Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

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: 583bc081da

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread CLI/cmux.swift
Comment thread CLI/cmux.swift Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

♻️ Duplicate comments (1)
CLI/cmux.swift (1)

8367-8370: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Scope --project to OpenCode in the hooks help.

These usage lines still imply every agent accepts --project, but the new installers only honor that flag for opencode. That makes commands like cmux hooks codex install --project look supported even though the flag is ignored.

Suggested wording
-            Usage: cmux hooks setup [--agent <name>] [--yes|-y]
-                   cmux hooks uninstall [--agent <name>] [--yes|-y]
-                   cmux hooks <agent> install [--project] [--yes|-y]
-                   cmux hooks <agent> uninstall [--project] [--yes|-y]
+            Usage: cmux hooks setup [--agent <name>] [--yes|-y]
+                   cmux hooks uninstall [--agent <name>] [--yes|-y]
+                   cmux hooks <agent> install [--yes|-y]
+                   cmux hooks <agent> uninstall [--yes|-y]
+                   cmux hooks opencode install [--project] [--yes|-y]
+                   cmux hooks opencode uninstall [--project] [--yes|-y]
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@CLI/cmux.swift` around lines 8367 - 8370, The help usage currently shows
"[--project]" for generic agent install/uninstall which wrongly suggests all
agents accept that flag; update the usage text in the CLI/cmux.swift help block
so that the --project option is only shown for the opencode agent (e.g. change
"cmux hooks <agent> install [--project]" and "cmux hooks <agent> uninstall
[--project]" to "cmux hooks opencode install [--project]" and "cmux hooks
opencode uninstall [--project]") so help output accurately reflects that only
the opencode installer honors --project.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In `@CLI/cmux.swift`:
- Around line 8367-8370: The help usage currently shows "[--project]" for
generic agent install/uninstall which wrongly suggests all agents accept that
flag; update the usage text in the CLI/cmux.swift help block so that the
--project option is only shown for the opencode agent (e.g. change "cmux hooks
<agent> install [--project]" and "cmux hooks <agent> uninstall [--project]" to
"cmux hooks opencode install [--project]" and "cmux hooks opencode uninstall
[--project]") so help output accurately reflects that only the opencode
installer honors --project.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 48ed5a29-3054-4666-9e4e-883c3aca4681

📥 Commits

Reviewing files that changed from the base of the PR and between f3a0ef4 and 583bc08.

⛔ Files ignored due to path filters (1)
  • .github/swift-file-length-budget.tsv is excluded by !**/*.tsv
📒 Files selected for processing (2)
  • CLI/cmux.swift
  • docs/feed.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • docs/feed.md

This branch was successfully deployed

1 active deployment
Preview – cmux — 84d42517 Deployed Apr 30, 2026 by vercel[bot]
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