feat(settings): add hook injection opt-out#2875
Open
rasitakyol wants to merge 1 commit into
Open
Conversation
rasitakyol
marked this pull request as ready for review
July 15, 2026 14:37
Contributor
Greptile SummaryThis PR adds a repository setting for opting out of Emdash-managed agent notification hooks. The main changes are:
Confidence Score: 5/5This looks safe to merge.
|
| Filename | Overview |
|---|---|
| apps/emdash-desktop/src/main/core/agent-hooks/hook-config-service.ts | Separates the injection preference from hook installation success and skips configuration writes after an explicit opt-out. |
| apps/emdash-desktop/src/main/core/conversations/impl/local-conversation.ts | Propagates the preference into command construction and gates hook-related process environment variables. |
| apps/emdash-desktop/src/main/core/settings/schema.ts | Adds the hook-injection boolean to local repository settings. |
| apps/emdash-desktop/src/main/core/settings/settings-registry.ts | Defines hook injection as enabled by default, including for existing stored setting deltas. |
| apps/emdash-desktop/src/renderer/features/settings/components/RepositorySettingsCard.tsx | Adds the repository-level switch and reset control for hook injection. |
| packages/core/src/agents/plugins/capabilities/prompt.ts | Extends command construction context with the optional hook-injection preference. |
| packages/plugins/src/agents/impl/kimi/index.ts | Preserves Kimi's command unchanged when managed hook injection is explicitly disabled. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Start local conversation] --> B[Read repository settings]
B --> C{Hook injection enabled?}
C -->|Yes| D[Refresh provider hook configuration]
C -->|No| E[Skip hook configuration]
D --> F[Build provider command with hook injection enabled]
E --> G[Build provider command with hook injection disabled]
F --> H[Spawn agent with hook environment]
G --> I[Spawn agent without hook environment]
%%{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"}}}%%
flowchart TD
A[Start local conversation] --> B[Read repository settings]
B --> C{Hook injection enabled?}
C -->|Yes| D[Refresh provider hook configuration]
C -->|No| E[Skip hook configuration]
D --> F[Build provider command with hook injection enabled]
E --> G[Build provider command with hook injection disabled]
F --> H[Spawn agent with hook environment]
G --> I[Spawn agent without hook environment]
Reviews (1): Last reviewed commit: "feat(settings): add hook injection opt-o..." | Re-trigger Greptile
Contributor
|
Thanks for the PR, @rasitakyol - we'll review and follow up with feedback here timely. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds a default-on repository setting that lets users opt out of Emdash-managed agent notification hooks for local tasks.
When disabled, Emdash skips persistent config/plugin and
.gitignorewrites, does not modify Kimi's inline--config, and omitsEMDASH_HOOK_*plusEMDASH_PTY_IDfrom the spawned agent environment. Existing managed entries are left untouched, so toggling the setting does not destructively rewrite user config.The injection preference is kept separate from installation success: default-on sessions retain the previous environment behavior even if refreshing a hook file fails.
Related issues
Closes #1944
Testing
git diff --checkpassed.IssueSelector5-second timeout; that test passed immediately when rerun alone.Screenshot/Recording
Not included; the change adds one repository settings row and is covered by build/type checks.
Checklist