Skip to content

Fix Kimi hook config path and migrate legacy block - #8278

Merged
austinywang merged 14 commits into
mainfrom
issue-8273-kimi-hooks-config-dir
Jul 16, 2026
Merged

austinywang merged 14 commits into
mainfrom
issue-8273-kimi-hooks-config-dir

Conversation

@austinywang

@austinywang austinywang commented Jul 16, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • install cmux hooks in the active Kimi CLI config at ~/.kimi/config.toml
  • honor the current KIMI_SHARE_DIR override and retire the unsupported KIMI_CODE_HOME override
  • remove only the cmux marker block from legacy KIMI_CODE_HOME / ~/.kimi-code configs during setup and uninstall
  • align generated hooks with the Kimi 1.49 event schema (Notification replaces unsupported PermissionRequest; unsupported Interrupt is removed)
  • preserve unrelated user and third-party [[hooks]] entries in both files
  • update the agent-hook, CLI-contract, and Feed documentation

Architecture

AgentHookDef remains the single source of truth for the active vendor config contract. Kimi-specific legacy cleanup stays in the existing TOML-format installer/uninstaller, so the migration does not add generic catalog fields that no other agent needs. The marker-block transformer remains the only content mutation path.

Regression coverage

The first commit contains executable bundled-CLI regression tests only and is intentionally red against the old destination. The second commit fixes setup, KIMI_SHARE_DIR, legacy cleanup, uninstall cleanup, and the Kimi 1.49 event set, preserving the red-to-green history.

Verification

  • swift test in Packages/macOS/CMUXAgentLaunch: 235 tests passed
  • ./scripts/lint-pbxproj-test-wiring.sh: 517 test files checked
  • ./scripts/reload.sh --tag issue-8273-kimi: succeeded without launch
  • Swift warning check against the tagged build log: 0 cmux-owned warnings
  • Kimi 1.49 config validation through kimi_cli.config.load_config: passed
  • real kimi --quiet --prompt "Say hi in exactly two words.": returned Hello there!
  • capture stub inherited through CMUX_BUNDLED_CLI_PATH: exactly one hooks kimi stop invocation, plus one session-start, prompt-submit, and session-end invocation
  • real ~/.kimi/config.toml: seven vibe-island references retained and one cmux marker block installed
  • real legacy config: nine Orca references retained and byte-for-byte unchanged

The repository revision does not contain scripts/swift_file_length_budget.py or .github/swift-file-length-budget.tsv, so the requested checker could not run. Manual counts are 174 lines for CMUXCLI+KimiHooks.swift and 193 for the new test file; neither budget TSV was changed. The localization audit found no new runtime string keys, parsed Localizable.xcstrings, and updated all English Markdown surfaces that named the old path; these docs have no parallel localized Markdown catalogs.

Fixes #8273

Summary by CodeRabbit

  • New Features
    • Updated kimi agent hook event mapping and feed events, shifting away from PermissionRequest/Interrupt toward Notification.
    • Updated Kimi Code setup to use ~/.kimi/config.toml, with legacy marker-block cleanup supported during setup/uninstall.
  • Bug Fixes
    • Improved uninstall to remove cmux blocks from both current and legacy locations without modifying unrelated TOML content.
  • Tests
    • Added integration tests covering setup, migration, symlink/legacy edge cases, and uninstall across both locations.
  • Documentation
    • Updated docs and CLI contract to reflect the new config paths and legacy cleanup behavior.
  • Chores
    • Added a localized warning message when legacy cleanup needs follow-up setup.

@cursor

cursor Bot commented Jul 16, 2026

Copy link
Copy Markdown

Bugbot is paused — on-demand spend limit reached

Bugbot uses usage-based billing for this team and has hit its on-demand spend limit.

A team admin can raise the spend limit in the Cursor dashboard, or wait for the next billing cycle to continue.

@coderabbitai

coderabbitai Bot commented Jul 16, 2026 •

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Updates Kimi hook installation to use ~/.kimi/config.toml, removes cmux blocks from the legacy location, adjusts supported events and overrides, and adds integration tests plus documentation for current and legacy configuration behavior.

Changes

Kimi hook configuration support

Layer / File(s) Summary
Current Kimi hook definition
CLI/CMUXCLI+AgentHookCatalog.swift, CLI/CMUXCLI+AgentHookDefinitions.swift, docs/agent-hooks.md, docs/feed.md
Points Kimi to ~/.kimi/config.toml, changes its override and event mapping, and updates integration documentation.
Current and legacy config handling
CLI/CMUXCLI+KimiHooks.swift, docs/cli-contract.md, docs/agent-hooks.md, Resources/Localizable.xcstrings
Installs into the current config and removes cmux marker blocks from current and legacy configs with environment override, deduplication, warning, and localization support.
Location behavior test coverage
cmuxTests/KimiHookConfigLocationTests.swift, cmux.xcodeproj/project.pbxproj
Tests setup, preservation, migration, unreadable and symlinked locations, interactive declines, uninstall behavior, and registers the suite in the test target.

Estimated code review effort: 3 (Moderate) | ~30 minutes

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant HooksCLI
  participant CurrentConfig
  participant LegacyConfig
  User->>HooksCLI: setup or uninstall kimi
  HooksCLI->>CurrentConfig: install or remove cmux block
  HooksCLI->>LegacyConfig: remove legacy cmux block
  CurrentConfig-->>HooksCLI: updated configuration result
  LegacyConfig-->>HooksCLI: updated configuration result
  HooksCLI-->>User: report operation result
Loading

Possibly related PRs


Important

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

❌ Failed checks (1 error)

Check name Status Explanation Resolution
Cmux Full Internationalization ❌ Error cli.hooks.kimi.legacyCleanupWarning was added with only en/ja, but the catalog supports 20 locales, leaving 18 locales untranslated. Add translations for the 18 missing locales in Resources/Localizable.xcstrings (or remove the new user-facing warning key) so the catalog is complete.
✅ Passed checks (24 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: fixing Kimi hook config placement and legacy migration.
Description check ✅ Passed The description is detailed and covers summary, verification, and testing intent, with only some template sections omitted.
Linked Issues check ✅ Passed The changes satisfy #8273 by installing to the active Kimi config, preserving hooks, handling legacy cleanup, and adding regression tests.
Out of Scope Changes check ✅ Passed The extra tests, docs, localization, and project wiring all support the Kimi hook migration and are in scope.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Cmux Swift Actor Isolation ✅ Passed Touched production CLI types are not @MainActor; no new Sendable shared state or UI-store access was introduced, and the Kimi helpers remain plain synchronous CLI code.
Cmux Swift Blocking Runtime ✅ Passed PASS: no new semaphores/sleeps/sync/locks/polling in production Swift; the only blocking call is the existing interactive readLine() prompt.
Cmux Browser Automation Off-Main ✅ Passed The only changed file is CLI/CMUXCLI+KimiHooks.swift; no browser.* routing or policy-test code was modified, so the off-main browser automation rule isn’t implicated.
Cmux Expensive Synchronous Load ✅ Passed Diff only edits Kimi config TOML install/uninstall logic and event mappings; no agent-history/transcript/JSONL load or MainActor path was added.
Cmux Cache Substitution Correctness ✅ Passed PASS: The Kimi changes read configs directly from disk via readAgentHookConfig and KimiCodeHookConfig; no cached/opportunistic value is substituted in a persistence path.
Cmux No Hacky Sleeps ✅ Passed The PR only changes Swift, docs, pbxproj, and localization; no non-Swift runtime/script sleep or polling code was introduced.
Cmux Algorithmic Complexity ✅ Passed Only fixed-size Kimi arrays/2-path dedupe were added; no new scalable nested scans or hot-path rescans, and the TOML transformer’s existing behavior was unchanged.
Cmux Swift Concurrency ✅ Passed No new production DispatchQueue/Task/Combine patterns appear; the only legacy sync primitive is DispatchSemaphore in a test-only Process helper, which the rule allows.
Cmux Swift @Concurrent ✅ Passed No changed Swift function is async or actor-isolated, and no @concurrent annotations were added or misused; the new test helper is synchronous file/process I/O.
Cmux Swift Package Boundaries ✅ Passed PASS — the reusable TOML transform lives in CMUXAgentLaunch; this PR’s CLI changes are app-specific install/uninstall glue, consistent with other hook handlers.
Cmux Swiftpm Lockfiles ✅ Passed PR only adds a test file to cmux.xcodeproj; no SwiftPM package-reference edits, Package.resolved diffs, or .gitignore changes appear.
Cmux Swift Logging ✅ Passed PASS: The added print/stderr messages are user-facing CLI setup/uninstall output (allowed by the rule), with no NSLog, debug logging, or sensitive-data exposure.
Cmux User-Facing Error Privacy ✅ Passed New output only mentions Kimi-selected config paths and a generic cleanup warning; no secrets, env vars, raw errors, or hidden internals leak.
Cmux Swiftui State Layout ✅ Passed The PR only changes a CLI helper file; no SwiftUI views or state/layout patterns were introduced or expanded.
Cmux Architecture Rethink ✅ Passed Small local Kimi config-path fix with clear active/legacy URL ownership; no new timing, observer, cache, or duplicate-wiring patterns, and semaphores are test-only.
Cmux Swift Auxiliary Window Close Shortcuts ✅ Passed Diff only changes CLI hooks, tests, docs, and strings; no NSWindow/NSPanel/WindowGroup/WindowController code or cmuxAuxiliaryWindowIdentifiers changes.
Cmux Source Artifacts ✅ Passed The only changed path is a Swift source file; no logs, temp dirs, build output, caches, or other artifact-like files were added.
Cmux No Test Or Debug Seam In Production Source ✅ Passed Changed production Swift files add Kimi hook logic only; no #if DEBUG or test-only/debug seam members were introduced.
Cmux No Ambient Global State ✅ Passed The new Kimi logic stays inside CMUXCLI extension methods and private nested helpers; no new file-scope API, mutable globals, or singleton state was added.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch issue-8273-kimi-hooks-config-dir

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.

@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

🤖 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 `@cmuxTests/KimiHookConfigLocationTests.swift`:
- Line 159: Replace the deprecated readDataToEndOfFile() call in
KimiHookConfigLocationTests with the throwing FileHandle.readToEnd() API,
updating the surrounding test flow to handle its optional result and propagate
or handle read errors appropriately while preserving the existing
output-processing 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: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 101e9677-496b-440e-97dd-22765ce2e407

📥 Commits

Reviewing files that changed from the base of the PR and between 25dc913 and 54fad68.

📒 Files selected for processing (2)
  • cmux.xcodeproj/project.pbxproj
  • cmuxTests/KimiHookConfigLocationTests.swift

Comment thread cmuxTests/KimiHookConfigLocationTests.swift Outdated
@greptile-apps

greptile-apps Bot commented Jul 16, 2026 •

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes the Kimi hook integration by pointing cmux at the actual live config (~/.kimi/config.toml / KIMI_SHARE_DIR) and retiring the incorrect KIMI_CODE_HOME override, while adding best-effort legacy cleanup that removes only the cmux marker block from the old location without touching unrelated user hooks.

  • Active config path and event schema: The catalog entry is updated to use configDir: ".kimi" + configDirEnvOverride: "KIMI_SHARE_DIR", PermissionRequest is replaced with Notification and Interrupt is dropped to match Kimi 1.49's hook event set, and feedHookEvents is trimmed to ["PreToolUse", "PostToolUse"].
  • Legacy migration: installKimiHooks and uninstallKimiHooks gain best-effort legacy cleanup — symlink-aware deduplication via canonicalKimiConfigURL prevents double-processing when the two paths resolve to the same file, and failures in the legacy path are downgraded to localized stderr warnings (EN + JA) instead of fatal exits.
  • Regression tests: New KimiHookConfigLocationTests cover fresh setup, KIMI_SHARE_DIR override, legacy cleanup, symlink deduplication, declined-confirm preservation, and uninstall across both locations, all using a 10-second timeout to guard against CI hangs.

Confidence Score: 5/5

Safe to merge — install and uninstall paths are well-isolated, legacy cleanup is best-effort, and all previously identified issues have been addressed.

The refactor is mechanically straightforward: a catalog entry change, a two-location file rewrite with symlink-aware deduplication, and downgraded error handling for the legacy path. The new test suite covers fresh setup, env-var overrides, symlinked directories, user-declined confirmations, and unreadable legacy configs — matching every non-trivial branch in production. Localization has EN and JA entries consistent with the existing catalog. No correctness issues or rule violations were found in the changed files.

No files require special attention.

Important Files Changed

Filename Overview
CLI/CMUXCLI+KimiHooks.swift Core migration: installKimiHooks and uninstallKimiHooks refactored to handle active + legacy configs with best-effort legacy cleanup, symlink-aware deduplication, and new localized warning helpers. No correctness issues found.
CLI/CMUXCLI+AgentHookCatalog.swift Updates the kimi AgentHookDef: path to .kimi/configDir, env override to KIMI_SHARE_DIR, Notification replaces PermissionRequest, Interrupt removed, feedHookEvents trimmed. Straightforward catalog change.
cmuxTests/KimiHookConfigLocationTests.swift New integration test suite: covers 8 scenarios via subprocess invocation with isolated home/bin fixtures, 10-second timeout guard with SIGKILL escalation, and deterministic symlink/directory-as-file edge cases.
Resources/Localizable.xcstrings Adds two new localization keys (legacyCleanupWarning, legacyUninstallWarning) with English and Japanese translations, consistent with the existing catalog's locale coverage.
cmux.xcodeproj/project.pbxproj Wires KimiHookConfigLocationTests.swift into the PBXBuildFile, PBXFileReference, PBXGroup, and Sources build phase entries with consistent indentation.
CLI/CMUXCLI+AgentHookDefinitions.swift Single-line comment update in the tomlArrayTable case to reflect the new config path. No logic changes.
docs/agent-hooks.md Table updated to new path and reduced feed events; env override row updated; new migration paragraph added explaining legacy cleanup behavior.
docs/cli-contract.md Adds a prose note documenting the new active config target and legacy marker-block cleanup behavior. Consistent with the implementation.
docs/feed.md Table row for Kimi Code updated to new config path and trimmed feed events (PermissionRequest removed).

Sequence Diagram

%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
    participant User
    participant CLI as cmux CLI
    participant Active as Active config
    participant Legacy as Legacy config

    User->>CLI: cmux hooks setup kimi

    CLI->>Active: readAgentHookConfig
    Active-->>CLI: current content or empty string

    CLI->>CLI: compute activeEdit

    alt paths are distinct after symlink resolution
        CLI->>Legacy: readAgentHookConfig
        alt read succeeds
            Legacy-->>CLI: legacy content
            CLI->>CLI: compute legacyEdit
        else read fails
            CLI->>CLI: "legacyCleanupFailed = true"
        end
    end

    alt edits pending and no --yes flag
        CLI->>User: show diff previews and Proceed prompt
        alt user declines
            CLI->>User: Aborted
        end
    end

    alt activeEdit is set
        CLI->>CLI: createDirectory if missing
        CLI->>Active: write new content atomically
        CLI->>User: hooks installed message
    else
        CLI->>User: already up to date message
    end

    alt legacyEdit is set
        CLI->>Legacy: write stripped content atomically
        CLI->>User: legacy removal message
    end

    alt legacyCleanupFailed
        CLI->>User: stderr warning with re-run instructions
    end
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
    participant User
    participant CLI as cmux CLI
    participant Active as Active config
    participant Legacy as Legacy config

    User->>CLI: cmux hooks setup kimi

    CLI->>Active: readAgentHookConfig
    Active-->>CLI: current content or empty string

    CLI->>CLI: compute activeEdit

    alt paths are distinct after symlink resolution
        CLI->>Legacy: readAgentHookConfig
        alt read succeeds
            Legacy-->>CLI: legacy content
            CLI->>CLI: compute legacyEdit
        else read fails
            CLI->>CLI: "legacyCleanupFailed = true"
        end
    end

    alt edits pending and no --yes flag
        CLI->>User: show diff previews and Proceed prompt
        alt user declines
            CLI->>User: Aborted
        end
    end

    alt activeEdit is set
        CLI->>CLI: createDirectory if missing
        CLI->>Active: write new content atomically
        CLI->>User: hooks installed message
    else
        CLI->>User: already up to date message
    end

    alt legacyEdit is set
        CLI->>Legacy: write stripped content atomically
        CLI->>User: legacy removal message
    end

    alt legacyCleanupFailed
        CLI->>User: stderr warning with re-run instructions
    end
Loading

Reviews (7): Last reviewed commit: "Merge origin/main into issue-8273-kimi-h..." | Re-trigger Greptile

Comment thread cmuxTests/KimiHookConfigLocationTests.swift
Comment thread cmux.xcodeproj/project.pbxproj Outdated
@austinywang

Copy link
Copy Markdown
Contributor Author

@codex review
@coderabbitai review
@greptile-apps review
@cubic-dev-ai review

@cubic-dev-ai

cubic-dev-ai Bot commented Jul 16, 2026

Copy link
Copy Markdown

@codex review
@coderabbitai review
@greptile-apps review
@cubic-dev-ai review

@austinywang I can't start this review because your workspace has reached its free monthly review limit. cubic has reviewed 241,631 of the 240,000 allowed lines of code this month. Reviews resume on 1 August 2026 (in 16 days). Paid plans include much higher monthly review limits. Upgrade now to resume reviews.

To help optimise your usage, you can tune cubic to get the most out of your usage limits:

Learn more →

@chatgpt-codex-connector

Copy link
Copy Markdown

To use Codex here, create a Codex account and connect to github.

@coderabbitai

coderabbitai Bot commented Jul 16, 2026 •

Copy link
Copy Markdown

@austinywang I’ll review the changes in #8278.

✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@chatgpt-codex-connector

Copy link
Copy Markdown

To use Codex here, create a Codex account and connect to github.

@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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
cmuxTests/KimiHookConfigLocationTests.swift (1)

157-163: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Drain subprocess output concurrently.

Reading the pipe to EOF before waitUntilExit() can deadlock when CLI output fills the pipe buffer. Drain stdout/stderr while the process runs, then await process termination and collect the captured data.

🤖 Prompt for 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.

In `@cmuxTests/KimiHookConfigLocationTests.swift` around lines 157 - 163, Update
the subprocess execution flow around process.run() in
KimiHookConfigLocationTests so output is drained concurrently while the process
runs, rather than reading to EOF before waitUntilExit(). Keep stdout and stderr
captured through the existing output pipe, await process termination, then
collect the drained data for assertions.
🤖 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.

Outside diff comments:
In `@cmuxTests/KimiHookConfigLocationTests.swift`:
- Around line 157-163: Update the subprocess execution flow around process.run()
in KimiHookConfigLocationTests so output is drained concurrently while the
process runs, rather than reading to EOF before waitUntilExit(). Keep stdout and
stderr captured through the existing output pipe, await process termination,
then collect the drained data for assertions.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 4437dd05-90d4-4d5a-acff-807aa172ebe4

📥 Commits

Reviewing files that changed from the base of the PR and between 54fad68 and 5703bc9.

📒 Files selected for processing (7)
  • CLI/CMUXCLI+AgentHookCatalog.swift
  • CLI/CMUXCLI+AgentHookDefinitions.swift
  • CLI/CMUXCLI+KimiHooks.swift
  • cmuxTests/KimiHookConfigLocationTests.swift
  • docs/agent-hooks.md
  • docs/cli-contract.md
  • docs/feed.md

Comment thread CLI/CMUXCLI+KimiHooks.swift Outdated
@cursor

cursor Bot commented Jul 16, 2026

Copy link
Copy Markdown

Bugbot is paused — on-demand spend limit reached

Bugbot uses usage-based billing for this team and has hit its on-demand spend limit.

A team admin can raise the spend limit in the Cursor dashboard, or wait for the next billing cycle to continue.

@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

🤖 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 `@CLI/CMUXCLI`+KimiHooks.swift:
- Around line 104-114: Update the catch block in the legacy cleanup flow to
include String(describing: error) in the localized warning, preserving the
existing active and legacy config paths while exposing the underlying removal
failure for diagnostics.
🪄 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: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: a851140a-f9a2-43a7-8a63-216464f829d1

📥 Commits

Reviewing files that changed from the base of the PR and between 96d3756 and 784739e.

📒 Files selected for processing (3)
  • CLI/CMUXCLI+KimiHooks.swift
  • Resources/Localizable.xcstrings
  • cmuxTests/KimiHookConfigLocationTests.swift

Comment thread CLI/CMUXCLI+KimiHooks.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.

Actionable comments posted: 1

🤖 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 `@cmuxTests/KimiHookConfigLocationTests.swift`:
- Around line 168-173: Align the Kimi hook installation implementation and tests
on one confirmation policy for legacy cleanup: update the flow exercised by the
decline case so legacy processing and path output match the intended behavior,
and update the already-current active-config case accordingly so its automatic
legacy cleanup behavior is consistent. Apply the corresponding expectations at
cmuxTests/KimiHookConfigLocationTests.swift lines 168-173 and 192-213; inspect
the surrounding installation/confirmation symbols to preserve the chosen policy
across both scenarios.
🪄 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: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 69db8be5-2724-4f20-b10d-6700834b2363

📥 Commits

Reviewing files that changed from the base of the PR and between 784739e and 8a49363.

📒 Files selected for processing (1)
  • cmuxTests/KimiHookConfigLocationTests.swift

Comment thread cmuxTests/KimiHookConfigLocationTests.swift
Comment thread CLI/CMUXCLI+KimiHooks.swift
@austinywang

Copy link
Copy Markdown
Contributor Author

Updated review fix pushed at 019e624dfa for the unreadable legacy Kimi uninstall path.

@codex review
@coderabbitai review
@greptile-apps review
@cubic-dev-ai review

@chatgpt-codex-connector

Copy link
Copy Markdown

To use Codex here, create a Codex account and connect to github.

@cubic-dev-ai

cubic-dev-ai Bot commented Jul 16, 2026

Copy link
Copy Markdown

Updated review fix pushed at 019e624dfa for the unreadable legacy Kimi uninstall path.

@codex review
@coderabbitai review
@greptile-apps review
...

@austinywang I can't start this review because your workspace has reached its free monthly review limit. cubic has reviewed 241,631 of the 240,000 allowed lines of code this month. Reviews resume on 1 August 2026 (in 16 days). Paid plans include much higher monthly review limits. Upgrade now to resume reviews.

To help optimise your usage, you can tune cubic to get the most out of your usage limits:

Learn more →

@chatgpt-codex-connector

Copy link
Copy Markdown

To use Codex here, create a Codex account and connect to github.

@coderabbitai

coderabbitai Bot commented Jul 16, 2026 •

Copy link
Copy Markdown
🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo '=== Commit summary ==='
git show --no-ext-diff --stat --oneline 019e624dfa

echo
echo '=== Incremental diff ==='
git show --no-ext-diff --format=fuller --find-renames --find-copies 019e624dfa -- \
  'CLI/CMUXCLI+KimiHooks.swift' \
  'cmuxTests/KimiHookConfigLocationTests.swift'

echo
echo '=== Affected Swift file outlines ==='
for f in CLI/CMUXCLI+KimiHooks.swift cmuxTests/KimiHookConfigLocationTests.swift; do
  if [[ -f "$f" ]]; then
    echo "--- $f ---"
    ast-grep outline "$f" --items all --view expanded || true
  fi
done

echo
echo '=== Relevant Kimi uninstall/setup symbols and tests ==='
rg -n -C 5 \
  'func (uninstallKimiHooks|removeKimiHooks|installKimiHooks)|legacyKimiConfigURL|canonicalKimiConfigURL|unreadable|uninstall kimi' \
  CLI/CMUXCLI+KimiHooks.swift cmuxTests/KimiHookConfigLocationTests.swift

Length of output: 13546


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo '=== Kimi hook implementation ==='
nl -ba CLI/CMUXCLI+KimiHooks.swift | sed -n '1,280p'

echo
echo '=== Kimi config location tests ==='
nl -ba cmuxTests/KimiHookConfigLocationTests.swift | sed -n '1,430p'

echo
echo '=== New localization entries and adjacent Kimi keys ==='
rg -n -C 6 '"cli\.hooks\.kimi\.(legacyCleanupWarning|legacyUninstallWarning)"|legacy Kimi|legacy hook block' \
  Resources/Localizable.xcstrings

echo
echo '=== Existing warning/reporting patterns for tolerant cleanup failures ==='
rg -n -C 5 'report.*Warning|could not remove|cleanup.*fail|Legacy.*Warning' \
  CLI cmuxTests Resources/Localizable.xcstrings

Length of output: 1046


🏁 Script executed:

#!/bin/bash
set -euo pipefail

print_range() {
  local file="$1"
  local start="$2"
  local end="$3"
  echo "=== ${file}:${start}-${end} ==="
  awk -v start="$start" -v end="$end" 'NR >= start && NR <= end { printf "%6d  %s\n", NR, $0 }' "$file"
}

print_range CLI/CMUXCLI+KimiHooks.swift 1 280
echo
print_range cmuxTests/KimiHookConfigLocationTests.swift 1 430

echo
echo '=== New localization entries and adjacent Kimi keys ==='
rg -n -C 6 '"cli\.hooks\.kimi\.(legacyCleanupWarning|legacyUninstallWarning)"|legacy Kimi|legacy hook block' \
  Resources/Localizable.xcstrings || true

echo
echo '=== Existing warning/reporting patterns for tolerant cleanup failures ==='
rg -n -C 5 'report.*Warning|could not remove|cleanup.*fail|Legacy.*Warning' \
  CLI cmuxTests Resources/Localizable.xcstrings || true

Length of output: 51324


@austinywang Re-reviewed commit 019e624dfa; no findings.

The change correctly keeps active-config uninstall failures fatal, tolerates only legacy cleanup failures, emits an actionable localized warning, and adds regression coverage that verifies the active cmux block is removed while the unreadable legacy path is preserved.

✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

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.

Kimi CLI notifications broken: cmux hooks setup kimi writes to ~/.kimi-code/config.toml but Kimi reads ~/.kimi/config.toml

1 participant