Skip to content

fix(plugin): pass settings under accepted names and run hooks in exec form - #1681

Merged
rohitg00 merged 3 commits into
mainfrom
fix/plugin-settings-exec-hooks
Nov 4, 2026
Merged

rohitg00 merged 3 commits into
mainfrom
fix/plugin-settings-exec-hooks

Conversation

@rohitg00

@rohitg00 rohitg00 commented Nov 4, 2026 •

Copy link
Copy Markdown
Owner

Clears two plugin directory notes and fixes how the plugin reads its settings.

Settings under accepted names. plugin/.mcp.json passed the plugin settings as AGENTMEMORY_URL and AGENTMEMORY_SECRET. The directory accepts only CLAUDE_PLUGIN_OPTION_<KEY> names. It also overrode the user's own AGENTMEMORY_URL with an empty string when the URL setting was left empty, which contradicts the setting's description. The MCP bridge now reads the option names with the same rules as the hooks:

  • A filled option wins.
  • An empty URL option falls back to AGENTMEMORY_URL, then http://localhost:3111.
  • An empty secret option never falls back to an environment secret. A loopback URL still gets the local server's secret.
  • Unsubstituted ${...} placeholders, from hosts that do not fill user_config, count as empty.

Hooks in exec form. The 12 handlers in plugin/hooks/hooks.json use "command": "node", "args": [...]. Claude Code supports this since 2.1.139. The other hosts' hook files are unchanged. connect claude-code --with-hooks writes the same form and replaces an earlier shell-form install instead of duplicating it. The release gate spawns exec-form handlers directly.

The README now says where the plugin reads a remote server's URL and secret.

Tests: 6 new precedence cases in test/plugin-bridge-secret.test.ts, an exec-form check in test/codex-plugin.test.ts, and an upgrade case in test/claude-code-with-hooks.test.ts. Build, skills:check and docs:check pass. The full vitest suite passes except test/integration.test.ts, which needs a live server. All 12 hooks were spawned in exec form and exit 0. The plugin has not been run inside Claude Code yet.

Summary by CodeRabbit

  • New Features
    • Claude Code plugin settings now support configuring the server URL and secret. An empty URL falls back to the environment setting, then to the local server; an empty secret won’t send the environment secret.
    • Plugin hooks now use a format compatible with Claude Code 2.1.139 and later.
  • Bug Fixes
    • Blank or unresolved settings are ignored, preventing placeholder values from being used.
  • Documentation
    • Updated setup instructions and release notes to explain plugin settings and hook compatibility.

@vercel

vercel Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
agentmemory Ready Ready Preview Nov 4, 2026 6:50pm UTC

Request Review

@coderabbitai

coderabbitai Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Caution

Review failed

The pull request is closed.

Walkthrough

The pull request updates Claude Code plugin URL and secret configuration, including setting precedence and fallback behavior. It also changes plugin hooks to exec form and updates hook merging, release-gate execution, tests, and documentation to handle separate commands and arguments.

Changes: Plugin settings

Layer / File(s) Summary
Setting inputs and resolution
plugin/.mcp.json, src/hooks/_endpoint.ts, plugin/scripts/*
The plugin configuration uses Claude option environment keys. Hook setting lookup filters blank and unresolved placeholder values. Secret resolution applies the filtered setting while preserving the behavior that an unusable explicit secret suppresses the environment secret.
Setting consumers and behavior checks
src/mcp/plugin-bridge.ts, src/mcp/rest-proxy.ts, test/plugin-bridge-secret.test.ts, test/mcp-surface-default.test.ts, test/codex-plugin.test.ts, README.md, CHANGELOG.md
The MCP bridge and REST proxy use the shared setting and secret resolution. Tests and documentation cover setting precedence, URL fallbacks, and secret behavior.

Exec-form hooks

Layer / File(s) Summary
Exec-form hook declarations
src/cli/connect/codex-hooks.ts, plugin/hooks/hooks.json, test/codex-plugin.test.ts
Claude Code hook entries now specify node as the command and pass each script path as an argument. The hook handler type and manifest tests support argument arrays.
Hook merging and execution
src/cli/connect/codex-hooks.ts, scripts/release-gate/run.mjs, test/claude-code-with-hooks.test.ts, CHANGELOG.md
Hook merging substitutes the plugin root in commands and arguments and checks both fields when identifying existing handlers. The release gate executes handlers with arguments. Tests cover substitution and replacement of an existing shell-form hook.

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

Change: Bug fix

Possibly related PRs

  • rohitg00/agentmemory#1664: Adds Claude Code URL and secret user configuration and introduces the plugin-option setting names used by this change.

Suggested reviewers: dmazhukov

Merge Risk: Low · up to 1d726

Mergeable with bounded owner awareness: standalone configurations can transmit plugin-option secrets over remote HTTP, and hook installation can remove an unrelated handler that references a plugin script as data. Address these narrow cases or explicitly accept them.

- [ ] Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Devin Review found 2 potential issues.

Devin Review

Comment thread CHANGELOG.md Resolved
Comment thread README.md Resolved
@rohitg00
rohitg00 merged commit 99ec6d1 into main Nov 4, 2026
14 checks passed
@rohitg00
rohitg00 deleted the fix/plugin-settings-exec-hooks branch November 4, 2026 18:54

This branch was successfully deployed

1 active deployment
Preview — 1d726c4b Deployed Nov 4, 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